Skip to content

Commit

Permalink
Renaming the Contained Shell to Kiosk Next Shell.
Browse files Browse the repository at this point in the history
This is only the first step of renaming this feature, the next steps are:
 - Rename the Contained Shell references in chrome://settings and the rest
   of the browser.
 - Rename all occurrences of Contained Home to KioskNextHome.
For this change, I'm mostly focusing on code living in ash.

We are changing the name of this feature to reflect the refactoring work
and ultimate goal.

Also considered calling it MojoKiosk, but Mojo team prefers to keep the Mojo
name referring specifically to the Mojo library, not uses of the library.

Bug: 933530
Change-Id: I717cee439da14d6bbd575c26b9f55805ad4d5cd8
Reviewed-on: https://chromium-review.googlesource.com/c/1489272
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: Mitsuru Oshima (OOO til 3/4) <oshima@chromium.org>
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Lucas Tenório <ltenorio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636800}
  • Loading branch information
Lucas Tenório authored and Commit Bot committed Mar 1, 2019
1 parent a04cee5 commit 6ca0ed7
Show file tree
Hide file tree
Showing 37 changed files with 307 additions and 309 deletions.
8 changes: 4 additions & 4 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ component("ash") {
"cancel_mode.h",
"cast_config_controller.cc",
"cast_config_controller.h",
"contained_shell/contained_shell_controller.cc",
"contained_shell/contained_shell_controller.h",
"custom_tab/arc_custom_tab_controller.cc",
"custom_tab/arc_custom_tab_controller.h",
"custom_tab/arc_custom_tab_view.cc",
Expand Down Expand Up @@ -341,6 +339,8 @@ component("ash") {
"keyboard/virtual_keyboard_container_layout_manager.h",
"keyboard/virtual_keyboard_controller.cc",
"keyboard/virtual_keyboard_controller.h",
"kiosk_next/kiosk_next_shell_controller.cc",
"kiosk_next/kiosk_next_shell_controller.h",
"laser/laser_pointer_controller.cc",
"laser/laser_pointer_controller.h",
"laser/laser_pointer_view.cc",
Expand Down Expand Up @@ -1565,8 +1565,6 @@ test("ash_unittests") {
"assistant/util/deep_link_util_unittest.cc",
"autoclick/autoclick_drag_event_rewriter_unittest.cc",
"autoclick/autoclick_unittest.cc",
"contained_shell/mock_contained_shell_client.cc",
"contained_shell/mock_contained_shell_client.h",
"cursor_unittest.cc",
"detachable_base/detachable_base_handler_unittest.cc",
"detachable_base/detachable_base_notification_controller_unittest.cc",
Expand Down Expand Up @@ -1616,6 +1614,8 @@ test("ash_unittests") {
"keyboard/ash_keyboard_controller_unittest.cc",
"keyboard/virtual_keyboard_controller_unittest.cc",
"keyboard/virtual_keyboard_unittest.cc",
"kiosk_next/mock_kiosk_next_shell_client.cc",
"kiosk_next/mock_kiosk_next_shell_client.h",
"laser/laser_pointer_controller_unittest.cc",
"laser/laser_segment_utils_unittest.cc",
"lock_screen_action/lock_screen_action_background_controller_impl_unittest.cc",
Expand Down
12 changes: 6 additions & 6 deletions ash/accelerators/accelerator_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#include "ash/assistant/assistant_controller.h"
#include "ash/assistant/assistant_ui_controller.h"
#include "ash/assistant/model/assistant_ui_model.h"
#include "ash/contained_shell/contained_shell_controller.h"
#include "ash/debug.h"
#include "ash/display/display_configuration_controller.h"
#include "ash/display/display_move_window_util.h"
#include "ash/focus_cycler.h"
#include "ash/ime/ime_controller.h"
#include "ash/ime/ime_switch_type.h"
#include "ash/kiosk_next/kiosk_next_shell_controller.h"
#include "ash/magnifier/docked_magnifier_controller.h"
#include "ash/magnifier/magnification_controller.h"
#include "ash/media/media_controller.h"
Expand Down Expand Up @@ -1176,9 +1176,9 @@ void AcceleratorController::Init() {
actions_allowed_in_pinned_mode_.insert(
kActionsAllowedInAppModeOrPinnedMode[i]);
}
for (size_t i = 0; i < kActionsAllowedForContainedShellLength; i++) {
actions_allowed_for_contained_shell_.insert(
kActionsAllowedForContainedShell[i]);
for (size_t i = 0; i < kActionsAllowedForKioskNextShellLength; i++) {
actions_allowed_for_kiosk_next_shell_.insert(
kActionsAllowedForKioskNextShell[i]);
}
for (size_t i = 0; i < kActionsAllowedInPinnedModeLength; ++i)
actions_allowed_in_pinned_mode_.insert(kActionsAllowedInPinnedMode[i]);
Expand Down Expand Up @@ -1729,8 +1729,8 @@ bool AcceleratorController::ShouldActionConsumeKeyEvent(

AcceleratorController::AcceleratorProcessingRestriction
AcceleratorController::GetAcceleratorProcessingRestriction(int action) const {
if (Shell::Get()->contained_shell_controller()->IsEnabled() &&
actions_allowed_for_contained_shell_.count(action) == 0) {
if (Shell::Get()->kiosk_next_shell_controller()->IsEnabled() &&
actions_allowed_for_kiosk_next_shell_.count(action) == 0) {
return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
}
if (Shell::Get()->screen_pinning_controller()->IsPinned() &&
Expand Down
4 changes: 2 additions & 2 deletions ash/accelerators/accelerator_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget,
std::set<int> actions_allowed_in_app_mode_;
// Actions allowed in pinned mode.
std::set<int> actions_allowed_in_pinned_mode_;
// Actions allowed when Contained Shell is enabled.
std::set<int> actions_allowed_for_contained_shell_;
// Actions allowed when Kiosk Next Shell is enabled.
std::set<int> actions_allowed_for_kiosk_next_shell_;
// Actions disallowed if there are no windows.
std::set<int> actions_needing_window_;
// Actions that can be performed without closing the menu (if one is present).
Expand Down
6 changes: 3 additions & 3 deletions ash/accelerators/accelerator_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ const AcceleratorAction kActionsKeepingMenuOpen[] = {
const size_t kActionsKeepingMenuOpenLength =
base::size(kActionsKeepingMenuOpen);

const AcceleratorAction kActionsAllowedForContainedShell[] = {
const AcceleratorAction kActionsAllowedForKioskNextShell[] = {
BRIGHTNESS_DOWN,
BRIGHTNESS_UP,
KEYBOARD_BRIGHTNESS_DOWN,
Expand All @@ -393,7 +393,7 @@ const AcceleratorAction kActionsAllowedForContainedShell[] = {
VOLUME_UP,
};

const size_t kActionsAllowedForContainedShellLength =
base::size(kActionsAllowedForContainedShell);
const size_t kActionsAllowedForKioskNextShellLength =
base::size(kActionsAllowedForKioskNextShell);

} // namespace ash
6 changes: 3 additions & 3 deletions ash/accelerators/accelerator_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ ASH_EXPORT extern const size_t kActionsNeedingWindowLength;
ASH_EXPORT extern const AcceleratorAction kActionsKeepingMenuOpen[];
ASH_EXPORT extern const size_t kActionsKeepingMenuOpenLength;

// Actions that can be performed when the Contained Shell is enabled.
ASH_EXPORT extern const AcceleratorAction kActionsAllowedForContainedShell[];
ASH_EXPORT extern const size_t kActionsAllowedForContainedShellLength;
// Actions that can be performed when the Kiosk Next Shell is enabled.
ASH_EXPORT extern const AcceleratorAction kActionsAllowedForKioskNextShell[];
ASH_EXPORT extern const size_t kActionsAllowedForKioskNextShellLength;

} // namespace ash

Expand Down
63 changes: 0 additions & 63 deletions ash/contained_shell/contained_shell_controller.cc

This file was deleted.

56 changes: 0 additions & 56 deletions ash/contained_shell/contained_shell_controller.h

This file was deleted.

30 changes: 0 additions & 30 deletions ash/contained_shell/mock_contained_shell_client.cc

This file was deleted.

40 changes: 0 additions & 40 deletions ash/contained_shell/mock_contained_shell_client.h

This file was deleted.

File renamed without changes.
62 changes: 62 additions & 0 deletions ash/kiosk_next/kiosk_next_shell_controller.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/kiosk_next/kiosk_next_shell_controller.h"

#include <utility>

#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/session/session_controller.h"
#include "ash/shell.h"
#include "components/account_id/account_id.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"

namespace ash {

KioskNextShellController::KioskNextShellController() = default;

KioskNextShellController::~KioskNextShellController() = default;

// static
void KioskNextShellController::RegisterProfilePrefs(
PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kKioskNextShellEnabled, false,
PrefRegistry::PUBLIC);
}

void KioskNextShellController::BindRequest(
mojom::KioskNextShellControllerRequest request) {
bindings_.AddBinding(this, std::move(request));
}

bool KioskNextShellController::IsEnabled() {
if (!base::FeatureList::IsEnabled(features::kKioskNextShell))
return false;

PrefService* prefs =
Shell::Get()->session_controller()->GetPrimaryUserPrefService();

DCHECK(prefs) << "PrefService should not be null when reading Kiosk Next "
"Shell pref. This usually happens when calling "
"KioskNextShellController::IsEnabled() before sign in.";
return prefs->GetBoolean(prefs::kKioskNextShellEnabled);
}

void KioskNextShellController::LaunchKioskNextShellIfEnabled() {
if (!IsEnabled())
return;
kiosk_next_shell_client_->LaunchKioskNextShell(Shell::Get()
->session_controller()
->GetPrimaryUserSession()
->user_info->account_id);
}

void KioskNextShellController::SetClient(
mojom::KioskNextShellClientPtr client) {
kiosk_next_shell_client_ = std::move(client);
}

} // namespace ash
Loading

0 comments on commit 6ca0ed7

Please sign in to comment.