Commit 3667f1f2 authored by yilkal's avatar yilkal Committed by Commit Bot

Remove KioskNext Shell Client.

Bug: 977019
Change-Id: I5aa71c8fa749e4f013d47eeed56c036572c0635a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1686152Reviewed-by: default avatarJ Kardatzke <jkardatzke@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Yilkal Abe <yilkal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678359}
parent 497bacb4
...@@ -369,11 +369,6 @@ component("ash") { ...@@ -369,11 +369,6 @@ component("ash") {
"keyboard/virtual_keyboard_container_layout_manager.h", "keyboard/virtual_keyboard_container_layout_manager.h",
"keyboard/virtual_keyboard_controller.cc", "keyboard/virtual_keyboard_controller.cc",
"keyboard/virtual_keyboard_controller.h", "keyboard/virtual_keyboard_controller.h",
"kiosk_next/kiosk_next_home_controller.cc",
"kiosk_next/kiosk_next_home_controller.h",
"kiosk_next/kiosk_next_shell_controller_impl.cc",
"kiosk_next/kiosk_next_shell_controller_impl.h",
"kiosk_next/kiosk_next_shell_observer.h",
"laser/laser_pointer_controller.cc", "laser/laser_pointer_controller.cc",
"laser/laser_pointer_controller.h", "laser/laser_pointer_controller.h",
"laser/laser_pointer_view.cc", "laser/laser_pointer_view.cc",
...@@ -1666,10 +1661,6 @@ test("ash_unittests") { ...@@ -1666,10 +1661,6 @@ test("ash_unittests") {
"keyboard/keyboard_controller_impl_unittest.cc", "keyboard/keyboard_controller_impl_unittest.cc",
"keyboard/virtual_keyboard_controller_unittest.cc", "keyboard/virtual_keyboard_controller_unittest.cc",
"keyboard/virtual_keyboard_unittest.cc", "keyboard/virtual_keyboard_unittest.cc",
"kiosk_next/kiosk_next_shell_test_util.cc",
"kiosk_next/kiosk_next_shell_test_util.h",
"kiosk_next/mock_kiosk_next_shell_client.cc",
"kiosk_next/mock_kiosk_next_shell_client.h",
"laser/laser_pointer_controller_unittest.cc", "laser/laser_pointer_controller_unittest.cc",
"laser/laser_segment_utils_unittest.cc", "laser/laser_segment_utils_unittest.cc",
"lock_screen_action/lock_screen_action_background_controller_impl_unittest.cc", "lock_screen_action/lock_screen_action_background_controller_impl_unittest.cc",
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "ash/assistant/assistant_controller.h" #include "ash/assistant/assistant_controller.h"
#include "ash/detachable_base/detachable_base_handler.h" #include "ash/detachable_base/detachable_base_handler.h"
#include "ash/display/display_prefs.h" #include "ash/display/display_prefs.h"
#include "ash/kiosk_next/kiosk_next_shell_controller_impl.h"
#include "ash/login/login_screen_controller.h" #include "ash/login/login_screen_controller.h"
#include "ash/magnifier/docked_magnifier_controller_impl.h" #include "ash/magnifier/docked_magnifier_controller_impl.h"
#include "ash/media/media_controller_impl.h" #include "ash/media/media_controller_impl.h"
...@@ -39,7 +38,6 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) { ...@@ -39,7 +38,6 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
BluetoothPowerController::RegisterProfilePrefs(registry); BluetoothPowerController::RegisterProfilePrefs(registry);
CapsLockNotificationController::RegisterProfilePrefs(registry, for_test); CapsLockNotificationController::RegisterProfilePrefs(registry, for_test);
DockedMagnifierControllerImpl::RegisterProfilePrefs(registry, for_test); DockedMagnifierControllerImpl::RegisterProfilePrefs(registry, for_test);
KioskNextShellControllerImpl::RegisterProfilePrefs(registry, for_test);
LoginScreenController::RegisterProfilePrefs(registry, for_test); LoginScreenController::RegisterProfilePrefs(registry, for_test);
LogoutButtonTray::RegisterProfilePrefs(registry); LogoutButtonTray::RegisterProfilePrefs(registry);
MediaControllerImpl::RegisterProfilePrefs(registry); MediaControllerImpl::RegisterProfilePrefs(registry);
......
agawronska@chromium.org
brunoad@chromium.org
ltenorio@chromium.org
michaelpg@chromium.org
# COMPONENT: UI>Shell>KioskNext
// Copyright 2019 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_home_controller.h"
#include <memory>
#include "ash/display/screen_orientation_controller.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/screen_util.h"
#include "ash/shell.h"
#include "ash/wm/container_finder.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/toplevel_window_event_handler.h"
#include "ash/wm/window_util.h"
#include "ash/wm/wm_event.h"
#include "base/logging.h"
#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/screen.h"
#include "ui/events/event_target.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/transform.h"
namespace ash {
KioskNextHomeController::KioskNextHomeController() {
display::Screen::GetScreen()->AddObserver(this);
home_screen_container_ = Shell::GetPrimaryRootWindow()->GetChildById(
kShellWindowId_HomeScreenContainer);
home_screen_container_->AddObserver(this);
if (!home_screen_container_->children().empty()) {
DCHECK_EQ(1u, home_screen_container_->children().size());
home_screen_window_ = home_screen_container_->children()[0];
}
}
KioskNextHomeController::~KioskNextHomeController() {
display::Screen::GetScreen()->RemoveObserver(this);
if (home_screen_container_)
home_screen_container_->RemoveObserver(this);
}
void KioskNextHomeController::ShowHomeScreenView() {
// Nothing to do because the contents of the app window are always shown
// on the primary display.
// HomeScreenController will show/hide the root home screen window.
}
aura::Window* KioskNextHomeController::GetHomeScreenWindow() {
return home_screen_window_;
}
void KioskNextHomeController::UpdateYPositionAndOpacityForHomeLauncher(
int y_position_in_screen,
float opacity,
UpdateAnimationSettingsCallback callback) {
aura::Window* window = GetHomeScreenWindow();
if (!window)
return;
const gfx::Transform translation(1.f, 0.f, 0.f, 1.f, 0.f,
static_cast<float>(y_position_in_screen));
ui::Layer* layer = window->layer();
layer->GetAnimator()->StopAnimating();
std::unique_ptr<ui::ScopedLayerAnimationSettings> settings;
if (!callback.is_null()) {
settings = std::make_unique<ui::ScopedLayerAnimationSettings>(
layer->GetAnimator());
callback.Run(settings.get());
}
layer->SetOpacity(opacity);
layer->SetTransform(translation);
}
void KioskNextHomeController::UpdateAfterHomeLauncherShown() {}
base::Optional<base::TimeDelta>
KioskNextHomeController::GetOptionalAnimationDuration() {
return base::nullopt;
}
bool KioskNextHomeController::ShouldShowShelfOnHomeScreen() const {
return false;
}
bool KioskNextHomeController::ShouldShowStatusAreaOnHomeScreen() const {
return true;
}
void KioskNextHomeController::OnDisplayMetricsChanged(
const display::Display& display,
uint32_t changed_metrics) {
aura::Window* window = GetHomeScreenWindow();
if (!window)
return;
// Update the window to reflect the display bounds.
const gfx::Rect bounds =
screen_util::SnapBoundsToDisplayEdge(window->bounds(), window);
window->SetBounds(bounds);
const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
wm::GetWindowState(window)->OnWMEvent(&event);
}
void KioskNextHomeController::OnWindowAdded(aura::Window* new_window) {
DCHECK(!home_screen_window_);
DCHECK_EQ(new_window->type(), aura::client::WindowType::WINDOW_TYPE_NORMAL);
home_screen_window_ = new_window;
Shell::Get()->screen_orientation_controller()->LockOrientationForWindow(
home_screen_window_, OrientationLockType::kLandscape);
Shell::Get()->AddPreTargetHandler(this, ui::EventTarget::Priority::kSystem);
}
void KioskNextHomeController::OnWillRemoveWindow(aura::Window* window) {
DCHECK_EQ(home_screen_window_, window);
Shell::Get()->RemovePreTargetHandler(this);
home_screen_window_ = nullptr;
}
void KioskNextHomeController::OnWindowDestroying(aura::Window* window) {
if (window == home_screen_container_)
home_screen_container_ = nullptr;
}
void KioskNextHomeController::OnGestureEvent(ui::GestureEvent* event) {
aura::Window* target = static_cast<aura::Window*>(event->target());
int component = wm::GetNonClientComponent(target, event->location());
aura::Window* new_target =
ToplevelWindowEventHandler::GetTargetForClientAreaGesture(event, target);
if (new_target)
target = new_target;
if (!(target == home_screen_window_ || started_handling_events_))
return;
if (component == HTCLIENT && event->type() == ui::ET_GESTURE_SCROLL_BEGIN) {
auto* overview_controller = Shell::Get()->overview_controller();
if (!overview_controller->InOverviewSession())
overview_controller->StartOverview();
started_handling_events_ = true;
}
if (started_handling_events_) {
event->SetHandled();
event->StopPropagation();
if (event->type() == ui::EventType::ET_GESTURE_SCROLL_END ||
event->type() == ui::EventType::ET_GESTURE_END)
started_handling_events_ = false;
}
}
} // namespace ash
// Copyright 2019 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.
#ifndef ASH_KIOSK_NEXT_KIOSK_NEXT_HOME_CONTROLLER_H_
#define ASH_KIOSK_NEXT_KIOSK_NEXT_HOME_CONTROLLER_H_
#include "ash/ash_export.h"
#include "ash/home_screen/home_screen_delegate.h"
#include "base/macros.h"
#include "ui/aura/window_observer.h"
#include "ui/display/display_observer.h"
#include "ui/events/event_handler.h"
namespace ui {
class GestureEvent;
}
namespace ash {
// KioskNextHomeController manages the Home window for the Kiosk Next shell.
// TODO(michaelpg): Show a slide-down animation when opening Overview.
// TODO(michaelpg): Suppress tap events in the Kiosk Next Home window when a
// gesture event triggers Overview this way.
class ASH_EXPORT KioskNextHomeController : public HomeScreenDelegate,
public display::DisplayObserver,
public aura::WindowObserver,
public ui::EventHandler {
public:
KioskNextHomeController();
~KioskNextHomeController() override;
// HomeScreenDelegate:
void ShowHomeScreenView() override;
aura::Window* GetHomeScreenWindow() override;
void UpdateYPositionAndOpacityForHomeLauncher(
int y_position_in_screen,
float opacity,
UpdateAnimationSettingsCallback callback) override;
void UpdateAfterHomeLauncherShown() override;
base::Optional<base::TimeDelta> GetOptionalAnimationDuration() override;
bool ShouldShowShelfOnHomeScreen() const override;
bool ShouldShowStatusAreaOnHomeScreen() const override;
// display::DisplayObserver:
void OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) override;
// aura::WindowObserver:
void OnWindowAdded(aura::Window* new_window) override;
void OnWillRemoveWindow(aura::Window* window) override;
void OnWindowDestroying(aura::Window* window) override;
// ui::EventHandler:
void OnGestureEvent(ui::GestureEvent* event) override;
private:
bool started_handling_events_ = false;
aura::Window* home_screen_container_ = nullptr;
aura::Window* home_screen_window_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(KioskNextHomeController);
};
} // namespace ash
#endif // ASH_KIOSK_NEXT_KIOSK_NEXT_HOME_CONTROLLER_H_
// 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_impl.h"
#include <memory>
#include <utility>
#include "ash/home_screen/home_screen_controller.h"
#include "ash/kiosk_next/kiosk_next_home_controller.h"
#include "ash/kiosk_next/kiosk_next_shell_observer.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/shelf_model.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "base/metrics/histogram_macros.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "components/account_id/account_id.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "ui/base/l10n/l10n_util.h"
namespace ash {
KioskNextShellControllerImpl::KioskNextShellControllerImpl() = default;
KioskNextShellControllerImpl::~KioskNextShellControllerImpl() = default;
// static
void KioskNextShellControllerImpl::RegisterProfilePrefs(
PrefRegistrySimple* registry,
bool for_test) {
if (for_test) {
registry->RegisterBooleanPref(prefs::kKioskNextShellEnabled, false,
PrefRegistry::PUBLIC);
return;
}
}
void KioskNextShellControllerImpl::SetClientAndLaunchSession(
KioskNextShellClient* client) {
DCHECK_NE(!!client, !!client_);
client_ = client;
LaunchKioskNextShellIfEnabled();
}
bool KioskNextShellControllerImpl::IsEnabled() {
return kiosk_next_enabled_;
}
void KioskNextShellControllerImpl::AddObserver(
KioskNextShellObserver* observer) {
observer_list_.AddObserver(observer);
}
void KioskNextShellControllerImpl::RemoveObserver(
KioskNextShellObserver* observer) {
observer_list_.RemoveObserver(observer);
}
void KioskNextShellControllerImpl::OnActiveUserPrefServiceChanged(
PrefService* pref_service) {
LaunchKioskNextShellIfEnabled();
}
void KioskNextShellControllerImpl::LaunchKioskNextShellIfEnabled() {
SessionControllerImpl* session_controller =
Shell::Get()->session_controller();
PrefService* pref_service = session_controller->GetPrimaryUserPrefService();
if (!pref_service)
return;
if (!client_)
return;
bool prev_kiosk_next_enabled = kiosk_next_enabled_;
kiosk_next_enabled_ =
base::FeatureList::IsEnabled(features::kKioskNextShell) &&
pref_service->GetBoolean(prefs::kKioskNextShellEnabled);
if (!kiosk_next_enabled_ || prev_kiosk_next_enabled)
return;
// Replace the AppListController with a KioskNextHomeController.
kiosk_next_home_controller_ = std::make_unique<KioskNextHomeController>();
Shell::Get()->home_screen_controller()->SetDelegate(
kiosk_next_home_controller_.get());
Shell::Get()->RemoveAppListController();
client_->LaunchKioskNextShell(
session_controller->GetPrimaryUserSession()->user_info.account_id);
UMA_HISTOGRAM_BOOLEAN("KioskNextShell.Launched", true);
// Since the kiosk next shelf only has navigation buttons (back and home),
// its shelf model for apps is empty.
shelf_model_ = std::make_unique<ShelfModel>();
// Notify observers that KioskNextShell has been enabled.
for (KioskNextShellObserver& observer : observer_list_) {
observer.OnKioskNextEnabled();
}
}
} // namespace ash
// 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.
#ifndef ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_CONTROLLER_IMPL_H_
#define ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_CONTROLLER_IMPL_H_
#include <memory>
#include "ash/ash_export.h"
#include "ash/kiosk_next/kiosk_next_shell_observer.h"
#include "ash/public/cpp/kiosk_next_shell.h"
#include "ash/session/session_observer.h"
#include "base/macros.h"
#include "base/observer_list.h"
class PrefRegistrySimple;
namespace ash {
class KioskNextHomeController;
class ShelfModel;
// KioskNextShellControllerImpl allows an ash consumer to manage a Kiosk Next
// session. During this session most system functions are disabled and we launch
// a specific app (Kiosk Next Home) that takes the whole screen.
class ASH_EXPORT KioskNextShellControllerImpl : public KioskNextShellController,
public SessionObserver {
public:
KioskNextShellControllerImpl();
~KioskNextShellControllerImpl() override;
// Register prefs related to the Kiosk Next Shell.
static void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test);
// KioskNextShellController:
void SetClientAndLaunchSession(KioskNextShellClient* client) override;
// Returns if the Kiosk Next Shell is enabled for the current user. If there's
// no signed-in user, this returns false.
bool IsEnabled();
void AddObserver(KioskNextShellObserver* observer);
void RemoveObserver(KioskNextShellObserver* observer);
// SessionObserver:
void OnActiveUserPrefServiceChanged(PrefService* pref_service) override;
ShelfModel* shelf_model() { return shelf_model_.get(); }
private:
// Launches Kiosk Next if the pref is enabled and the KioskNextShellClient is
// available.
void LaunchKioskNextShellIfEnabled();
KioskNextShellClient* client_ = nullptr;
base::ObserverList<KioskNextShellObserver> observer_list_;
ScopedSessionObserver session_observer_{this};
bool kiosk_next_enabled_ = false;
// Controls the KioskNext home screen when the Kiosk Next Shell is enabled.
std::unique_ptr<KioskNextHomeController> kiosk_next_home_controller_;
// When KioskNextShell is enabled, only the home button and back button are
// made visible on the Shelf. KioskNextShellControllerImpl therefore hosts its
// own ShelfModel to control the entries visible on the shelf.
std::unique_ptr<ShelfModel> shelf_model_;
DISALLOW_COPY_AND_ASSIGN(KioskNextShellControllerImpl);
};
} // namespace ash
#endif // ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_CONTROLLER_IMPL_H_
// Copyright 2019 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.
#ifndef ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_OBSERVER_H_
#define ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_OBSERVER_H_
#include "ash/ash_export.h"
#include "base/observer_list_types.h"
namespace ash {
class ASH_EXPORT KioskNextShellObserver : public base::CheckedObserver {
public:
// This method is only called once when KioskNextShell is enabled.
virtual void OnKioskNextEnabled() {}
};
} // namespace ash
#endif // ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_OBSERVER_H_
// Copyright 2019 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_test_util.h"
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/session/session_controller_impl.h"
#include "ash/session/test_session_controller_client.h"
#include "ash/shell.h"
#include "components/prefs/pref_service.h"
namespace ash {
namespace {
const char kTestUserEmail[] = "primary_user1@test.com";
} // namespace
void LogInKioskNextUser(
TestSessionControllerClient* session_controller_client) {
// Create session for user.
session_controller_client->AddUserSession(
kTestUserEmail, user_manager::USER_TYPE_REGULAR,
true /* enable_settings */, true /* provide_pref_service */);
// Set the user's KioskNextShell preference.
PrefService* pref_service =
Shell::Get()->session_controller()->GetUserPrefServiceForUser(
AccountId::FromUserEmail(kTestUserEmail));
pref_service->Set(prefs::kKioskNextShellEnabled, base::Value(true));
// Start the session after setting the pref.
session_controller_client->SwitchActiveUser(
AccountId::FromUserEmail(kTestUserEmail));
session_controller_client->SetSessionState(
session_manager::SessionState::ACTIVE);
}
} // namespace ash
// Copyright 2019 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.
#ifndef ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_TEST_UTIL_H_
#define ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_TEST_UTIL_H_
namespace ash {
class TestSessionControllerClient;
// Logs in a user with Kiosk Next enabled.
void LogInKioskNextUser(TestSessionControllerClient* session_controller_client);
} // namespace ash
#endif // ASH_KIOSK_NEXT_KIOSK_NEXT_SHELL_TEST_UTIL_H_
// 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/mock_kiosk_next_shell_client.h"
namespace ash {
MockKioskNextShellClient::MockKioskNextShellClient() {
KioskNextShellController::Get()->SetClientAndLaunchSession(this);
}
MockKioskNextShellClient::~MockKioskNextShellClient() {
KioskNextShellController::Get()->SetClientAndLaunchSession(nullptr);
}
} // namespace ash
// 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.
#ifndef ASH_KIOSK_NEXT_MOCK_KIOSK_NEXT_SHELL_CLIENT_H_
#define ASH_KIOSK_NEXT_MOCK_KIOSK_NEXT_SHELL_CLIENT_H_
#include "ash/public/cpp/kiosk_next_shell.h"
#include "base/macros.h"
#include "components/account_id/account_id.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace ash {
class MockKioskNextShellClient : public KioskNextShellClient {
public:
MockKioskNextShellClient();
~MockKioskNextShellClient() override;
// KioskNextShellClient:
MOCK_METHOD1(LaunchKioskNextShell, void(const AccountId& account_id));
private:
DISALLOW_COPY_AND_ASSIGN(MockKioskNextShellClient);
};
} // namespace ash
#endif // ASH_KIOSK_NEXT_MOCK_KIOSK_NEXT_SHELL_CLIENT_H_
...@@ -111,8 +111,6 @@ component("cpp") { ...@@ -111,8 +111,6 @@ component("cpp") {
"keyboard_shortcut_viewer.h", "keyboard_shortcut_viewer.h",
"kiosk_app_menu.cc", "kiosk_app_menu.cc",
"kiosk_app_menu.h", "kiosk_app_menu.h",
"kiosk_next_shell.cc",
"kiosk_next_shell.h",
"locale_update_controller.cc", "locale_update_controller.cc",
"locale_update_controller.h", "locale_update_controller.h",
"lock_screen_widget_factory.cc", "lock_screen_widget_factory.cc",
......
...@@ -115,14 +115,6 @@ const char kAccessibilityDictationEnabled[] = "settings.a11y.dictation"; ...@@ -115,14 +115,6 @@ const char kAccessibilityDictationEnabled[] = "settings.a11y.dictation";
// regardless of the state of a11y features. // regardless of the state of a11y features.
const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu"; const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu";
// A boolean pref that stores whether the user is eligible to start the Kiosk
// Next shell.
const char kKioskNextShellEligible[] = "ash.kiosk_next_shell.eligible";
// A boolean pref that stores whether the Kiosk Next Shell is enabled. When it
// is, we start it after sign in.
const char kKioskNextShellEnabled[] = "ash.kiosk_next_shell.enabled";
// A boolean pref storing the enabled status of the Docked Magnifier feature. // A boolean pref storing the enabled status of the Docked Magnifier feature.
const char kDockedMagnifierEnabled[] = "ash.docked_magnifier.enabled"; const char kDockedMagnifierEnabled[] = "ash.docked_magnifier.enabled";
// A double pref storing the scale value of the Docked Magnifier feature by // A double pref storing the scale value of the Docked Magnifier feature by
......
...@@ -45,9 +45,6 @@ ASH_PUBLIC_EXPORT extern const char kAccessibilitySwitchAccessAutoScanSpeedMs[]; ...@@ -45,9 +45,6 @@ ASH_PUBLIC_EXPORT extern const char kAccessibilitySwitchAccessAutoScanSpeedMs[];
ASH_PUBLIC_EXPORT extern const char kAccessibilityDictationEnabled[]; ASH_PUBLIC_EXPORT extern const char kAccessibilityDictationEnabled[];
ASH_PUBLIC_EXPORT extern const char kShouldAlwaysShowAccessibilityMenu[]; ASH_PUBLIC_EXPORT extern const char kShouldAlwaysShowAccessibilityMenu[];
ASH_PUBLIC_EXPORT extern const char kKioskNextShellEligible[];
ASH_PUBLIC_EXPORT extern const char kKioskNextShellEnabled[];
ASH_PUBLIC_EXPORT extern const char kDockedMagnifierEnabled[]; ASH_PUBLIC_EXPORT extern const char kDockedMagnifierEnabled[];
ASH_PUBLIC_EXPORT extern const char kDockedMagnifierScale[]; ASH_PUBLIC_EXPORT extern const char kDockedMagnifierScale[];
ASH_PUBLIC_EXPORT extern const char ASH_PUBLIC_EXPORT extern const char
......
// Copyright 2019 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/public/cpp/kiosk_next_shell.h"
#include "base/logging.h"
namespace ash {
namespace {
KioskNextShellController* g_instance = nullptr;
}
// static
KioskNextShellController* KioskNextShellController::Get() {
return g_instance;
}
KioskNextShellController::KioskNextShellController() {
DCHECK_EQ(nullptr, g_instance);
g_instance = this;
}
KioskNextShellController::~KioskNextShellController() {
DCHECK_EQ(this, g_instance);
g_instance = nullptr;
}
} // namespace ash
// Copyright 2019 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.
#ifndef ASH_PUBLIC_CPP_KIOSK_NEXT_SHELL_H_
#define ASH_PUBLIC_CPP_KIOSK_NEXT_SHELL_H_
#include "ash/public/cpp/ash_public_export.h"
class AccountId;
namespace ash {
// Performs browser-side functionality for Kiosk Next, e.g. launching the
// KioskNextShell.
class ASH_PUBLIC_EXPORT KioskNextShellClient {
public:
// Launch the Kiosk Next Shell for the user identified by |account_id|.
virtual void LaunchKioskNextShell(const AccountId& account_id) = 0;
protected:
virtual ~KioskNextShellClient() = default;
};
// Interface that allows Chrome to notify Ash when the KioskNextShellClient is
// ready.
class ASH_PUBLIC_EXPORT KioskNextShellController {
public:
static KioskNextShellController* Get();
// Registers the client, and if non-null, launches the Kiosk Next Shell
// session.
virtual void SetClientAndLaunchSession(KioskNextShellClient* client) = 0;
protected:
KioskNextShellController();
virtual ~KioskNextShellController();
};
} // namespace ash
#endif // ASH_PUBLIC_CPP_KIOSK_NEXT_SHELL_H_
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include "ash/ime/ime_controller.h" #include "ash/ime/ime_controller.h"
#include "ash/keyboard/keyboard_controller_impl.h" #include "ash/keyboard/keyboard_controller_impl.h"
#include "ash/keyboard/ui/keyboard_ui_factory.h" #include "ash/keyboard/ui/keyboard_ui_factory.h"
#include "ash/kiosk_next/kiosk_next_shell_controller_impl.h"
#include "ash/laser/laser_pointer_controller.h" #include "ash/laser/laser_pointer_controller.h"
#include "ash/login/login_screen_controller.h" #include "ash/login/login_screen_controller.h"
#include "ash/login_status.h" #include "ash/login_status.h"
...@@ -713,9 +712,6 @@ Shell::~Shell() { ...@@ -713,9 +712,6 @@ Shell::~Shell() {
// Close all widgets (including the shelf) and destroy all window containers. // Close all widgets (including the shelf) and destroy all window containers.
CloseAllRootWindowChildWindows(); CloseAllRootWindowChildWindows();
// Destruct KioskNextShellController after Shelf
kiosk_next_shell_controller_.reset();
login_screen_controller_.reset(); login_screen_controller_.reset();
system_notification_controller_.reset(); system_notification_controller_.reset();
// Should be destroyed after Shelf and |system_notification_controller_|. // Should be destroyed after Shelf and |system_notification_controller_|.
...@@ -896,8 +892,7 @@ void Shell::Init( ...@@ -896,8 +892,7 @@ void Shell::Init(
std::make_unique<MultiDeviceNotificationPresenter>( std::make_unique<MultiDeviceNotificationPresenter>(
message_center::MessageCenter::Get(), connector_); message_center::MessageCenter::Get(), connector_);
} }
kiosk_next_shell_controller_ =
std::make_unique<KioskNextShellControllerImpl>();
tablet_mode_controller_ = std::make_unique<TabletModeController>(); tablet_mode_controller_ = std::make_unique<TabletModeController>();
accessibility_focus_ring_controller_ = accessibility_focus_ring_controller_ =
......
...@@ -129,7 +129,6 @@ class ImeController; ...@@ -129,7 +129,6 @@ class ImeController;
class ImmersiveContext; class ImmersiveContext;
class KeyAccessibilityEnabler; class KeyAccessibilityEnabler;
class KeyboardBrightnessControlDelegate; class KeyboardBrightnessControlDelegate;
class KioskNextShellControllerImpl;
class KeyboardControllerImpl; class KeyboardControllerImpl;
class LaserPointerController; class LaserPointerController;
class LocaleUpdateControllerImpl; class LocaleUpdateControllerImpl;
...@@ -381,9 +380,6 @@ class ASH_EXPORT Shell : public SessionObserver, ...@@ -381,9 +380,6 @@ class ASH_EXPORT Shell : public SessionObserver,
KeyboardBrightnessControlDelegate* keyboard_brightness_control_delegate() { KeyboardBrightnessControlDelegate* keyboard_brightness_control_delegate() {
return keyboard_brightness_control_delegate_.get(); return keyboard_brightness_control_delegate_.get();
} }
KioskNextShellControllerImpl* kiosk_next_shell_controller() {
return kiosk_next_shell_controller_.get();
}
KeyboardControllerImpl* keyboard_controller() { KeyboardControllerImpl* keyboard_controller() {
return keyboard_controller_.get(); return keyboard_controller_.get();
} }
...@@ -667,7 +663,6 @@ class ASH_EXPORT Shell : public SessionObserver, ...@@ -667,7 +663,6 @@ class ASH_EXPORT Shell : public SessionObserver,
std::unique_ptr<ImmersiveContext> immersive_context_; std::unique_ptr<ImmersiveContext> immersive_context_;
std::unique_ptr<KeyboardBrightnessControlDelegate> std::unique_ptr<KeyboardBrightnessControlDelegate>
keyboard_brightness_control_delegate_; keyboard_brightness_control_delegate_;
std::unique_ptr<KioskNextShellControllerImpl> kiosk_next_shell_controller_;
std::unique_ptr<LocaleUpdateControllerImpl> locale_update_controller_; std::unique_ptr<LocaleUpdateControllerImpl> locale_update_controller_;
std::unique_ptr<LoginScreenController> login_screen_controller_; std::unique_ptr<LoginScreenController> login_screen_controller_;
std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_;
......
...@@ -197,12 +197,6 @@ void Preferences::RegisterProfilePrefs( ...@@ -197,12 +197,6 @@ void Preferences::RegisterProfilePrefs(
hardware_keyboard_id = "xkb:us::eng"; // only for testing. hardware_keyboard_id = "xkb:us::eng"; // only for testing.
} }
registry->RegisterBooleanPref(ash::prefs::kKioskNextShellEligible,
/*default_value=*/false);
registry->RegisterBooleanPref(ash::prefs::kKioskNextShellEnabled,
/*default_value=*/false, PrefRegistry::PUBLIC);
registry->RegisterBooleanPref(prefs::kPerformanceTracingEnabled, false); registry->RegisterBooleanPref(prefs::kPerformanceTracingEnabled, false);
// This pref is device specific and must not be synced. // This pref is device specific and must not be synced.
......
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
#include "chrome/browser/chromeos/system_logs/single_log_file_log_source.h" #include "chrome/browser/chromeos/system_logs/single_log_file_log_source.h"
#include "chrome/browser/extensions/component_loader.h" #include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/kiosk_next_shell_client.h"
#include "components/feedback/feedback_util.h" #include "components/feedback/feedback_util.h"
#include "components/feedback/system_logs/system_logs_source.h" #include "components/feedback/system_logs/system_logs_source.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
...@@ -225,11 +223,6 @@ void ChromeFeedbackPrivateDelegate::UnloadFeedbackExtension( ...@@ -225,11 +223,6 @@ void ChromeFeedbackPrivateDelegate::UnloadFeedbackExtension(
api::feedback_private::LandingPageType api::feedback_private::LandingPageType
ChromeFeedbackPrivateDelegate::GetLandingPageType( ChromeFeedbackPrivateDelegate::GetLandingPageType(
const feedback::FeedbackData& feedback_data) const { const feedback::FeedbackData& feedback_data) const {
if (KioskNextShellClient::Get() &&
KioskNextShellClient::Get()->has_launched()) {
return api::feedback_private::LANDING_PAGE_TYPE_NOLANDINGPAGE;
}
// Googlers using eve get a custom landing page. // Googlers using eve get a custom landing page.
if (!feedback_util::IsGoogleEmail(feedback_data.user_email())) if (!feedback_util::IsGoogleEmail(feedback_data.user_email()))
return api::feedback_private::LANDING_PAGE_TYPE_NORMAL; return api::feedback_private::LANDING_PAGE_TYPE_NORMAL;
......
...@@ -1453,8 +1453,6 @@ jumbo_split_static_library("ui") { ...@@ -1453,8 +1453,6 @@ jumbo_split_static_library("ui") {
"ash/keyboard/chrome_keyboard_ui_factory.h", "ash/keyboard/chrome_keyboard_ui_factory.h",
"ash/keyboard/chrome_keyboard_web_contents.cc", "ash/keyboard/chrome_keyboard_web_contents.cc",
"ash/keyboard/chrome_keyboard_web_contents.h", "ash/keyboard/chrome_keyboard_web_contents.h",
"ash/kiosk_next_shell_client.cc",
"ash/kiosk_next_shell_client.h",
"ash/launcher/app_shortcut_launcher_item_controller.cc", "ash/launcher/app_shortcut_launcher_item_controller.cc",
"ash/launcher/app_shortcut_launcher_item_controller.h", "ash/launcher/app_shortcut_launcher_item_controller.h",
"ash/launcher/app_window_launcher_controller.cc", "ash/launcher/app_window_launcher_controller.cc",
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "chrome/browser/ui/ash/cast_config_controller_media_router.h" #include "chrome/browser/ui/ash/cast_config_controller_media_router.h"
#include "chrome/browser/ui/ash/chrome_new_window_client.h" #include "chrome/browser/ui/ash/chrome_new_window_client.h"
#include "chrome/browser/ui/ash/ime_controller_client.h" #include "chrome/browser/ui/ash/ime_controller_client.h"
#include "chrome/browser/ui/ash/kiosk_next_shell_client.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/login_screen_client.h" #include "chrome/browser/ui/ash/login_screen_client.h"
#include "chrome/browser/ui/ash/media_client_impl.h" #include "chrome/browser/ui/ash/media_client_impl.h"
...@@ -202,11 +201,6 @@ void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { ...@@ -202,11 +201,6 @@ void ChromeBrowserMainExtraPartsAsh::PostProfileInit() {
// Initialize TabScrubber after the Ash Shell has been initialized. // Initialize TabScrubber after the Ash Shell has been initialized.
TabScrubber::GetInstance(); TabScrubber::GetInstance();
if (base::FeatureList::IsEnabled(ash::features::kKioskNextShell)) {
kiosk_next_shell_client_ = std::make_unique<KioskNextShellClient>();
kiosk_next_shell_client_->Init();
}
} }
void ChromeBrowserMainExtraPartsAsh::PostBrowserStart() { void ChromeBrowserMainExtraPartsAsh::PostBrowserStart() {
...@@ -242,7 +236,6 @@ void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { ...@@ -242,7 +236,6 @@ void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() {
display_settings_handler_.reset(); display_settings_handler_.reset();
media_client_.reset(); media_client_.reset();
login_screen_client_.reset(); login_screen_client_.reset();
kiosk_next_shell_client_.reset();
// Initialized in PreProfileInit: // Initialized in PreProfileInit:
system_tray_client_.reset(); system_tray_client_.reset();
......
...@@ -26,7 +26,6 @@ class AshShellInit; ...@@ -26,7 +26,6 @@ class AshShellInit;
class CastConfigControllerMediaRouter; class CastConfigControllerMediaRouter;
class ChromeNewWindowClient; class ChromeNewWindowClient;
class ImeControllerClient; class ImeControllerClient;
class KioskNextShellClient;
class LoginScreenClient; class LoginScreenClient;
class MediaClientImpl; class MediaClientImpl;
class MobileDataNotifications; class MobileDataNotifications;
...@@ -101,7 +100,6 @@ class ChromeBrowserMainExtraPartsAsh : public ChromeBrowserMainExtraParts { ...@@ -101,7 +100,6 @@ class ChromeBrowserMainExtraPartsAsh : public ChromeBrowserMainExtraParts {
#endif #endif
// Initialized in PostProfileInit in all configs: // Initialized in PostProfileInit in all configs:
std::unique_ptr<KioskNextShellClient> kiosk_next_shell_client_;
std::unique_ptr<LoginScreenClient> login_screen_client_; std::unique_ptr<LoginScreenClient> login_screen_client_;
std::unique_ptr<MediaClientImpl> media_client_; std::unique_ptr<MediaClientImpl> media_client_;
std::unique_ptr<policy::DisplaySettingsHandler> display_settings_handler_; std::unique_ptr<policy::DisplaySettingsHandler> display_settings_handler_;
......
// 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 "chrome/browser/ui/ash/kiosk_next_shell_client.h"
#include "base/logging.h"
namespace {
KioskNextShellClient* g_kiosk_next_shell_client_instance = nullptr;
} // namespace
KioskNextShellClient::KioskNextShellClient() {
DCHECK(!g_kiosk_next_shell_client_instance);
g_kiosk_next_shell_client_instance = this;
}
KioskNextShellClient::~KioskNextShellClient() {
DCHECK_EQ(this, g_kiosk_next_shell_client_instance);
g_kiosk_next_shell_client_instance = nullptr;
ash::KioskNextShellController::Get()->SetClientAndLaunchSession(nullptr);
}
void KioskNextShellClient::Init() {
ash::KioskNextShellController::Get()->SetClientAndLaunchSession(this);
}
// static
KioskNextShellClient* KioskNextShellClient::Get() {
return g_kiosk_next_shell_client_instance;
}
void KioskNextShellClient::LaunchKioskNextShell(const AccountId& account_id) {
// TODO(https://crbug.com/977019): Finish cleaning up this class.
}
// 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.
#ifndef CHROME_BROWSER_UI_ASH_KIOSK_NEXT_SHELL_CLIENT_H_
#define CHROME_BROWSER_UI_ASH_KIOSK_NEXT_SHELL_CLIENT_H_
#include "ash/public/cpp/kiosk_next_shell.h"
#include "base/macros.h"
class KioskNextShellClient : public ash::KioskNextShellClient {
public:
KioskNextShellClient();
~KioskNextShellClient() override;
void Init();
// Returns the singleton KioskNextShellClient instance, if it exists.
static KioskNextShellClient* Get();
// ash::KioskNextShellClient:
void LaunchKioskNextShell(const AccountId& account_id) override;
bool has_launched() const { return has_launched_; }
private:
// True once the KioskNextShell has been launched.
bool has_launched_ = false;
DISALLOW_COPY_AND_ASSIGN(KioskNextShellClient);
};
#endif // CHROME_BROWSER_UI_ASH_KIOSK_NEXT_SHELL_CLIENT_H_
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/ash/kiosk_next_shell_client.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h"
#include "chrome/browser/ui/ash/tablet_mode_client.h" #include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
...@@ -63,13 +62,6 @@ bool IsLoginFeedbackModalDialog(const AppWindow* app_window) { ...@@ -63,13 +62,6 @@ bool IsLoginFeedbackModalDialog(const AppWindow* app_window) {
state == SessionState::LOGIN_SECONDARY; state == SessionState::LOGIN_SECONDARY;
} }
// Return true if |app_window| is a Kiosk Next Home app in a KioskNext session.
bool IsKioskNextHomeWindow(const AppWindow* app_window) {
return KioskNextShellClient::Get() &&
KioskNextShellClient::Get()->has_launched() &&
app_window->extension_id() == extension_misc::kKioskNextHomeAppId;
}
} // namespace } // namespace
ChromeNativeAppWindowViewsAuraAsh::ChromeNativeAppWindowViewsAuraAsh() ChromeNativeAppWindowViewsAuraAsh::ChromeNativeAppWindowViewsAuraAsh()
...@@ -120,8 +112,6 @@ void ChromeNativeAppWindowViewsAuraAsh::OnBeforeWidgetInit( ...@@ -120,8 +112,6 @@ void ChromeNativeAppWindowViewsAuraAsh::OnBeforeWidgetInit(
container_id = ash::kShellWindowId_ImeWindowParentContainer; container_id = ash::kShellWindowId_ImeWindowParentContainer;
else if (create_params.show_on_lock_screen) else if (create_params.show_on_lock_screen)
container_id = ash::kShellWindowId_LockActionHandlerContainer; container_id = ash::kShellWindowId_LockActionHandlerContainer;
else if (IsKioskNextHomeWindow(app_window()))
container_id = ash::kShellWindowId_HomeScreenContainer;
if (container_id.has_value()) { if (container_id.has_value()) {
ash_util::SetupWidgetInitParamsForContainer(init_params, *container_id); ash_util::SetupWidgetInitParamsForContainer(init_params, *container_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment