Remove lock screen app [CL #4]. Remove code in ash
1) ash/lock_screen_action 2) tray action Bug: 376354347 Change-Id: Ia2b3c688d6748061e26342a749854c32ec9b399d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6001899 Auto-Submit: Mitsuru Oshima <oshima@chromium.org> Commit-Queue: Mustafa Emre Acer <meacer@chromium.org> Reviewed-by: Mustafa Emre Acer <meacer@chromium.org> Reviewed-by: Toni Barzic <tbarzic@google.com> Cr-Commit-Position: refs/heads/main@{#1380591}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2deb078251
commit
8d9519bb5b
ash
BUILD.gnash_interfaces.cc
lock_screen_action
DIR_METADATAlock_screen_action_background_controller.cclock_screen_action_background_controller.hlock_screen_action_background_controller_impl.cclock_screen_action_background_controller_impl.hlock_screen_action_background_controller_impl_test_api.hlock_screen_action_background_controller_stub.cclock_screen_action_background_controller_stub.hlock_screen_action_background_observer.hlock_screen_action_background_state.hlock_screen_action_background_view.cclock_screen_action_background_view.hlock_screen_action_background_view_test_api.hlock_screen_note_display_state_handler.cclock_screen_note_display_state_handler.hlock_screen_note_launcher.cclock_screen_note_launcher.htest_lock_screen_action_background_controller.cctest_lock_screen_action_background_controller.h
login
login_screen_controller.cclogin_screen_controller.hmock_login_screen_client.htest_login_screen_model.cctest_login_screen_model.h
ui
lock_contents_view.cclock_contents_view.hlock_contents_view_test_api.cclock_contents_view_test_api.hlock_contents_view_unittest.cclock_debug_view.cclock_debug_view.hlock_screen.cclock_screen.hlock_screen_media_view_unittest.cclock_screen_sanity_unittest.cclogin_data_dispatcher.cclogin_data_dispatcher.hlogin_test_base.ccmanagement_disclosure_dialog_unittest.ccnote_action_launch_button.ccnote_action_launch_button.h
metrics
public
root_window_controller.ccroot_window_controller.hshelf
shell.ccshell.htray_action
wm
chrome/browser
ash
ui
chromeos/ash/components/browser_context_helper
25
ash/BUILD.gn
25
ash/BUILD.gn
@ -880,20 +880,6 @@ component("ash") {
|
||||
"lobster/lobster_metrics_recorder.h",
|
||||
"lobster/lobster_session_impl.cc",
|
||||
"lobster/lobster_session_impl.h",
|
||||
"lock_screen_action/lock_screen_action_background_controller.cc",
|
||||
"lock_screen_action/lock_screen_action_background_controller.h",
|
||||
"lock_screen_action/lock_screen_action_background_controller_impl.cc",
|
||||
"lock_screen_action/lock_screen_action_background_controller_impl.h",
|
||||
"lock_screen_action/lock_screen_action_background_controller_stub.cc",
|
||||
"lock_screen_action/lock_screen_action_background_controller_stub.h",
|
||||
"lock_screen_action/lock_screen_action_background_observer.h",
|
||||
"lock_screen_action/lock_screen_action_background_state.h",
|
||||
"lock_screen_action/lock_screen_action_background_view.cc",
|
||||
"lock_screen_action/lock_screen_action_background_view.h",
|
||||
"lock_screen_action/lock_screen_note_display_state_handler.cc",
|
||||
"lock_screen_action/lock_screen_note_display_state_handler.h",
|
||||
"lock_screen_action/lock_screen_note_launcher.cc",
|
||||
"lock_screen_action/lock_screen_note_launcher.h",
|
||||
"login/login_screen_controller.cc",
|
||||
"login/login_screen_controller.h",
|
||||
"login/security_token_request_controller.cc",
|
||||
@ -993,8 +979,6 @@ component("ash") {
|
||||
"login/ui/management_disclosure_field_trial.h",
|
||||
"login/ui/non_accessible_view.cc",
|
||||
"login/ui/non_accessible_view.h",
|
||||
"login/ui/note_action_launch_button.cc",
|
||||
"login/ui/note_action_launch_button.h",
|
||||
"login/ui/pin_keyboard_animation.cc",
|
||||
"login/ui/pin_keyboard_animation.h",
|
||||
"login/ui/pin_request_view.cc",
|
||||
@ -2751,9 +2735,6 @@ component("ash") {
|
||||
"touch/touch_hud_renderer.h",
|
||||
"touch/touch_observer_hud.cc",
|
||||
"touch/touch_observer_hud.h",
|
||||
"tray_action/tray_action.cc",
|
||||
"tray_action/tray_action.h",
|
||||
"tray_action/tray_action_observer.h",
|
||||
"utility/arc_curve_path_util.cc",
|
||||
"utility/arc_curve_path_util.h",
|
||||
"utility/cropping_util.cc",
|
||||
@ -2992,8 +2973,6 @@ component("ash") {
|
||||
"wm/gestures/wm_gesture_handler.h",
|
||||
"wm/immersive_context_ash.cc",
|
||||
"wm/immersive_context_ash.h",
|
||||
"wm/lock_action_handler_layout_manager.cc",
|
||||
"wm/lock_action_handler_layout_manager.h",
|
||||
"wm/lock_layout_manager.cc",
|
||||
"wm/lock_layout_manager.h",
|
||||
"wm/lock_state_controller.cc",
|
||||
@ -5153,10 +5132,6 @@ static_library("test_support") {
|
||||
"in_session_auth/mock_in_session_auth_dialog_client.h",
|
||||
"keyboard/test_keyboard_ui.cc",
|
||||
"keyboard/test_keyboard_ui.h",
|
||||
"lock_screen_action/lock_screen_action_background_controller_impl_test_api.h",
|
||||
"lock_screen_action/lock_screen_action_background_view_test_api.h",
|
||||
"lock_screen_action/test_lock_screen_action_background_controller.cc",
|
||||
"lock_screen_action/test_lock_screen_action_background_controller.h",
|
||||
"login/login_screen_test_api.cc",
|
||||
"login/mock_login_screen_client.cc",
|
||||
"login/mock_login_screen_client.h",
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "ash/display/cros_display_config.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
@ -19,9 +18,4 @@ void BindCrosDisplayConfigController(
|
||||
Shell::Get()->cros_display_config()->BindReceiver(std::move(receiver));
|
||||
}
|
||||
|
||||
void BindTrayAction(mojo::PendingReceiver<mojom::TrayAction> receiver) {
|
||||
if (Shell::HasInstance())
|
||||
Shell::Get()->tray_action()->BindReceiver(std::move(receiver));
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -1,6 +0,0 @@
|
||||
monorail: {
|
||||
component: "UI>Shell>LockScreen"
|
||||
}
|
||||
buganizer_public: {
|
||||
component_id: 1457414
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller_impl.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller_stub.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_observer.h"
|
||||
#include "base/functional/callback.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
LockScreenActionBackgroundController::FactoryCallback*
|
||||
g_testing_factory_callback = nullptr;
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
std::unique_ptr<LockScreenActionBackgroundController>
|
||||
LockScreenActionBackgroundController::Create() {
|
||||
if (g_testing_factory_callback)
|
||||
return g_testing_factory_callback->Run();
|
||||
return std::make_unique<LockScreenActionBackgroundControllerImpl>();
|
||||
}
|
||||
|
||||
// static
|
||||
void LockScreenActionBackgroundController::SetFactoryCallbackForTesting(
|
||||
FactoryCallback* testing_factory_callback) {
|
||||
g_testing_factory_callback = testing_factory_callback;
|
||||
}
|
||||
|
||||
LockScreenActionBackgroundController::LockScreenActionBackgroundController() =
|
||||
default;
|
||||
|
||||
LockScreenActionBackgroundController::~LockScreenActionBackgroundController() {
|
||||
UpdateState(LockScreenActionBackgroundState::kHidden);
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundController::SetParentWindow(
|
||||
aura::Window* parent_window) {
|
||||
DCHECK(!parent_window_);
|
||||
parent_window_ = parent_window;
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundController::AddObserver(
|
||||
LockScreenActionBackgroundObserver* observer) {
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundController::RemoveObserver(
|
||||
LockScreenActionBackgroundObserver* observer) {
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundController::UpdateState(
|
||||
LockScreenActionBackgroundState state) {
|
||||
if (state_ == state)
|
||||
return;
|
||||
|
||||
state_ = state;
|
||||
|
||||
for (auto& observer : observers_)
|
||||
observer.OnLockScreenActionBackgroundStateChanged(state_);
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,99 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_state.h"
|
||||
#include "base/functional/callback_forward.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
|
||||
namespace aura {
|
||||
class Window;
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
class LockScreenActionBackgroundObserver;
|
||||
|
||||
// Base class for managing lock screen action background. The implementation
|
||||
// should provide methods for showing and hiding background when requested.
|
||||
// The base class keeps track of the background state, and notifies observers
|
||||
// when the state changes.
|
||||
class ASH_EXPORT LockScreenActionBackgroundController {
|
||||
public:
|
||||
// Creates a LockScreenActionBackgroundController instance.
|
||||
static std::unique_ptr<LockScreenActionBackgroundController> Create();
|
||||
|
||||
// Method that can be used in tests to change the controller returned by
|
||||
// |Create| in tests.
|
||||
// Note: this has to be called before root window controller is initialized
|
||||
// to have any effect.
|
||||
using FactoryCallback = base::RepeatingCallback<
|
||||
std::unique_ptr<LockScreenActionBackgroundController>()>;
|
||||
static void SetFactoryCallbackForTesting(
|
||||
FactoryCallback* testing_factory_callback);
|
||||
|
||||
LockScreenActionBackgroundController();
|
||||
|
||||
LockScreenActionBackgroundController(
|
||||
const LockScreenActionBackgroundController&) = delete;
|
||||
LockScreenActionBackgroundController& operator=(
|
||||
const LockScreenActionBackgroundController&) = delete;
|
||||
|
||||
virtual ~LockScreenActionBackgroundController();
|
||||
|
||||
// Sets the window the background widget should use as its parent.
|
||||
void SetParentWindow(aura::Window* parent_window);
|
||||
|
||||
void AddObserver(LockScreenActionBackgroundObserver* observer);
|
||||
void RemoveObserver(LockScreenActionBackgroundObserver* observer);
|
||||
|
||||
LockScreenActionBackgroundState state() const { return state_; }
|
||||
|
||||
// Returns whether |window| is a background widget window.
|
||||
virtual bool IsBackgroundWindow(aura::Window* window) const = 0;
|
||||
|
||||
// Starts showing background.
|
||||
//
|
||||
// Returns whether the background state has changed. On success, the state is
|
||||
// expected to change to either kShowing, or kShown.
|
||||
virtual bool ShowBackground() = 0;
|
||||
|
||||
// Hides background without an animation.
|
||||
//
|
||||
// Returns whether the background state has changed. On success the state is
|
||||
// expected to change to kHidden.
|
||||
virtual bool HideBackgroundImmediately() = 0;
|
||||
|
||||
// Starts hiding the background. Unlike |HideBackgroundImediatelly|, hiding
|
||||
// the background may be accompanied with an animation, in which case state
|
||||
// should be changed to kHiding.
|
||||
//
|
||||
// Returns whether the background state has changed. On success, the state is
|
||||
// expected to change to either kHiding or kHidden.
|
||||
virtual bool HideBackground() = 0;
|
||||
|
||||
protected:
|
||||
// Method the implementations should use to update the current background
|
||||
// state and notify observers of background state changes.
|
||||
void UpdateState(LockScreenActionBackgroundState state);
|
||||
|
||||
raw_ptr<aura::Window, DanglingUntriaged> parent_window_ = nullptr;
|
||||
|
||||
private:
|
||||
LockScreenActionBackgroundState state_ =
|
||||
LockScreenActionBackgroundState::kHidden;
|
||||
|
||||
base::ObserverList<LockScreenActionBackgroundObserver>::Unchecked observers_;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
|
@ -1,133 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller_impl.h"
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_view.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "ui/aura/window.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kLockScreenActionBackgroundWidgetName[] =
|
||||
"LockScreenActionBackground";
|
||||
|
||||
} // namespace
|
||||
|
||||
LockScreenActionBackgroundControllerImpl::
|
||||
LockScreenActionBackgroundControllerImpl() = default;
|
||||
|
||||
LockScreenActionBackgroundControllerImpl::
|
||||
~LockScreenActionBackgroundControllerImpl() {
|
||||
if (background_widget_ && !background_widget_->IsClosed())
|
||||
background_widget_->Close();
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundControllerImpl::IsBackgroundWindow(
|
||||
aura::Window* window) const {
|
||||
return window->GetName() == kLockScreenActionBackgroundWidgetName;
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundControllerImpl::ShowBackground() {
|
||||
if (state() == LockScreenActionBackgroundState::kShown ||
|
||||
state() == LockScreenActionBackgroundState::kShowing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parent_window_)
|
||||
return false;
|
||||
|
||||
if (!background_widget_)
|
||||
background_widget_ = CreateWidget();
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kShowing);
|
||||
|
||||
background_widget_->Show();
|
||||
|
||||
contents_view_->AnimateShow(base::BindOnce(
|
||||
&LockScreenActionBackgroundControllerImpl::OnBackgroundShown,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundControllerImpl::HideBackgroundImmediately() {
|
||||
if (state() == LockScreenActionBackgroundState::kHidden)
|
||||
return false;
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kHidden);
|
||||
|
||||
background_widget_->Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundControllerImpl::HideBackground() {
|
||||
if (state() == LockScreenActionBackgroundState::kHidden ||
|
||||
state() == LockScreenActionBackgroundState::kHiding) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DCHECK(background_widget_);
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kHiding);
|
||||
|
||||
contents_view_->AnimateHide(base::BindOnce(
|
||||
&LockScreenActionBackgroundControllerImpl::OnBackgroundHidden,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundControllerImpl::OnWidgetDestroyed(
|
||||
views::Widget* widget) {
|
||||
if (widget != background_widget_)
|
||||
return;
|
||||
DCHECK(widget_observation_.IsObservingSource(widget));
|
||||
widget_observation_.Reset();
|
||||
|
||||
background_widget_ = nullptr;
|
||||
contents_view_ = nullptr;
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kHidden);
|
||||
}
|
||||
|
||||
views::Widget* LockScreenActionBackgroundControllerImpl::CreateWidget() {
|
||||
// Passed to the widget as its delegate.
|
||||
contents_view_ = new LockScreenActionBackgroundView();
|
||||
|
||||
views::Widget::InitParams params(
|
||||
views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET,
|
||||
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
|
||||
params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent;
|
||||
params.name = kLockScreenActionBackgroundWidgetName;
|
||||
params.parent = parent_window_;
|
||||
params.delegate = contents_view_.get();
|
||||
|
||||
views::Widget* widget = new views::Widget();
|
||||
widget->Init(std::move(params));
|
||||
widget->SetVisibilityChangedAnimationsEnabled(false);
|
||||
widget_observation_.Observe(widget);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundControllerImpl::OnBackgroundShown() {
|
||||
if (state() != LockScreenActionBackgroundState::kShowing)
|
||||
return;
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kShown);
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundControllerImpl::OnBackgroundHidden() {
|
||||
if (state() != LockScreenActionBackgroundState::kHiding)
|
||||
return;
|
||||
|
||||
background_widget_->Hide();
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kHidden);
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,80 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_IMPL_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_IMPL_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/scoped_observation.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
|
||||
namespace aura {
|
||||
class Window;
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
class LockScreenActionBackgroundView;
|
||||
|
||||
// The LockScreenActionBackgroundController implementation that shows lock
|
||||
// screen action background as a non activable window that is shown/hidden with
|
||||
// an ink drop animation that covers the whole window contents in black from the
|
||||
// top right window corner.
|
||||
class ASH_EXPORT LockScreenActionBackgroundControllerImpl
|
||||
: public LockScreenActionBackgroundController,
|
||||
public views::WidgetObserver {
|
||||
public:
|
||||
LockScreenActionBackgroundControllerImpl();
|
||||
|
||||
LockScreenActionBackgroundControllerImpl(
|
||||
const LockScreenActionBackgroundControllerImpl&) = delete;
|
||||
LockScreenActionBackgroundControllerImpl& operator=(
|
||||
const LockScreenActionBackgroundControllerImpl&) = delete;
|
||||
|
||||
~LockScreenActionBackgroundControllerImpl() override;
|
||||
|
||||
// LockScreenActionBackgroundController:
|
||||
bool IsBackgroundWindow(aura::Window* window) const override;
|
||||
bool ShowBackground() override;
|
||||
bool HideBackgroundImmediately() override;
|
||||
bool HideBackground() override;
|
||||
|
||||
// views::WidgetObserver:
|
||||
void OnWidgetDestroyed(views::Widget* widget) override;
|
||||
|
||||
private:
|
||||
friend class LockScreenActionBackgroundControllerImplTestApi;
|
||||
|
||||
// Creates the widget to be used as the background widget.
|
||||
views::Widget* CreateWidget();
|
||||
|
||||
// Called when the background widget view is fully shown, i.e. when the ink
|
||||
// drop animation associated with showing the widget ends.
|
||||
void OnBackgroundShown();
|
||||
|
||||
// Called when the background widget view is fully hidden, i.e. when the ink
|
||||
// drop animation associated with hiding the widget ends.
|
||||
void OnBackgroundHidden();
|
||||
|
||||
// The background widget used (and created) by the controller to display the
|
||||
// lock screen action background.
|
||||
// The widget is owned by its native (aura) window - it will be deleted when
|
||||
// the window gets closed/destroyed.
|
||||
raw_ptr<views::Widget> background_widget_ = nullptr;
|
||||
raw_ptr<LockScreenActionBackgroundView> contents_view_ = nullptr;
|
||||
|
||||
base::ScopedObservation<views::Widget, views::WidgetObserver>
|
||||
widget_observation_{this};
|
||||
|
||||
base::WeakPtrFactory<LockScreenActionBackgroundControllerImpl>
|
||||
weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_IMPL_H_
|
@ -1,48 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_IMPL_TEST_API_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_IMPL_TEST_API_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller_impl.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
|
||||
namespace views {
|
||||
class Widget;
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
class LockScreenActionBackgroundControllerImpl;
|
||||
class LockScreenActionBackgroundView;
|
||||
|
||||
// Class that provides access to LockScreenActionBackgroundControllerImpl
|
||||
// implementation details in tests.
|
||||
class ASH_EXPORT LockScreenActionBackgroundControllerImplTestApi {
|
||||
public:
|
||||
explicit LockScreenActionBackgroundControllerImplTestApi(
|
||||
LockScreenActionBackgroundControllerImpl* controller)
|
||||
: controller_(controller) {}
|
||||
|
||||
LockScreenActionBackgroundControllerImplTestApi(
|
||||
const LockScreenActionBackgroundControllerImplTestApi&) = delete;
|
||||
LockScreenActionBackgroundControllerImplTestApi& operator=(
|
||||
const LockScreenActionBackgroundControllerImplTestApi&) = delete;
|
||||
|
||||
~LockScreenActionBackgroundControllerImplTestApi() = default;
|
||||
|
||||
views::Widget* GetWidget() { return controller_->background_widget_; }
|
||||
|
||||
LockScreenActionBackgroundView* GetContentsView() {
|
||||
return controller_->contents_view_;
|
||||
}
|
||||
|
||||
private:
|
||||
raw_ptr<LockScreenActionBackgroundControllerImpl> controller_;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_IMPL_TEST_API_H_
|
@ -1,32 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller_stub.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
LockScreenActionBackgroundControllerStub::
|
||||
LockScreenActionBackgroundControllerStub() = default;
|
||||
|
||||
LockScreenActionBackgroundControllerStub::
|
||||
~LockScreenActionBackgroundControllerStub() = default;
|
||||
|
||||
bool LockScreenActionBackgroundControllerStub::IsBackgroundWindow(
|
||||
aura::Window* window) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundControllerStub::ShowBackground() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundControllerStub::HideBackgroundImmediately() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundControllerStub::HideBackground() {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,38 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_STUB_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_STUB_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
// Stub lock screen action background controller - used when no background
|
||||
// is shown behind the lock screen action app window, as is the case when
|
||||
// --show-md-login flag is not set. The controller will forever remain in hidden
|
||||
// state.
|
||||
class ASH_EXPORT LockScreenActionBackgroundControllerStub
|
||||
: public LockScreenActionBackgroundController {
|
||||
public:
|
||||
LockScreenActionBackgroundControllerStub();
|
||||
|
||||
LockScreenActionBackgroundControllerStub(
|
||||
const LockScreenActionBackgroundControllerStub&) = delete;
|
||||
LockScreenActionBackgroundControllerStub& operator=(
|
||||
const LockScreenActionBackgroundControllerStub&) = delete;
|
||||
|
||||
~LockScreenActionBackgroundControllerStub() override;
|
||||
|
||||
// LockScreenActionBackgroundController:
|
||||
bool IsBackgroundWindow(aura::Window* window) const override;
|
||||
bool ShowBackground() override;
|
||||
bool HideBackgroundImmediately() override;
|
||||
bool HideBackground() override;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_STUB_H_
|
@ -1,27 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_OBSERVER_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_OBSERVER_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_state.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
// Used to observe the state of a lock screen action background.
|
||||
class ASH_EXPORT LockScreenActionBackgroundObserver {
|
||||
public:
|
||||
virtual ~LockScreenActionBackgroundObserver() {}
|
||||
|
||||
// Called when the state of the lock screen action background changes. For
|
||||
// example when the background starts showing (with animation), or a
|
||||
// background visibility animation ends.
|
||||
virtual void OnLockScreenActionBackgroundStateChanged(
|
||||
LockScreenActionBackgroundState state) = 0;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_OBSERVER_H_
|
@ -1,61 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_STATE_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_STATE_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
// The state of lock screen action background - the background is shown when a
|
||||
// lock screen action is activated. It's shown behind the action window and
|
||||
// its visibility changes can be animated.
|
||||
//
|
||||
// The main difference to TrayActionState is what drives the associated state
|
||||
// machines:
|
||||
// * TrayActionStates are controlled by Chrome (and describe the lock screen
|
||||
// app state). State changes are one-directional (i.e. they from Chrome to
|
||||
// ash).
|
||||
// * LockScreenActionBackgroundStates are controlled by ash (and describe the
|
||||
// state of the lock screen action background). Note that the background
|
||||
// state is ash specific - it's currently not exposed to Chrome in any way.
|
||||
enum class ASH_EXPORT LockScreenActionBackgroundState {
|
||||
// The background is not shown.
|
||||
kHidden,
|
||||
|
||||
// The background is visible, and it's "show" animation is in progress (the
|
||||
// background can have an animation that's activated as the background is
|
||||
// shown). The background will remain in kShowing state until the animation
|
||||
// ends.
|
||||
// This state is related to TrayActionState::kLaunching in sense that the
|
||||
// background is expected to be shown when the note taking app is launched
|
||||
// (which is when the note action state changes to kLaunching). Though, the
|
||||
// note action can transition to kActive state (which is when the note taking
|
||||
// app window is created) both before and after background transitions to
|
||||
// kShown state.
|
||||
// Note that the background is expected to be in kShowing state only when
|
||||
// lock screen note action is either launching or active.
|
||||
kShowing,
|
||||
|
||||
// The background is shown, and the animation associate with showing the
|
||||
// background has ended.
|
||||
// Note that the background is expected to be in kShown state only when
|
||||
// lock screen note action is either launching or active.
|
||||
kShown,
|
||||
|
||||
// The background is being hidden. The background can have an animation that
|
||||
// is activates upon request to hide the background. The background will
|
||||
// remain visible, in kHiding state, until the "hide" animation ends.
|
||||
// This state is related to lock screen note action states in sense that the
|
||||
// background starts hiding when the lock screen note action state changes
|
||||
// from kActive or kLaunching state to kAvailable (i.e. inactive state). The
|
||||
// background is expected to be in kHiding state only if the lock screen note
|
||||
// action is in kAvailable state.
|
||||
kHiding
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_STATE_H_
|
@ -1,139 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_view.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
|
||||
#include "ui/views/animation/ink_drop.h"
|
||||
#include "ui/views/animation/ink_drop_host.h"
|
||||
#include "ui/views/animation/ink_drop_impl.h"
|
||||
#include "ui/views/animation/ink_drop_ripple.h"
|
||||
#include "ui/views/animation/ink_drop_state.h"
|
||||
#include "ui/views/animation/square_ink_drop_ripple.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
class LockScreenActionBackgroundView::NoteBackground : public views::View {
|
||||
METADATA_HEADER(NoteBackground, views::View)
|
||||
|
||||
public:
|
||||
explicit NoteBackground(views::InkDropObserver* observer)
|
||||
: observer_(observer) {
|
||||
DCHECK(observer);
|
||||
views::InkDrop::Install(this, std::make_unique<views::InkDropHost>(this));
|
||||
views::InkDrop::Get(this)->SetMode(
|
||||
views::InkDropHost::InkDropMode::ON_NO_GESTURE_HANDLER);
|
||||
views::InkDrop::Get(this)->SetCreateInkDropCallback(base::BindRepeating(
|
||||
[](NoteBackground* host) {
|
||||
std::unique_ptr<views::InkDrop> ink_drop =
|
||||
views::InkDrop::CreateInkDropWithoutAutoHighlight(
|
||||
views::InkDrop::Get(host), /*highlight_on_hover=*/false);
|
||||
ink_drop->AddObserver(host->observer_);
|
||||
return ink_drop;
|
||||
},
|
||||
this));
|
||||
views::InkDrop::Get(this)->SetCreateRippleCallback(base::BindRepeating(
|
||||
[](NoteBackground* host) -> std::unique_ptr<views::InkDropRipple> {
|
||||
const gfx::Point center = base::i18n::IsRTL()
|
||||
? host->GetLocalBounds().origin()
|
||||
: host->GetLocalBounds().top_right();
|
||||
auto ink_drop_ripple =
|
||||
std::make_unique<views::FloodFillInkDropRipple>(
|
||||
views::InkDrop::Get(host), host->size(), gfx::Insets(),
|
||||
center, views::InkDrop::Get(host)->GetBaseColor(), 1);
|
||||
ink_drop_ripple->set_use_hide_transform_duration_for_hide_fade_out(
|
||||
true);
|
||||
ink_drop_ripple->set_duration_factor(1.5);
|
||||
return ink_drop_ripple;
|
||||
},
|
||||
this));
|
||||
views::InkDrop::Get(this)->SetBaseColor(SK_ColorBLACK);
|
||||
}
|
||||
|
||||
NoteBackground(const NoteBackground&) = delete;
|
||||
NoteBackground& operator=(const NoteBackground&) = delete;
|
||||
|
||||
~NoteBackground() override = default;
|
||||
|
||||
private:
|
||||
raw_ptr<views::InkDropObserver> observer_;
|
||||
};
|
||||
|
||||
BEGIN_METADATA(LockScreenActionBackgroundView, NoteBackground)
|
||||
END_METADATA
|
||||
|
||||
LockScreenActionBackgroundView::LockScreenActionBackgroundView() {
|
||||
SetCanMaximize(true);
|
||||
SetCanFullscreen(true);
|
||||
|
||||
auto layout_manager = std::make_unique<views::BoxLayout>(
|
||||
views::BoxLayout::Orientation::kVertical);
|
||||
layout_manager->set_cross_axis_alignment(
|
||||
views::BoxLayout::CrossAxisAlignment::kStretch);
|
||||
auto* layout_ptr = SetLayoutManager(std::move(layout_manager));
|
||||
|
||||
background_ = new NoteBackground(this);
|
||||
AddChildView(background_.get());
|
||||
// Make background view flexible - the constant does not really matter given
|
||||
// that |background_| is the only child, as long as it's greater than 0.
|
||||
layout_ptr->SetFlexForView(background_, 1 /*flex_weight*/);
|
||||
}
|
||||
|
||||
LockScreenActionBackgroundView::~LockScreenActionBackgroundView() = default;
|
||||
|
||||
void LockScreenActionBackgroundView::AnimateShow(base::OnceClosure done) {
|
||||
animation_end_callback_ = std::move(done);
|
||||
animating_to_state_ = views::InkDropState::ACTIVATED;
|
||||
|
||||
views::InkDrop::Get(background_)
|
||||
->AnimateToState(views::InkDropState::ACTIVATED, nullptr);
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundView::AnimateHide(base::OnceClosure done) {
|
||||
animation_end_callback_ = std::move(done);
|
||||
animating_to_state_ = views::InkDropState::HIDDEN;
|
||||
|
||||
views::InkDrop::Get(background_)
|
||||
->AnimateToState(views::InkDropState::HIDDEN, nullptr);
|
||||
}
|
||||
|
||||
void LockScreenActionBackgroundView::InkDropAnimationStarted() {}
|
||||
|
||||
void LockScreenActionBackgroundView::InkDropRippleAnimationEnded(
|
||||
views::InkDropState state) {
|
||||
// In case |AnimateShow| or |AnimateHide| is called before previous state
|
||||
// animation ends, this might get called with the previous target state
|
||||
// as the animation is aborted - ignore the event if the |state| does not
|
||||
// match the current target state.
|
||||
if (animation_end_callback_.is_null() || state != animating_to_state_)
|
||||
return;
|
||||
|
||||
std::move(animation_end_callback_).Run();
|
||||
}
|
||||
|
||||
bool LockScreenActionBackgroundView::CanActivate() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
views::View* LockScreenActionBackgroundView::GetBackgroundView() {
|
||||
return background_;
|
||||
}
|
||||
|
||||
BEGIN_METADATA(LockScreenActionBackgroundView)
|
||||
END_METADATA
|
||||
|
||||
} // namespace ash
|
@ -1,68 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_VIEW_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_VIEW_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "base/functional/callback_forward.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/views/animation/ink_drop_observer.h"
|
||||
#include "ui/views/animation/ink_drop_state.h"
|
||||
#include "ui/views/widget/widget_delegate.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
// Widget delegate view that implements the contents of the lock action
|
||||
// background widget.
|
||||
// The widget hosts a view that contains a transparent view with a black ink
|
||||
// drop. The view implementation provides methods to activate or hide the ink
|
||||
// drop in the view.
|
||||
class ASH_EXPORT LockScreenActionBackgroundView
|
||||
: public views::WidgetDelegateView,
|
||||
public views::InkDropObserver {
|
||||
METADATA_HEADER(LockScreenActionBackgroundView, views::WidgetDelegateView)
|
||||
|
||||
public:
|
||||
LockScreenActionBackgroundView();
|
||||
|
||||
LockScreenActionBackgroundView(const LockScreenActionBackgroundView&) =
|
||||
delete;
|
||||
LockScreenActionBackgroundView& operator=(
|
||||
const LockScreenActionBackgroundView&) = delete;
|
||||
|
||||
~LockScreenActionBackgroundView() override;
|
||||
|
||||
// Request the ink drop to be activated.
|
||||
// |done| - called when the ink drop animation ends.
|
||||
void AnimateShow(base::OnceClosure done);
|
||||
|
||||
// Requests the ink drop to be hidden.
|
||||
// |done| - called when the ink drop animation ends.
|
||||
void AnimateHide(base::OnceClosure done);
|
||||
|
||||
// views::InkDropListener:
|
||||
void InkDropAnimationStarted() override;
|
||||
void InkDropRippleAnimationEnded(views::InkDropState state) override;
|
||||
|
||||
// views::WidgetDelegateView:
|
||||
bool CanActivate() const override;
|
||||
|
||||
private:
|
||||
friend class LockScreenActionBackgroundViewTestApi;
|
||||
class NoteBackground;
|
||||
|
||||
// Gets background_ as a views::View*.
|
||||
views::View* GetBackgroundView();
|
||||
|
||||
base::OnceClosure animation_end_callback_;
|
||||
views::InkDropState animating_to_state_;
|
||||
|
||||
raw_ptr<NoteBackground> background_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_VIEW_H_
|
@ -1,45 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_VIEW_TEST_API_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_VIEW_TEST_API_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_view.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
|
||||
namespace views {
|
||||
class View;
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
class LockScreenActionBackgroundView;
|
||||
|
||||
// Class that provides access to LockScreenActionBackgroundView implementation
|
||||
// details in tests.
|
||||
class ASH_EXPORT LockScreenActionBackgroundViewTestApi {
|
||||
public:
|
||||
explicit LockScreenActionBackgroundViewTestApi(
|
||||
LockScreenActionBackgroundView* action_background_view)
|
||||
: action_background_view_(action_background_view) {}
|
||||
|
||||
LockScreenActionBackgroundViewTestApi(
|
||||
const LockScreenActionBackgroundViewTestApi&) = delete;
|
||||
LockScreenActionBackgroundViewTestApi& operator=(
|
||||
const LockScreenActionBackgroundViewTestApi&) = delete;
|
||||
|
||||
~LockScreenActionBackgroundViewTestApi() = default;
|
||||
|
||||
views::View* GetBackground() {
|
||||
return action_background_view_->GetBackgroundView();
|
||||
}
|
||||
|
||||
private:
|
||||
raw_ptr<LockScreenActionBackgroundView> action_background_view_;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_ACTION_BACKGROUND_VIEW_TEST_API_H_
|
@ -1,140 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_note_display_state_handler.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_note_launcher.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/system/power/scoped_backlights_forced_off.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/location.h"
|
||||
#include "base/time/time.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
// The max amount of time display state change handling can be delayed due to a
|
||||
// lock screen note action launch. The time starts running when the app launch
|
||||
// is requested.
|
||||
constexpr base::TimeDelta kNoteLaunchTimeout = base::Milliseconds(1500);
|
||||
|
||||
} // namespace
|
||||
|
||||
LockScreenNoteDisplayStateHandler::LockScreenNoteDisplayStateHandler(
|
||||
BacklightsForcedOffSetter* backlights_forced_off_setter)
|
||||
: backlights_forced_off_setter_(backlights_forced_off_setter),
|
||||
backlights_forced_off_observation_(this) {
|
||||
backlights_forced_off_observation_.Observe(
|
||||
backlights_forced_off_setter_.get());
|
||||
}
|
||||
|
||||
LockScreenNoteDisplayStateHandler::~LockScreenNoteDisplayStateHandler() =
|
||||
default;
|
||||
|
||||
void LockScreenNoteDisplayStateHandler::OnBacklightsForcedOffChanged(
|
||||
bool backlights_forced_off) {
|
||||
// Close lock screen note when backlights are forced off - unless the
|
||||
// backlights are forced off by this as part of note app launch.
|
||||
if (backlights_forced_off && !backlights_forced_off_) {
|
||||
Shell::Get()->tray_action()->CloseLockScreenNote(
|
||||
mojom::CloseLockScreenNoteReason::kScreenDimmed);
|
||||
}
|
||||
}
|
||||
|
||||
void LockScreenNoteDisplayStateHandler::OnScreenBacklightStateChanged(
|
||||
ScreenBacklightState screen_backlight_state) {
|
||||
if (screen_backlight_state != ScreenBacklightState::ON &&
|
||||
note_launch_delayed_until_screen_off_) {
|
||||
RunLockScreenNoteLauncher();
|
||||
}
|
||||
}
|
||||
|
||||
void LockScreenNoteDisplayStateHandler::AttemptNoteLaunchForStylusEject() {
|
||||
if (!LockScreenNoteLauncher::CanAttemptLaunch() ||
|
||||
NoteLaunchInProgressOrDelayed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!backlights_forced_off_ && ShouldForceBacklightsOffForNoteLaunch()) {
|
||||
backlights_forced_off_ =
|
||||
backlights_forced_off_setter_->ForceBacklightsOff();
|
||||
}
|
||||
|
||||
DCHECK(!launch_timer_.IsRunning());
|
||||
launch_timer_.Start(
|
||||
FROM_HERE, kNoteLaunchTimeout,
|
||||
base::BindOnce(&LockScreenNoteDisplayStateHandler::NoteLaunchDone,
|
||||
weak_ptr_factory_.GetWeakPtr(), false));
|
||||
|
||||
// Delay note launch if backlights are forced off, but the screen hasn't
|
||||
// been turned off yet - the note should be launched when the pending
|
||||
// backlights state is finished (i.e. the screen is turned off).
|
||||
if (backlights_forced_off_setter_->backlights_forced_off() &&
|
||||
backlights_forced_off_setter_->GetScreenBacklightState() ==
|
||||
ScreenBacklightState::ON) {
|
||||
note_launch_delayed_until_screen_off_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
RunLockScreenNoteLauncher();
|
||||
}
|
||||
|
||||
void LockScreenNoteDisplayStateHandler::Reset() {
|
||||
note_launch_delayed_until_screen_off_ = false;
|
||||
backlights_forced_off_.reset();
|
||||
lock_screen_note_launcher_.reset();
|
||||
launch_timer_.Stop();
|
||||
}
|
||||
|
||||
void LockScreenNoteDisplayStateHandler::RunLockScreenNoteLauncher() {
|
||||
DCHECK(!lock_screen_note_launcher_);
|
||||
if (!LockScreenNoteLauncher::CanAttemptLaunch()) {
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
note_launch_delayed_until_screen_off_ = false;
|
||||
|
||||
lock_screen_note_launcher_ = std::make_unique<LockScreenNoteLauncher>();
|
||||
lock_screen_note_launcher_->Run(
|
||||
mojom::LockScreenNoteOrigin::kStylusEject,
|
||||
base::BindOnce(&LockScreenNoteDisplayStateHandler::NoteLaunchDone,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
bool LockScreenNoteDisplayStateHandler::ShouldForceBacklightsOffForNoteLaunch()
|
||||
const {
|
||||
// Backlights should be kept off during app launch if the display has been
|
||||
// turned off without user interaction (e.g. due to user inactivity), or if
|
||||
// the backlights are currently being forced off - the goal is to avoid flash
|
||||
// of lock screen UI if the display gets turned on before lock screen app
|
||||
// window is shown.
|
||||
// There is no need to force the backlight off if the display has been turned
|
||||
// off due to user action - in this case display brightness will not change
|
||||
// when backlights stop being forced off (due to stylus eject) - the
|
||||
// brightness will remain at user selected level, so the lock screen UI will
|
||||
// not actually become visible.
|
||||
//
|
||||
// Note that backlights_forced_off_setter_ check is required as there is a
|
||||
// delay between request to force backlights off and screen state getting
|
||||
// updated due to that request.
|
||||
return backlights_forced_off_setter_->backlights_forced_off() ||
|
||||
backlights_forced_off_setter_->GetScreenBacklightState() ==
|
||||
ScreenBacklightState::OFF_AUTO;
|
||||
}
|
||||
|
||||
bool LockScreenNoteDisplayStateHandler::NoteLaunchInProgressOrDelayed() const {
|
||||
return note_launch_delayed_until_screen_off_ || lock_screen_note_launcher_;
|
||||
}
|
||||
|
||||
void LockScreenNoteDisplayStateHandler::NoteLaunchDone(bool success) {
|
||||
Reset();
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,100 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_NOTE_DISPLAY_STATE_HANDLER_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_NOTE_DISPLAY_STATE_HANDLER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ash/public/cpp/screen_backlight_observer.h"
|
||||
#include "ash/system/power/backlights_forced_off_setter.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/scoped_observation.h"
|
||||
#include "base/timer/timer.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
class LockScreenNoteLauncher;
|
||||
class ScopedBacklightsForcedOff;
|
||||
|
||||
// Handles display state changes related to lock screen note state.
|
||||
// For example it will close any active lock screen notes if the display is
|
||||
// forced off.
|
||||
// This class also handles a lock screen note launch when stylus is ejected.
|
||||
// When the note is launched while the screen is off, note launch forces the
|
||||
// display off, in order to delay screen being turned on (which happens, among
|
||||
// other things, when the stylus gets ejected) until the lock screen note is
|
||||
// visible. This is to prevent a flash of the lock screen UI as the lock screen
|
||||
// note app window is being shown.
|
||||
class LockScreenNoteDisplayStateHandler : public ScreenBacklightObserver {
|
||||
public:
|
||||
explicit LockScreenNoteDisplayStateHandler(
|
||||
BacklightsForcedOffSetter* backlights_forced_off_setter);
|
||||
|
||||
LockScreenNoteDisplayStateHandler(const LockScreenNoteDisplayStateHandler&) =
|
||||
delete;
|
||||
LockScreenNoteDisplayStateHandler& operator=(
|
||||
const LockScreenNoteDisplayStateHandler&) = delete;
|
||||
|
||||
~LockScreenNoteDisplayStateHandler() override;
|
||||
|
||||
base::OneShotTimer* launch_timer_for_test() { return &launch_timer_; }
|
||||
|
||||
// ScreenBacklightObserver:
|
||||
void OnBacklightsForcedOffChanged(bool backlights_forced_off) override;
|
||||
void OnScreenBacklightStateChanged(
|
||||
ScreenBacklightState screen_backlight_state) override;
|
||||
|
||||
// If lock screen note action is available, it requests a new lock screen note
|
||||
// with launch reason set to stylus eject.
|
||||
void AttemptNoteLaunchForStylusEject();
|
||||
|
||||
// Resets the internal state, cancelling any in progress launch.
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
// Runs lock screen note launcher, which starts lock screen app launch.
|
||||
void RunLockScreenNoteLauncher();
|
||||
|
||||
// Whether the backlights should be forced off during lock screen note
|
||||
// launch.
|
||||
bool ShouldForceBacklightsOffForNoteLaunch() const;
|
||||
|
||||
// Whether a lock screen note is currently being launched by |this|.
|
||||
bool NoteLaunchInProgressOrDelayed() const;
|
||||
|
||||
// Called by |lock_screen_note_launcher_| when lock screen note launch is
|
||||
// done.
|
||||
void NoteLaunchDone(bool success);
|
||||
|
||||
// Object used to force the backlights off.
|
||||
const raw_ptr<BacklightsForcedOffSetter> backlights_forced_off_setter_;
|
||||
|
||||
// Whether lock screen note launch is delayed until the screen is reported to
|
||||
// be off - this is used if lock screen note launch is requested when
|
||||
// backlights have been forced off, but the power manager still reports screen
|
||||
// to be on.
|
||||
bool note_launch_delayed_until_screen_off_ = false;
|
||||
|
||||
std::unique_ptr<LockScreenNoteLauncher> lock_screen_note_launcher_;
|
||||
|
||||
// Scoped backlights forced off request - this is returned by
|
||||
// |backlights_forced_off_setter_->ForceBacklightsOff()|, and will keep the
|
||||
// backlights in forced-off state until they are reset.
|
||||
std::unique_ptr<ScopedBacklightsForcedOff> backlights_forced_off_;
|
||||
|
||||
// Timer used to set up timeout for lock screen note launch.
|
||||
base::OneShotTimer launch_timer_;
|
||||
|
||||
base::ScopedObservation<BacklightsForcedOffSetter, ScreenBacklightObserver>
|
||||
backlights_forced_off_observation_;
|
||||
|
||||
base::WeakPtrFactory<LockScreenNoteDisplayStateHandler> weak_ptr_factory_{
|
||||
this};
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_NOTE_DISPLAY_STATE_HANDLER_H_
|
@ -1,50 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_note_launcher.h"
|
||||
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "ash/shell.h"
|
||||
#include "base/functional/bind.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
LockScreenNoteLauncher::LockScreenNoteLauncher() = default;
|
||||
LockScreenNoteLauncher::~LockScreenNoteLauncher() = default;
|
||||
|
||||
// static
|
||||
bool LockScreenNoteLauncher::CanAttemptLaunch() {
|
||||
return Shell::Get()->tray_action()->GetLockScreenNoteState() ==
|
||||
mojom::TrayActionState::kAvailable;
|
||||
}
|
||||
|
||||
bool LockScreenNoteLauncher::Run(mojom::LockScreenNoteOrigin action_origin,
|
||||
LaunchCallback callback) {
|
||||
DCHECK(callback_.is_null());
|
||||
|
||||
if (!CanAttemptLaunch())
|
||||
return false;
|
||||
|
||||
callback_ = std::move(callback);
|
||||
tray_action_observation_.Observe(Shell::Get()->tray_action());
|
||||
|
||||
Shell::Get()->tray_action()->RequestNewLockScreenNote(action_origin);
|
||||
return true;
|
||||
}
|
||||
|
||||
void LockScreenNoteLauncher::OnLockScreenNoteStateChanged(
|
||||
mojom::TrayActionState state) {
|
||||
if (state == mojom::TrayActionState::kLaunching)
|
||||
return;
|
||||
|
||||
OnLaunchDone(state == mojom::TrayActionState::kActive);
|
||||
}
|
||||
|
||||
void LockScreenNoteLauncher::OnLaunchDone(bool success) {
|
||||
tray_action_observation_.Reset();
|
||||
if (!callback_.is_null())
|
||||
std::move(callback_).Run(success);
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,60 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_NOTE_LAUNCHER_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_NOTE_LAUNCHER_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/tray_action/tray_action_observer.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/scoped_observation.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
// A helper class for requesting a lock screen app that provides a callback run
|
||||
// when the action launch process finishes (both successfuly or with a failure).
|
||||
class ASH_EXPORT LockScreenNoteLauncher : public TrayActionObserver {
|
||||
public:
|
||||
using LaunchCallback = base::OnceCallback<void(bool success)>;
|
||||
|
||||
LockScreenNoteLauncher();
|
||||
|
||||
LockScreenNoteLauncher(const LockScreenNoteLauncher&) = delete;
|
||||
LockScreenNoteLauncher& operator=(const LockScreenNoteLauncher&) = delete;
|
||||
|
||||
~LockScreenNoteLauncher() override;
|
||||
|
||||
// Whether the lock screen note state indicates that a note action launch can
|
||||
// be requested - note that |Run| will not succeed if this returns false.
|
||||
static bool CanAttemptLaunch();
|
||||
|
||||
// Requests a lock screen note launch, and starts observing lock screen note
|
||||
// state changes - when the state changes to a non-launching state (either
|
||||
// kActive - indicating launch success, or kAvailable or kNotAvailable -
|
||||
// indicating launch failure), it runs |callback|.
|
||||
// This can handle only one launch requests at a time - i.e. it should not be
|
||||
// called again before |callback| is run.
|
||||
// Returns whether the note launch was successfully requested. |callback| will
|
||||
// not be called if the return value is false.
|
||||
bool Run(mojom::LockScreenNoteOrigin action_origin, LaunchCallback callback);
|
||||
|
||||
// TrayActionObserver:
|
||||
void OnLockScreenNoteStateChanged(mojom::TrayActionState state) override;
|
||||
|
||||
private:
|
||||
// Called when the launch attempt completes - resets the object state and runs
|
||||
// the launch callback provided to |Run|.
|
||||
void OnLaunchDone(bool success);
|
||||
|
||||
// The callback provided to |Run|.
|
||||
LaunchCallback callback_;
|
||||
|
||||
base::ScopedObservation<TrayAction, TrayActionObserver>
|
||||
tray_action_observation_{this};
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_LOCK_SCREEN_NOTE_LAUNCHER_H_
|
@ -1,104 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/lock_screen_action/test_lock_screen_action_background_controller.h"
|
||||
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/widget/widget_delegate.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
const char kTestingWidgetName[] = "TestingLockScreenActionBackgroundWidget";
|
||||
|
||||
} // namespace
|
||||
|
||||
TestLockScreenActionBackgroundController::
|
||||
TestLockScreenActionBackgroundController() = default;
|
||||
|
||||
TestLockScreenActionBackgroundController::
|
||||
~TestLockScreenActionBackgroundController() = default;
|
||||
|
||||
bool TestLockScreenActionBackgroundController::IsBackgroundWindow(
|
||||
aura::Window* window) const {
|
||||
// Cannot check compare |window| to |widget_| window because this might get
|
||||
// called before |widget_|'s native window is set (while the window is being
|
||||
// added to the layout manager). Test the window name instead.
|
||||
return window->GetName() == kTestingWidgetName;
|
||||
}
|
||||
|
||||
bool TestLockScreenActionBackgroundController::ShowBackground() {
|
||||
if (state() == LockScreenActionBackgroundState::kShowing ||
|
||||
state() == LockScreenActionBackgroundState::kShown) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!widget_) {
|
||||
widget_ = std::make_unique<views::Widget>();
|
||||
|
||||
views::Widget::InitParams params(
|
||||
views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET,
|
||||
views::Widget::InitParams::TYPE_WINDOW);
|
||||
params.name = kTestingWidgetName;
|
||||
params.parent = parent_window_;
|
||||
params.delegate = new views::WidgetDelegate();
|
||||
params.delegate->SetCanActivate(false);
|
||||
params.delegate->SetCanMaximize(true);
|
||||
params.delegate->SetCanFullscreen(true);
|
||||
params.delegate->SetCanResize(true);
|
||||
params.delegate->SetOwnedByWidget(true);
|
||||
params.delegate->SetFocusTraversesOut(true);
|
||||
|
||||
widget_->Init(std::move(params));
|
||||
}
|
||||
|
||||
widget_->Show();
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kShowing);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestLockScreenActionBackgroundController::HideBackgroundImmediately() {
|
||||
if (state() == LockScreenActionBackgroundState::kHidden)
|
||||
return false;
|
||||
|
||||
widget_->Hide();
|
||||
UpdateState(LockScreenActionBackgroundState::kHidden);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestLockScreenActionBackgroundController::HideBackground() {
|
||||
if (state() == LockScreenActionBackgroundState::kHiding ||
|
||||
state() == LockScreenActionBackgroundState::kHidden) {
|
||||
return false;
|
||||
}
|
||||
|
||||
UpdateState(LockScreenActionBackgroundState::kHiding);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestLockScreenActionBackgroundController::FinishShow() {
|
||||
if (state() != LockScreenActionBackgroundState::kShowing)
|
||||
return false;
|
||||
UpdateState(LockScreenActionBackgroundState::kShown);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestLockScreenActionBackgroundController::FinishHide() {
|
||||
if (state() != LockScreenActionBackgroundState::kHiding)
|
||||
return false;
|
||||
widget_->Hide();
|
||||
UpdateState(LockScreenActionBackgroundState::kHidden);
|
||||
return true;
|
||||
}
|
||||
|
||||
aura::Window* TestLockScreenActionBackgroundController::GetWindow() const {
|
||||
if (!widget_)
|
||||
return nullptr;
|
||||
return widget_->GetNativeWindow();
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,65 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOCK_SCREEN_ACTION_TEST_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
|
||||
#define ASH_LOCK_SCREEN_ACTION_TEST_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
|
||||
namespace aura {
|
||||
class Window;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
class Widget;
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
// Testing implementation of LockScreenActionBackgroundController.
|
||||
// This implementation uses a window (if created at all) that does not animate
|
||||
// visibility. When |ShowBackground| and |HideBackground| methods are called,
|
||||
// the controller will transition to kShowing and kHiding states. The tests
|
||||
// should use |FinishShow| and |FinishHide| to complete visibility transitions.
|
||||
class ASH_EXPORT TestLockScreenActionBackgroundController
|
||||
: public LockScreenActionBackgroundController {
|
||||
public:
|
||||
TestLockScreenActionBackgroundController();
|
||||
|
||||
TestLockScreenActionBackgroundController(
|
||||
const TestLockScreenActionBackgroundController&) = delete;
|
||||
TestLockScreenActionBackgroundController& operator=(
|
||||
const TestLockScreenActionBackgroundController&) = delete;
|
||||
|
||||
~TestLockScreenActionBackgroundController() override;
|
||||
|
||||
// LockScreenBackgroundController:
|
||||
bool IsBackgroundWindow(aura::Window* window) const override;
|
||||
bool ShowBackground() override;
|
||||
bool HideBackgroundImmediately() override;
|
||||
bool HideBackground() override;
|
||||
|
||||
// If the controller is in kShowing state, updates state to kShown.
|
||||
// Returns whether the state has changed.
|
||||
bool FinishShow();
|
||||
|
||||
// If the controller is in kHiding state, updates state to kHidden, and hides
|
||||
// testing window is a window was created.
|
||||
// Returns whether the state has changed.
|
||||
bool FinishHide();
|
||||
|
||||
// Gets the testing window, if one was created.
|
||||
aura::Window* GetWindow() const;
|
||||
|
||||
private:
|
||||
// Testing widget created when the background is shown.
|
||||
std::unique_ptr<views::Widget> widget_;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOCK_SCREEN_ACTION_TEST_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
|
@ -233,13 +233,6 @@ void LoginScreenController::OnMaxIncorrectPasswordAttempted(
|
||||
client_->OnMaxIncorrectPasswordAttempted(account_id);
|
||||
}
|
||||
|
||||
void LoginScreenController::FocusLockScreenApps(bool reverse) {
|
||||
if (!client_) {
|
||||
return;
|
||||
}
|
||||
client_->FocusLockScreenApps(reverse);
|
||||
}
|
||||
|
||||
void LoginScreenController::ShowGaiaSignin(const AccountId& prefilled_account) {
|
||||
if (!client_) {
|
||||
return;
|
||||
|
@ -80,7 +80,6 @@ class ASH_EXPORT LoginScreenController : public LoginScreen,
|
||||
void CancelAddUser();
|
||||
void ShowGuestTosScreen();
|
||||
void OnMaxIncorrectPasswordAttempted(const AccountId& account_id);
|
||||
void FocusLockScreenApps(bool reverse);
|
||||
void ShowGaiaSignin(const AccountId& prefilled_account);
|
||||
void StartUserRecovery(const AccountId& account_to_recover);
|
||||
void ShowOsInstallScreen();
|
||||
|
@ -82,7 +82,6 @@ class MockLoginScreenClient : public LoginScreenClient {
|
||||
OnMaxIncorrectPasswordAttempted,
|
||||
(const AccountId& account_id),
|
||||
(override));
|
||||
MOCK_METHOD(void, FocusLockScreenApps, (bool reverse), (override));
|
||||
MOCK_METHOD(void,
|
||||
ShowGaiaSignin,
|
||||
(const AccountId& prefilled_account),
|
||||
|
@ -74,6 +74,5 @@ void TestLoginScreenModel::SetPublicSessionKeyboardLayouts(
|
||||
const std::vector<ash::InputMethodItem>& keyboard_layouts) {}
|
||||
void TestLoginScreenModel::SetPublicSessionShowFullManagementDisclosure(
|
||||
bool show_full_management_disclosure) {}
|
||||
void TestLoginScreenModel::HandleFocusLeavingLockScreenApps(bool reverse) {}
|
||||
void TestLoginScreenModel::NotifyOobeDialogState(ash::OobeDialogState state) {}
|
||||
void TestLoginScreenModel::NotifyFocusPod(const AccountId& account_id) {}
|
||||
|
@ -74,7 +74,6 @@ class ASH_EXPORT TestLoginScreenModel : public ash::LoginScreenModel {
|
||||
const std::vector<ash::InputMethodItem>& keyboard_layouts) override;
|
||||
void SetPublicSessionShowFullManagementDisclosure(
|
||||
bool show_full_management_disclosure) override;
|
||||
void HandleFocusLeavingLockScreenApps(bool reverse) override;
|
||||
void NotifyOobeDialogState(ash::OobeDialogState state) override;
|
||||
void NotifyFocusPod(const AccountId& account_id) override;
|
||||
};
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "ash/login/ui/login_public_account_user_view.h"
|
||||
#include "ash/login/ui/login_user_view.h"
|
||||
#include "ash/login/ui/non_accessible_view.h"
|
||||
#include "ash/login/ui/note_action_launch_button.h"
|
||||
#include "ash/login/ui/scrollable_users_list_view.h"
|
||||
#include "ash/login/ui/views_utils.h"
|
||||
#include "ash/media/media_controller_impl.h"
|
||||
@ -359,12 +358,9 @@ class LockContentsView::LockContentsViewLayout : public views::LayoutManager {
|
||||
// Triggered when the children of the top header change contents or
|
||||
// visibility.
|
||||
void LayoutTopHeader() {
|
||||
const int preferred_width =
|
||||
host_->system_info_->GetPreferredSize().width() +
|
||||
host_->note_action_->GetPreferredSize().width();
|
||||
const int preferred_width = host_->system_info_->GetPreferredSize().width();
|
||||
const int preferred_height =
|
||||
std::max(host_->system_info_->GetPreferredSize().height(),
|
||||
host_->note_action_->GetPreferredSize().height());
|
||||
host_->system_info_->GetPreferredSize().height();
|
||||
// Position the top header - the origin is offset to the left from the top
|
||||
// right corner of the entire view by the width of this top header view.
|
||||
const gfx::Point position =
|
||||
@ -433,7 +429,6 @@ class LockContentsView::LockContentsViewLayout : public views::LayoutManager {
|
||||
};
|
||||
|
||||
LockContentsView::LockContentsView(
|
||||
mojom::TrayActionState initial_note_action_state,
|
||||
LockScreen::ScreenType screen_type,
|
||||
LoginDataDispatcher* data_dispatcher,
|
||||
std::unique_ptr<LoginDetachableBaseModel> detachable_base_model)
|
||||
@ -493,9 +488,6 @@ LockContentsView::LockContentsView(
|
||||
ShowEnterpriseDomainManager(enterprise_domain_manager);
|
||||
}
|
||||
|
||||
note_action_ = top_header_->AddChildView(
|
||||
std::make_unique<NoteActionLaunchButton>(initial_note_action_state));
|
||||
|
||||
// Public Session expanded view.
|
||||
expanded_view_ =
|
||||
AddChildView(std::make_unique<LoginExpandedPublicAccountView>(
|
||||
@ -529,7 +521,6 @@ LockContentsView::LockContentsView(
|
||||
user_adding_screen_indicator_ =
|
||||
AddChildView(std::make_unique<UserAddingScreenIndicator>());
|
||||
}
|
||||
OnLockScreenNoteStateChanged(initial_note_action_state);
|
||||
chromeos::PowerManagerClient::Get()->AddObserver(this);
|
||||
RegisterAccelerators();
|
||||
|
||||
@ -780,14 +771,6 @@ void LockContentsView::OnFocus() {
|
||||
}
|
||||
|
||||
void LockContentsView::AboutToRequestFocusFromTabTraversal(bool reverse) {
|
||||
// The LockContentsView itself doesn't have anything to focus. If it gets
|
||||
// focused we should change the currently focused widget (ie, to the shelf or
|
||||
// status area, or lock screen apps, if they are active).
|
||||
if (reverse && lock_screen_apps_active_) {
|
||||
Shell::Get()->login_screen_controller()->FocusLockScreenApps(reverse);
|
||||
return;
|
||||
}
|
||||
|
||||
FocusNextWidget(reverse);
|
||||
}
|
||||
|
||||
@ -1159,9 +1142,6 @@ void LockContentsView::OnAuthEnabledForUser(const AccountId& user) {
|
||||
}
|
||||
|
||||
state->disable_auth = false;
|
||||
disable_lock_screen_note_ = state->disable_auth;
|
||||
OnLockScreenNoteStateChanged(
|
||||
Shell::Get()->tray_action()->GetLockScreenNoteState());
|
||||
|
||||
LoginBigUserView* big_user =
|
||||
TryToFindBigUser(user, true /*require_auth_active*/);
|
||||
@ -1180,8 +1160,6 @@ void LockContentsView::OnAuthDisabledForUser(
|
||||
}
|
||||
|
||||
state->disable_auth = true;
|
||||
disable_lock_screen_note_ = state->disable_auth;
|
||||
OnLockScreenNoteStateChanged(mojom::TrayActionState::kNotAvailable);
|
||||
|
||||
if (auth_disabled_data.disable_lock_screen_media) {
|
||||
Shell::Get()->media_controller()->SuspendMediaSessions();
|
||||
@ -1261,25 +1239,6 @@ void LockContentsView::OnWarningMessageUpdated(const std::u16string& message) {
|
||||
warning_banner_bubble_->Show();
|
||||
}
|
||||
|
||||
void LockContentsView::OnLockScreenNoteStateChanged(
|
||||
mojom::TrayActionState state) {
|
||||
if (disable_lock_screen_note_) {
|
||||
state = mojom::TrayActionState::kNotAvailable;
|
||||
}
|
||||
|
||||
bool old_lock_screen_apps_active = lock_screen_apps_active_;
|
||||
lock_screen_apps_active_ = state == mojom::TrayActionState::kActive;
|
||||
note_action_->UpdateVisibility(state);
|
||||
top_header_->InvalidateLayout();
|
||||
|
||||
// If lock screen apps just got deactivated - request focus for primary auth,
|
||||
// which should focus the password field.
|
||||
if (old_lock_screen_apps_active && !lock_screen_apps_active_ &&
|
||||
primary_big_view_) {
|
||||
primary_big_view_->RequestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void LockContentsView::OnSystemInfoChanged(
|
||||
bool show,
|
||||
bool enforced,
|
||||
@ -1431,14 +1390,6 @@ void LockContentsView::OnDetachableBasePairingStatusChanged(
|
||||
}
|
||||
}
|
||||
|
||||
void LockContentsView::OnFocusLeavingLockScreenApps(bool reverse) {
|
||||
if (!reverse || lock_screen_apps_active_) {
|
||||
FocusNextWidget(reverse);
|
||||
} else {
|
||||
FocusFirstOrLastFocusableChild(this, reverse);
|
||||
}
|
||||
}
|
||||
|
||||
void LockContentsView::OnOobeDialogStateChanged(OobeDialogState state) {
|
||||
const bool oobe_dialog_was_visible = oobe_dialog_visible_;
|
||||
oobe_dialog_visible_ = state != OobeDialogState::HIDDEN &&
|
||||
@ -1492,11 +1443,6 @@ void LockContentsView::OnFocusLeavingSystemTray(bool reverse) {
|
||||
// to lock screen view, and can misbehave in case the focus is kept in it.
|
||||
FocusFirstOrLastFocusableChild(this, reverse);
|
||||
|
||||
if (lock_screen_apps_active_) {
|
||||
Shell::Get()->login_screen_controller()->FocusLockScreenApps(reverse);
|
||||
return;
|
||||
}
|
||||
|
||||
if (oobe_dialog_visible_) {
|
||||
Shell::Get()->login_screen_controller()->FocusOobeDialog();
|
||||
}
|
||||
|
@ -66,13 +66,8 @@ class LoginCameraTimeoutView;
|
||||
class LoginDetachableBaseModel;
|
||||
class LoginExpandedPublicAccountView;
|
||||
class LoginUserView;
|
||||
class NoteActionLaunchButton;
|
||||
class ScrollableUsersListView;
|
||||
|
||||
namespace mojom {
|
||||
enum class TrayActionState;
|
||||
}
|
||||
|
||||
enum class BottomIndicatorState {
|
||||
kNone,
|
||||
kManagedDevice,
|
||||
@ -112,7 +107,6 @@ class ASH_EXPORT LockContentsView
|
||||
static const int kLoginAttemptsBeforeGaiaDialog;
|
||||
|
||||
LockContentsView(
|
||||
mojom::TrayActionState initial_note_action_state,
|
||||
LockScreen::ScreenType screen_type,
|
||||
LoginDataDispatcher* data_dispatcher,
|
||||
std::unique_ptr<LoginDetachableBaseModel> detachable_base_model);
|
||||
@ -173,7 +167,6 @@ class ASH_EXPORT LockContentsView
|
||||
void OnSetTpmLockedState(const AccountId& user,
|
||||
bool is_locked,
|
||||
base::TimeDelta time_left) override;
|
||||
void OnLockScreenNoteStateChanged(mojom::TrayActionState state) override;
|
||||
void OnForceOnlineSignInForUser(const AccountId& user) override;
|
||||
void OnWarningMessageUpdated(const std::u16string& message) override;
|
||||
void OnSystemInfoChanged(bool show,
|
||||
@ -197,7 +190,6 @@ class ASH_EXPORT LockContentsView
|
||||
bool show_full_management_disclosure) override;
|
||||
void OnDetachableBasePairingStatusChanged(
|
||||
DetachableBasePairingStatus pairing_status) override;
|
||||
void OnFocusLeavingLockScreenApps(bool reverse) override;
|
||||
void OnOobeDialogStateChanged(OobeDialogState state) override;
|
||||
|
||||
void MaybeUpdateExpandedView(const AccountId& account_id,
|
||||
@ -426,9 +418,6 @@ class ASH_EXPORT LockContentsView
|
||||
// other views.
|
||||
raw_ptr<views::View> top_header_ = nullptr;
|
||||
|
||||
// View for launching a note taking action handler from the lock screen.
|
||||
raw_ptr<NoteActionLaunchButton> note_action_ = nullptr;
|
||||
|
||||
// View for showing the version, enterprise and bluetooth info.
|
||||
raw_ptr<views::View> system_info_ = nullptr;
|
||||
|
||||
@ -482,17 +471,9 @@ class ASH_EXPORT LockContentsView
|
||||
base::flat_map<AccountId, int> unlock_attempt_by_user_;
|
||||
base::flat_map<AccountId, int> pin_unlock_attempt_by_user_;
|
||||
|
||||
// Whether a lock screen app is currently active (i.e. lock screen note action
|
||||
// state is reported as kActive by the data dispatcher).
|
||||
bool lock_screen_apps_active_ = false;
|
||||
|
||||
// Tracks the visibility of the OOBE dialog.
|
||||
bool oobe_dialog_visible_ = false;
|
||||
|
||||
// Whether the lock screen note is disabled. Used to override the actual lock
|
||||
// screen note state.
|
||||
bool disable_lock_screen_note_ = false;
|
||||
|
||||
// Whether the device is enrolled with Kiosk SKU.
|
||||
bool kiosk_license_mode_ = false;
|
||||
// Whether any kiosk app is added.
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "ash/login/ui/login_error_bubble.h"
|
||||
#include "ash/login/ui/login_expanded_public_account_view.h"
|
||||
#include "ash/login/ui/login_user_view.h"
|
||||
#include "ash/login/ui/note_action_launch_button.h"
|
||||
#include "ash/login/ui/scrollable_users_list_view.h"
|
||||
#include "ash/public/cpp/login_types.h"
|
||||
#include "base/check.h"
|
||||
@ -62,10 +61,6 @@ LockScreenMediaView* LockContentsViewTestApi::media_view() const {
|
||||
return view_->media_view_;
|
||||
}
|
||||
|
||||
views::View* LockContentsViewTestApi::note_action() const {
|
||||
return view_->note_action_;
|
||||
}
|
||||
|
||||
views::View* LockContentsViewTestApi::management_bubble() const {
|
||||
return view_->management_bubble_;
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ class ASH_EXPORT LockContentsViewTestApi {
|
||||
AccountId focused_user() const;
|
||||
ScrollableUsersListView* users_list() const;
|
||||
LockScreenMediaView* media_view() const;
|
||||
views::View* note_action() const;
|
||||
views::View* tooltip_bubble() const;
|
||||
views::View* management_bubble() const;
|
||||
LoginErrorBubble* detachable_base_error_bubble() const;
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "ash/public/cpp/login_screen_test_api.h"
|
||||
#include "ash/public/cpp/login_types.h"
|
||||
#include "ash/public/cpp/reauth_reason.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "ash/root_window_controller.h"
|
||||
#include "ash/session/session_controller_impl.h"
|
||||
#include "ash/shelf/login_shelf_view.h"
|
||||
@ -49,7 +48,6 @@
|
||||
#include "ash/system/power/backlights_forced_off_setter.h"
|
||||
#include "ash/system/power/power_button_controller.h"
|
||||
#include "ash/system/status_area_widget.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
@ -192,8 +190,7 @@ class LockContentsMediaViewUnitTest : public LockContentsViewUnitTest {
|
||||
TEST_F(LockContentsViewUnitTest, DisplayMode) {
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -241,8 +238,7 @@ TEST_F(LockContentsViewUnitTest, DisplayMode) {
|
||||
// Verifies that the single user view is centered.
|
||||
TEST_F(LockContentsViewUnitTest, SingleUserCentered) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -265,8 +261,7 @@ TEST_F(LockContentsViewUnitTest, SingleUserCentered) {
|
||||
TEST_F(LockContentsViewUnitTest, LayoutInSmallScreenSize) {
|
||||
// Build lock screen.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
LockContentsViewTestApi lock_contents(contents);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -326,8 +321,7 @@ TEST_F(LockContentsViewUnitTest, LayoutInSmallScreenSize) {
|
||||
TEST_F(LockContentsViewUnitTest, AutoLayoutAfterRotation) {
|
||||
// Build lock screen with three users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
LockContentsViewTestApi lock_contents(contents);
|
||||
@ -381,8 +375,7 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutAfterRotation) {
|
||||
TEST_F(LockContentsViewUnitTest, AutoLayoutExtraSmallUsersListAfterRotation) {
|
||||
// Build lock screen with extra small layout (> 6 users).
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
SetUserCount(9);
|
||||
@ -418,8 +411,7 @@ TEST_F(LockContentsViewUnitTest, AutoLayoutExtraSmallUsersListAfterRotation) {
|
||||
TEST_F(LockContentsViewUnitTest, AutoLayoutSmallUsersListAfterRotation) {
|
||||
// Build lock screen with small layout (3-6 users).
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
SetUserCount(4);
|
||||
@ -534,8 +526,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, ShowPinPadForPassword) {
|
||||
users()[0].show_pin_pad_for_password = true;
|
||||
ASSERT_NO_FATAL_FAILURE(ShowLoginScreen());
|
||||
LockContentsView* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
ASSERT_NE(nullptr, contents);
|
||||
@ -554,8 +545,7 @@ TEST_F(LockContentsViewKeyboardUnitTest, ShowPinPadForPassword) {
|
||||
TEST_F(LockContentsViewUnitTest, SwapAuthUsersInTwoUserLayout) {
|
||||
// Build lock screen with two users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
LockContentsViewTestApi test_api(contents);
|
||||
SetUserCount(2);
|
||||
@ -599,8 +589,7 @@ TEST_F(LockContentsViewUnitTest, SwapAuthUsersInTwoUserLayout) {
|
||||
TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryAuthUser) {
|
||||
// Build lock screen with five users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
LockContentsViewTestApi lock_contents(contents);
|
||||
@ -641,13 +630,11 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryAuthUser) {
|
||||
// Verifies the system info view bounds interaction with the note-taking button.
|
||||
TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
gfx::Rect widget_bounds = widget->GetWindowBoundsInScreen();
|
||||
LockContentsViewTestApi test_api(contents);
|
||||
// Verify that the system info view is hidden by default.
|
||||
EXPECT_FALSE(test_api.system_info()->GetVisible());
|
||||
@ -659,21 +646,6 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) {
|
||||
"Bluetooth adapter", false /*adb_sideloading_enabled*/);
|
||||
EXPECT_TRUE(test_api.system_info()->GetVisible());
|
||||
EXPECT_FALSE(test_api.bottom_status_indicator()->GetVisible());
|
||||
EXPECT_TRUE(test_api.note_action()->GetVisible());
|
||||
gfx::Size note_action_size = test_api.note_action()->GetPreferredSize();
|
||||
EXPECT_GE(widget_bounds.right() -
|
||||
test_api.system_info()->GetBoundsInScreen().right(),
|
||||
note_action_size.width());
|
||||
|
||||
// Verify that if the note action is disabled, the system info view moves to
|
||||
// the right to fill the empty space.
|
||||
DataDispatcher()->SetLockScreenNoteState(
|
||||
mojom::TrayActionState::kNotAvailable);
|
||||
views::test::RunScheduledLayout(widget.get());
|
||||
EXPECT_FALSE(test_api.note_action()->GetVisible());
|
||||
EXPECT_LT(widget_bounds.right() -
|
||||
test_api.system_info()->GetBoundsInScreen().right(),
|
||||
note_action_size.width());
|
||||
|
||||
// Verify that bottom status indicator is invisible if neither adb sideloading
|
||||
// is enabled nor the device is enrolled.
|
||||
@ -683,8 +655,7 @@ TEST_F(LockContentsViewUnitTest, SystemInfoViewBounds) {
|
||||
// Alt-V toggles display of system information.
|
||||
TEST_F(LockContentsViewUnitTest, AltVTogglesHiddenSystemInfo) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -716,8 +687,7 @@ TEST_F(LockContentsViewUnitTest, AltVTogglesHiddenSystemInfo) {
|
||||
// reveal hidden system info.
|
||||
TEST_F(LockContentsViewUnitTest, ShowRevealsHiddenSystemInfo) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -756,8 +726,7 @@ TEST_F(LockContentsViewUnitTest, ShowRevealsHiddenSystemInfo) {
|
||||
// Show bottom status indicator if ADB sideloading is enabled.
|
||||
TEST_F(LockContentsViewUnitTest, ShowStatusIndicatorIfAdbSideloadingEnabled) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -786,8 +755,7 @@ TEST_F(LockContentsViewUnitTest, ShowStatusIndicatorIfEnrolledDevice) {
|
||||
DeviceEnterpriseInfo{"BestCompanyEver", ManagementDeviceMode::kNone});
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -811,8 +779,7 @@ TEST_F(LockContentsViewUnitTest, ShowManagementBubbleOnClickIfEnrolledDevice) {
|
||||
DeviceEnterpriseInfo{"BestCompanyEver", ManagementDeviceMode::kNone});
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -846,8 +813,7 @@ TEST_F(LockContentsViewUnitTest, DoNotShowManagementBubbleOnClickIfAdb) {
|
||||
DeviceEnterpriseInfo{"BestCompanyEver", ManagementDeviceMode::kNone});
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -879,8 +845,7 @@ TEST_F(LockContentsViewUnitTest, DoNotShowManagementBubbleOnClickIfAdb) {
|
||||
TEST_F(LockContentsViewUnitTest, ShowErrorBubbleOnAuthFailure) {
|
||||
// Build lock screen with a single user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -904,8 +869,7 @@ TEST_F(LockContentsViewUnitTest, ShowErrorBubbleOnAuthFailure) {
|
||||
TEST_F(LockContentsViewUnitTest, AuthErrorLockscreenLearnMoreButton) {
|
||||
// Build lock screen with a single user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -960,8 +924,7 @@ TEST_F(LockContentsViewUnitTest, AuthErrorLockscreenLearnMoreButton) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, AuthErrorLoginScreenRecoverUserButton) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
@ -1021,8 +984,7 @@ TEST_F(LockContentsViewUnitTest, AuthErrorLoginScreenRecoverUserButton) {
|
||||
TEST_F(LockContentsViewUnitTest, GaiaNeverShownOnLockAfterFailedAuth) {
|
||||
// Build lock screen with a single user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -1049,8 +1011,7 @@ TEST_F(LockContentsViewUnitTest, GaiaNeverShownOnLockAfterFailedAuth) {
|
||||
TEST_F(LockContentsViewUnitTest, GaiaNeverShownAfterFirstFailedLoginAttempt) {
|
||||
// Build lock screen with two users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(2);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -1135,9 +1096,9 @@ TEST_F(LockContentsViewUnitTest, ErrorBubbleOnUntrustedDetachableBase) {
|
||||
fake_detachable_base_model.get();
|
||||
|
||||
// Build lock screen with 2 users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(), std::move(fake_detachable_base_model));
|
||||
auto* contents =
|
||||
new LockContentsView(LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::move(fake_detachable_base_model));
|
||||
SetUserCount(2);
|
||||
|
||||
const AccountId& kFirstUserAccountId = users()[0].basic_user_info.account_id;
|
||||
@ -1215,9 +1176,9 @@ TEST_F(LockContentsViewUnitTest, ErrorBubbleForUnauthenticatedDetachableBase) {
|
||||
fake_detachable_base_model.get();
|
||||
|
||||
// Build lock screen with 2 users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(), std::move(fake_detachable_base_model));
|
||||
auto* contents =
|
||||
new LockContentsView(LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::move(fake_detachable_base_model));
|
||||
SetUserCount(2);
|
||||
|
||||
const AccountId& kFirstUserAccountId = users()[0].basic_user_info.account_id;
|
||||
@ -1276,9 +1237,9 @@ TEST_F(LockContentsViewUnitTest,
|
||||
fake_detachable_base_model.get();
|
||||
|
||||
// Build lock screen with 2 users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(), std::move(fake_detachable_base_model));
|
||||
auto* contents =
|
||||
new LockContentsView(LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::move(fake_detachable_base_model));
|
||||
SetUserCount(1);
|
||||
|
||||
const AccountId& kUserAccountId = users()[0].basic_user_info.account_id;
|
||||
@ -1312,9 +1273,9 @@ TEST_F(LockContentsViewUnitTest, DetachableBaseErrorClearsAuthError) {
|
||||
fake_detachable_base_model.get();
|
||||
|
||||
// Build lock screen with a single user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(), std::move(fake_detachable_base_model));
|
||||
auto* contents =
|
||||
new LockContentsView(LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::move(fake_detachable_base_model));
|
||||
SetUserCount(1);
|
||||
|
||||
const AccountId& kUserAccountId = users()[0].basic_user_info.account_id;
|
||||
@ -1362,9 +1323,9 @@ TEST_F(LockContentsViewUnitTest, AuthErrorDoesNotRemoveDetachableBaseError) {
|
||||
fake_detachable_base_model.get();
|
||||
|
||||
// Build lock screen with a single user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(), std::move(fake_detachable_base_model));
|
||||
auto* contents =
|
||||
new LockContentsView(LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::move(fake_detachable_base_model));
|
||||
SetUserCount(1);
|
||||
|
||||
const AccountId& kUserAccountId = users()[0].basic_user_info.account_id;
|
||||
@ -1595,8 +1556,7 @@ TEST_F(LockContentsViewUnitTest, SwapAuthAndPublicAccountUserInTwoUserLayout) {
|
||||
// Build lock screen with two users: one public account user and one regular
|
||||
// user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
AddPublicAccountUsers(1);
|
||||
@ -1655,8 +1615,7 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryBigUser) {
|
||||
// Build lock screen with 4 users: two public account users and two regular
|
||||
// users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
AddPublicAccountUsers(2);
|
||||
@ -1777,8 +1736,7 @@ TEST_F(LockContentsViewUnitTest, SwapUserListToPrimaryBigUser) {
|
||||
// Validates that swapping between two auth users also changes password focus.
|
||||
TEST_F(LockContentsViewUnitTest, AuthUserSwapFocusesPassword) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
AddUsers(2);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -1807,8 +1765,7 @@ TEST_F(LockContentsViewUnitTest, AuthUserSwapFocusesPassword) {
|
||||
// Validates that tapping on an auth user will refocus the password.
|
||||
TEST_F(LockContentsViewUnitTest, TapOnAuthUserFocusesPassword) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
|
||||
@ -1850,8 +1807,7 @@ TEST_F(LockContentsViewUnitTest, TapOnAuthUserFocusesPassword) {
|
||||
// Validates that swapping between users in user lists maintains password focus.
|
||||
TEST_F(LockContentsViewUnitTest, UserListUserSwapFocusesPassword) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
LockContentsViewTestApi contents_test_api(contents);
|
||||
@ -1876,9 +1832,9 @@ TEST_F(LockContentsViewUnitTest, BadDetachableBaseUnfocusesPasswordView) {
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher());
|
||||
FakeLoginDetachableBaseModel* detachable_base_model =
|
||||
fake_detachable_base_model.get();
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(), std::move(fake_detachable_base_model));
|
||||
auto* contents =
|
||||
new LockContentsView(LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::move(fake_detachable_base_model));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
SetUserCount(3);
|
||||
|
||||
@ -1906,8 +1862,7 @@ TEST_F(LockContentsViewUnitTest, ExpandedPublicSessionView) {
|
||||
// Build lock screen with 3 users: one public account user and two regular
|
||||
// users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
LockContentsViewTestApi lock_contents(contents);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -1946,8 +1901,7 @@ TEST_F(LockContentsViewUnitTest, ExpandedPublicSessionView) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, OnAuthEnabledForUserChanged) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -1997,8 +1951,7 @@ TEST_F(LockContentsViewUnitTest, OnAuthEnabledForUserChanged) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, ShowReasonOnAuthDisabled) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -2051,8 +2004,7 @@ TEST_F(LockContentsViewUnitTest, ShowReasonOnAuthDisabled) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -2090,8 +2042,7 @@ TEST_F(LockContentsViewUnitTest, DisabledAuthMessageFocusBehavior) {
|
||||
// after media session changes to playing.
|
||||
TEST_F(LockContentsMediaViewUnitTest, DisableAuthAfterMediaSessionChanged) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2117,8 +2068,7 @@ TEST_F(LockContentsMediaViewUnitTest, DisableAuthAfterMediaSessionChanged) {
|
||||
// before media session changes to playing.
|
||||
TEST_F(LockContentsMediaViewUnitTest, DisableAuthBeforeMediaSessionChanged) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2142,8 +2092,7 @@ TEST_F(LockContentsMediaViewUnitTest, DisableAuthBeforeMediaSessionChanged) {
|
||||
|
||||
TEST_F(LockContentsMediaViewUnitTest, DisableAuthAllowMediaControls) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2168,8 +2117,7 @@ TEST_F(LockContentsMediaViewUnitTest, DisableAuthAllowMediaControls) {
|
||||
// Tests parent access dialog showing/hiding and focus behavior.
|
||||
TEST_F(LockContentsViewUnitTest, ParentAccessDialog) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
AddChildUsers(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -2206,8 +2154,7 @@ TEST_F(LockContentsViewUnitTest, ParentAccessButton) {
|
||||
session_manager::SessionState::LOCKED);
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
AddChildUsers(1);
|
||||
const AccountId child_id = users()[0].basic_user_info.account_id;
|
||||
@ -2374,8 +2321,7 @@ TEST_F(LockContentsViewUnitTest, UserSwapFocusesBigView) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, PowerwashShortcutSendsMojoCall) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -2391,8 +2337,7 @@ TEST_F(LockContentsViewUnitTest, PowerwashShortcutSendsMojoCall) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, UsersChangedRetainsExistingState) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(2);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -2416,8 +2361,7 @@ TEST_F(LockContentsViewUnitTest, UsersChangedRetainsExistingState) {
|
||||
TEST_F(LockContentsViewUnitTest, ShowHideWarningBannerBubble) {
|
||||
// Build lock screen with a single user.
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(lock));
|
||||
@ -2463,8 +2407,7 @@ TEST_F(LockContentsViewUnitTest, ShowHideWarningBannerBubble) {
|
||||
TEST_F(LockContentsViewUnitTest, RemoveUserFocusMovesBackToPrimaryUser) {
|
||||
// Build lock screen with one public account and one normal user.
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
AddPublicAccountUsers(1);
|
||||
AddUsers(1);
|
||||
@ -2508,8 +2451,7 @@ TEST_F(LockContentsViewUnitTest,
|
||||
|
||||
// Show lock screen with one normal user.
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
AddUsers(1);
|
||||
SetWidget(CreateWidgetWithContent(lock));
|
||||
@ -2539,8 +2481,7 @@ TEST_F(LockContentsViewUnitTest,
|
||||
|
||||
// Show lock screen with one normal user.
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
AddUsers(1);
|
||||
SetWidget(CreateWidgetWithContent(lock));
|
||||
@ -2563,8 +2504,7 @@ TEST_F(LockContentsViewUnitTest,
|
||||
TEST_F(LockContentsViewUnitTest, RightAndLeftAcceleratorsWithNoUser) {
|
||||
// Show lock screen but do *not* initialize any users.
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(lock));
|
||||
|
||||
@ -2575,8 +2515,7 @@ TEST_F(LockContentsViewUnitTest, RightAndLeftAcceleratorsWithNoUser) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, OnFocusLeavingSystemTrayWithNoUsers) {
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(lock));
|
||||
|
||||
@ -2589,8 +2528,7 @@ TEST_F(LockContentsViewUnitTest, OnFocusLeavingSystemTrayWithNoUsers) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, OnFocusLeavingSystemTrayWithOobeDialogOpen) {
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(lock));
|
||||
|
||||
@ -2604,8 +2542,7 @@ TEST_F(LockContentsViewUnitTest, OnFocusLeavingSystemTrayWithOobeDialogOpen) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, OnFocusLeavingSystemTrayWithOobeDialogClosed) {
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(lock));
|
||||
|
||||
@ -2619,8 +2556,7 @@ TEST_F(LockContentsViewUnitTest, OnFocusLeavingSystemTrayWithOobeDialogClosed) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, LoginNotReactingOnEventsWithOobeDialogShown) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
SetUserCount(3);
|
||||
@ -2665,8 +2601,7 @@ TEST_F(LockContentsMediaViewUnitTest,
|
||||
LockScreenMediaControlsShownIfMediaPlaying) {
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2683,8 +2618,7 @@ TEST_F(LockContentsMediaViewUnitTest,
|
||||
TEST_F(LockContentsMediaViewUnitTest, LockScreenMediaControlsHiddenAfterDelay) {
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2718,8 +2652,7 @@ TEST_F(LockContentsMediaViewUnitTest,
|
||||
MediaControlsHiddenIfScreenLockedWhileMediaPaused) {
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2736,8 +2669,7 @@ TEST_F(LockContentsMediaViewUnitTest,
|
||||
TEST_F(LockContentsMediaViewUnitTest, KeepMediaControlsShownWithinDelay) {
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2761,8 +2693,7 @@ TEST_F(LockContentsMediaViewUnitTest, KeepMediaControlsShownWithinDelay) {
|
||||
TEST_F(LockContentsMediaViewUnitTest, LockScreenMediaControlsHiddenNoMedia) {
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2779,8 +2710,7 @@ TEST_F(LockContentsMediaViewUnitTest,
|
||||
ShowMediaControlsIfPausedAndAlreadyShowing) {
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2807,8 +2737,7 @@ TEST_F(LockContentsMediaViewUnitTest,
|
||||
|
||||
// Build lock screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2825,8 +2754,7 @@ TEST_F(LockContentsMediaViewUnitTest,
|
||||
TEST_F(LockContentsMediaViewUnitTest, MediaControlsHiddenOnLoginScreen) {
|
||||
// Build login screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -2849,8 +2777,7 @@ TEST_F(LockContentsViewUnitTest, NoNavigationOrHotseatOnLockScreen) {
|
||||
GetSessionControllerClient()->SetSessionState(
|
||||
session_manager::SessionState::LOCKED);
|
||||
LockContentsView* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
|
||||
@ -2865,8 +2792,7 @@ TEST_F(LockContentsViewUnitTest, NoNavigationOrHotseatOnLockScreen) {
|
||||
TEST_F(LockContentsViewUnitTest, NoUsersToShow) {
|
||||
// Build lock screen with 0 users.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
LockContentsViewTestApi test_api(contents);
|
||||
@ -2880,8 +2806,7 @@ TEST_F(LockContentsViewUnitTest, NoUsersToShow) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, ToggleGaiaOnUsersChanged) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
LockContentsViewTestApi test_api(contents);
|
||||
@ -2897,8 +2822,7 @@ TEST_F(LockContentsViewUnitTest, UpdatingSmartLockStateSetsAuthMethod) {
|
||||
ui::ScopedAnimationDurationScaleMode non_zero_duration_mode(
|
||||
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
AddUsers(1);
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
@ -2932,8 +2856,7 @@ TEST_F(LockContentsViewUnitTest, SmartLockStateHidesPasswordView) {
|
||||
|
||||
// Build login screen with 1 user.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
LockContentsViewTestApi test_api(contents);
|
||||
AddUsers(1);
|
||||
@ -2992,8 +2915,7 @@ TEST_F(LockContentsViewUnitTest, SmartLockStateHidesAuthErrorMessage) {
|
||||
TEST_F(LockContentsViewUnitTest,
|
||||
LoginNotReactingOnEventsWithLoginExtensionUiShown) {
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
SetUserCount(3);
|
||||
@ -3041,8 +2963,7 @@ TEST_F(LockContentsViewUnitTest, LoginExtensionUiWithUsers) {
|
||||
DeviceEnterpriseInfo{"BestCompanyEver", ManagementDeviceMode::kNone});
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
SetUserCount(3);
|
||||
@ -3077,8 +2998,7 @@ TEST_F(LockContentsViewUnitTest, LoginExtensionUiWithNoUsers) {
|
||||
DeviceEnterpriseInfo{"BestCompanyEver", ManagementDeviceMode::kNone});
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(contents));
|
||||
SetUserCount(0);
|
||||
@ -3289,8 +3209,7 @@ TEST_F(LockContentsViewUnitTest, MetricsRecordedOnSuccessfulLoginAttempt) {
|
||||
base::HistogramTester histogram_tester;
|
||||
// Build lock screen with a single user.
|
||||
auto contents = std::make_unique<LockContentsView>(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents.get()));
|
||||
@ -3327,8 +3246,7 @@ TEST_F(LockContentsViewUnitTest, MetricsRecordedOnFirstSuccessfulLoginAttempt) {
|
||||
base::HistogramTester histogram_tester;
|
||||
// Build lock screen with a single user.
|
||||
auto contents = std::make_unique<LockContentsView>(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents.get()));
|
||||
@ -3361,8 +3279,7 @@ TEST_F(LockContentsViewUnitTest, MetricsRecordedOnFailedLoginAttempt) {
|
||||
base::HistogramTester histogram_tester;
|
||||
// Build lock screen with a single user.
|
||||
auto contents = std::make_unique<LockContentsView>(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
SetWidget(CreateWidgetWithContent(contents.get()));
|
||||
@ -3394,8 +3311,7 @@ TEST_F(LockContentsViewUnitTest, MetricsRecordedOnFailedLoginAttempt) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, LoginAccessibleProperties) {
|
||||
auto contents = std::make_unique<LockContentsView>(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(contents.get()));
|
||||
Shelf* shelf = Shelf::ForWindow(contents->GetWidget()->GetNativeWindow());
|
||||
@ -3413,8 +3329,7 @@ TEST_F(LockContentsViewUnitTest, LoginAccessibleProperties) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, LockAccessibleProperties) {
|
||||
auto contents = std::make_unique<LockContentsView>(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(contents.get()));
|
||||
Shelf* shelf = Shelf::ForWindow(contents->GetWidget()->GetNativeWindow());
|
||||
@ -3432,8 +3347,7 @@ TEST_F(LockContentsViewUnitTest, LockAccessibleProperties) {
|
||||
|
||||
TEST_F(LockContentsViewUnitTest, LoginToolTipViewAccessibleProperties) {
|
||||
auto contents = std::make_unique<LockContentsView>(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLogin, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetWidget(CreateWidgetWithContent(contents.get()));
|
||||
LockContentsViewTestApi test_api(contents.get());
|
||||
|
@ -211,12 +211,10 @@ class LockDebugView::DebugDataDispatcherTransformer
|
||||
: public LoginDataDispatcher::Observer {
|
||||
public:
|
||||
DebugDataDispatcherTransformer(
|
||||
mojom::TrayActionState initial_lock_screen_note_state,
|
||||
LoginDataDispatcher* dispatcher,
|
||||
const base::RepeatingClosure& on_users_received,
|
||||
LockDebugView* lock_debug_view)
|
||||
: root_dispatcher_(dispatcher),
|
||||
lock_screen_note_state_(initial_lock_screen_note_state),
|
||||
on_users_received_(on_users_received),
|
||||
lock_debug_view_(lock_debug_view) {
|
||||
root_dispatcher_->AddObserver(this);
|
||||
@ -581,16 +579,6 @@ class LockDebugView::DebugDataDispatcherTransformer
|
||||
NotifyUsers(std::move(users));
|
||||
}
|
||||
|
||||
void ToggleLockScreenNoteButton() {
|
||||
if (lock_screen_note_state_ == mojom::TrayActionState::kAvailable) {
|
||||
lock_screen_note_state_ = mojom::TrayActionState::kNotAvailable;
|
||||
} else {
|
||||
lock_screen_note_state_ = mojom::TrayActionState::kAvailable;
|
||||
}
|
||||
|
||||
debug_dispatcher_.SetLockScreenNoteState(lock_screen_note_state_);
|
||||
}
|
||||
|
||||
void AddKioskApp(ShelfWidget* shelf_widget) {
|
||||
kiosk_apps_.emplace_back(KioskAppMenuEntry::AppType::kChromeApp,
|
||||
kDebugKioskAppAccountId, kDebugKioskAppId,
|
||||
@ -675,10 +663,6 @@ class LockDebugView::DebugDataDispatcherTransformer
|
||||
}
|
||||
}
|
||||
}
|
||||
void OnLockScreenNoteStateChanged(mojom::TrayActionState state) override {
|
||||
lock_screen_note_state_ = state;
|
||||
debug_dispatcher_.SetLockScreenNoteState(state);
|
||||
}
|
||||
void OnDetachableBasePairingStatusChanged(
|
||||
DetachableBasePairingStatus pairing_status) override {
|
||||
debug_dispatcher_.SetDetachableBasePairingStatus(pairing_status);
|
||||
@ -713,9 +697,6 @@ class LockDebugView::DebugDataDispatcherTransformer
|
||||
// Metadata for users that the UI is displaying.
|
||||
std::vector<UserMetadata> debug_users_;
|
||||
|
||||
// The current lock screen note action state.
|
||||
mojom::TrayActionState lock_screen_note_state_;
|
||||
|
||||
// List of kiosk apps loaded.
|
||||
std::vector<KioskAppMenuEntry> kiosk_apps_;
|
||||
|
||||
@ -867,10 +848,8 @@ class LockDebugView::DebugLoginDetachableBaseModel
|
||||
std::map<AccountId, int> last_used_bases_;
|
||||
};
|
||||
|
||||
LockDebugView::LockDebugView(mojom::TrayActionState initial_note_action_state,
|
||||
LockScreen::ScreenType screen_type)
|
||||
LockDebugView::LockDebugView(LockScreen::ScreenType screen_type)
|
||||
: debug_data_dispatcher_(std::make_unique<DebugDataDispatcherTransformer>(
|
||||
initial_note_action_state,
|
||||
Shell::Get()->login_screen_controller()->data_dispatcher(),
|
||||
base::BindRepeating(
|
||||
&LockDebugView::UpdatePerUserActionContainerAndLayout,
|
||||
@ -884,7 +863,7 @@ LockDebugView::LockDebugView(mojom::TrayActionState initial_note_action_state,
|
||||
std::make_unique<DebugLoginDetachableBaseModel>();
|
||||
debug_detachable_base_model_ = debug_detachable_base_model.get();
|
||||
|
||||
lock_ = new LockContentsView(initial_note_action_state, screen_type,
|
||||
lock_ = new LockContentsView(screen_type,
|
||||
debug_data_dispatcher_->debug_dispatcher(),
|
||||
std::move(debug_detachable_base_model));
|
||||
AddChildView(lock_.get());
|
||||
@ -939,11 +918,6 @@ LockDebugView::LockDebugView(mojom::TrayActionState initial_note_action_state,
|
||||
!wallpaper_controller->IsWallpaperBlurredForLockState());
|
||||
}),
|
||||
toggle_container);
|
||||
AddButton("Toggle note action",
|
||||
base::BindRepeating(
|
||||
&DebugDataDispatcherTransformer::ToggleLockScreenNoteButton,
|
||||
base::Unretained(debug_data_dispatcher_.get())),
|
||||
toggle_container);
|
||||
AddButton("Toggle caps lock", base::BindRepeating([]() {
|
||||
ImeControllerImpl* ime_controller =
|
||||
Shell::Get()->ime_controller();
|
||||
|
@ -32,8 +32,7 @@ enum class TrayActionState;
|
||||
// Contains the debug UI row (ie, add user, toggle PIN buttons).
|
||||
class LockDebugView : public views::View {
|
||||
public:
|
||||
LockDebugView(mojom::TrayActionState initial_note_action_state,
|
||||
LockScreen::ScreenType screen_type);
|
||||
LockDebugView(LockScreen::ScreenType screen_type);
|
||||
|
||||
LockDebugView(const LockDebugView&) = delete;
|
||||
LockDebugView& operator=(const LockDebugView&) = delete;
|
||||
|
@ -82,7 +82,6 @@ LockScreen::LockScreen(ScreenType type) : type_(type) {
|
||||
}
|
||||
}
|
||||
|
||||
tray_action_observation_.Observe(Shell::Get()->tray_action());
|
||||
if (Shell::Get()->session_controller()->GetSessionState() !=
|
||||
session_manager::SessionState::LOGIN_SECONDARY) {
|
||||
saved_clipboard_ = ui::Clipboard::TakeForCurrentThread();
|
||||
@ -103,12 +102,9 @@ LockScreen::~LockScreen() {
|
||||
}
|
||||
|
||||
std::unique_ptr<views::View> LockScreen::MakeContentsView() {
|
||||
auto initial_note_action_state =
|
||||
Shell::Get()->tray_action()->GetLockScreenNoteState();
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kShowLoginDevOverlay)) {
|
||||
auto debug_view =
|
||||
std::make_unique<LockDebugView>(initial_note_action_state, type_);
|
||||
auto debug_view = std::make_unique<LockDebugView>(type_);
|
||||
contents_view_ = debug_view->lock();
|
||||
return debug_view;
|
||||
}
|
||||
@ -116,8 +112,7 @@ std::unique_ptr<views::View> LockScreen::MakeContentsView() {
|
||||
auto detachable_base_model =
|
||||
LoginDetachableBaseModel::Create(Shell::Get()->detachable_base_handler());
|
||||
auto view = std::make_unique<LockContentsView>(
|
||||
initial_note_action_state, type_,
|
||||
Shell::Get()->login_screen_controller()->data_dispatcher(),
|
||||
type_, Shell::Get()->login_screen_controller()->data_dispatcher(),
|
||||
std::move(detachable_base_model));
|
||||
contents_view_ = view.get();
|
||||
return view;
|
||||
@ -205,13 +200,6 @@ void LockScreen::SetHasKioskApp(bool has_kiosk_apps) {
|
||||
contents_view_->SetHasKioskApp(has_kiosk_apps);
|
||||
}
|
||||
|
||||
void LockScreen::OnLockScreenNoteStateChanged(mojom::TrayActionState state) {
|
||||
Shell::Get()
|
||||
->login_screen_controller()
|
||||
->data_dispatcher()
|
||||
->SetLockScreenNoteState(state);
|
||||
}
|
||||
|
||||
void LockScreen::OnSessionStateChanged(session_manager::SessionState state) {
|
||||
if (type_ == ScreenType::kLogin &&
|
||||
state == session_manager::SessionState::ACTIVE) {
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/public/cpp/login_types.h"
|
||||
#include "ash/public/cpp/session/session_observer.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/tray_action/tray_action_observer.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/scoped_observation.h"
|
||||
@ -27,8 +25,7 @@ namespace ash {
|
||||
|
||||
class LockContentsView;
|
||||
|
||||
class ASH_EXPORT LockScreen : public TrayActionObserver,
|
||||
public SessionObserver {
|
||||
class ASH_EXPORT LockScreen : public SessionObserver {
|
||||
public:
|
||||
// TestApi is used for tests to get internal implementation details.
|
||||
class ASH_EXPORT TestApi {
|
||||
@ -77,9 +74,6 @@ class ASH_EXPORT LockScreen : public TrayActionObserver,
|
||||
void ShowManagementDisclosureDialog();
|
||||
void SetHasKioskApp(bool has_kiosk_apps);
|
||||
|
||||
// TrayActionObserver:
|
||||
void OnLockScreenNoteStateChanged(mojom::TrayActionState state) override;
|
||||
|
||||
// SessionObserver:
|
||||
void OnSessionStateChanged(session_manager::SessionState state) override;
|
||||
void OnLockStateChanged(bool locked) override;
|
||||
@ -115,8 +109,6 @@ class ASH_EXPORT LockScreen : public TrayActionObserver,
|
||||
|
||||
std::unique_ptr<views::Widget::PaintAsActiveLock> paint_as_active_lock_;
|
||||
|
||||
base::ScopedObservation<TrayAction, TrayActionObserver>
|
||||
tray_action_observation_{this};
|
||||
ScopedSessionObserver session_observer_{this};
|
||||
|
||||
std::vector<base::OnceClosure> on_shown_callbacks_;
|
||||
|
@ -33,8 +33,7 @@ class LockScreenMediaViewTest : public LoginTestBase {
|
||||
LoginTestBase::SetUp();
|
||||
|
||||
LockContentsView* lock_contents_view = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
LockContentsViewTestApi lock_contents(lock_contents_view);
|
||||
SetWidget(CreateWidgetWithContent(lock_contents_view));
|
||||
|
@ -43,28 +43,6 @@ views::View* GetLoginShelfContentsView(gfx::NativeWindow native_window) {
|
||||
return shelf->login_shelf_widget()->GetContentsView();
|
||||
}
|
||||
|
||||
class LockScreenAppFocuser {
|
||||
public:
|
||||
explicit LockScreenAppFocuser(views::Widget* lock_screen_app_widget)
|
||||
: lock_screen_app_widget_(lock_screen_app_widget) {}
|
||||
|
||||
LockScreenAppFocuser(const LockScreenAppFocuser&) = delete;
|
||||
LockScreenAppFocuser& operator=(const LockScreenAppFocuser&) = delete;
|
||||
|
||||
~LockScreenAppFocuser() = default;
|
||||
|
||||
bool reversed_tab_order() const { return reversed_tab_order_; }
|
||||
|
||||
void FocusLockScreenApp(bool reverse) {
|
||||
reversed_tab_order_ = reverse;
|
||||
lock_screen_app_widget_->Activate();
|
||||
}
|
||||
|
||||
private:
|
||||
bool reversed_tab_order_ = false;
|
||||
raw_ptr<views::Widget> lock_screen_app_widget_;
|
||||
};
|
||||
|
||||
testing::AssertionResult VerifyFocused(views::View* view) {
|
||||
if (!view->GetWidget()->IsActive()) {
|
||||
return testing::AssertionFailure() << "Widget not active.";
|
||||
@ -91,8 +69,7 @@ testing::AssertionResult VerifyNotFocused(views::View* view) {
|
||||
TEST_F(LockScreenSanityTest, PasswordIsInitiallyFocused) {
|
||||
// Build lock screen.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
|
||||
// The lock screen requires at least one user.
|
||||
@ -110,8 +87,7 @@ TEST_F(LockScreenSanityTest, PasswordIsInitiallyFocused) {
|
||||
TEST_F(LockScreenSanityTest, PasswordSubmitCallsLoginScreenClient) {
|
||||
// Build lock screen.
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
|
||||
// The lock screen requires at least one user.
|
||||
@ -137,8 +113,7 @@ TEST_F(LockScreenSanityTest,
|
||||
auto client = std::make_unique<MockLoginScreenClient>();
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(contents);
|
||||
@ -194,8 +169,7 @@ TEST_F(LockScreenSanityTest, TabGoesFromLockToShelfAndBackToLock) {
|
||||
|
||||
// Create lock screen.
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock);
|
||||
@ -226,8 +200,7 @@ TEST_F(LockScreenSanityTest, ShiftTabGoesFromLockToStatusAreaAndBackToLock) {
|
||||
session_manager::SessionState::LOCKED);
|
||||
|
||||
auto* lock = new LockContentsView(
|
||||
mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
std::unique_ptr<views::Widget> widget = CreateWidgetWithContent(lock);
|
||||
@ -256,8 +229,7 @@ TEST_F(LockScreenSanityTest, RemoveUser) {
|
||||
auto client = std::make_unique<MockLoginScreenClient>();
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
|
||||
// Add two users, the first of which can be removed.
|
||||
|
@ -72,9 +72,6 @@ void LoginDataDispatcher::Observer::OnTapToUnlockEnabledForUserChanged(
|
||||
void LoginDataDispatcher::Observer::OnForceOnlineSignInForUser(
|
||||
const AccountId& user) {}
|
||||
|
||||
void LoginDataDispatcher::Observer::OnLockScreenNoteStateChanged(
|
||||
mojom::TrayActionState state) {}
|
||||
|
||||
void LoginDataDispatcher::Observer::OnWarningMessageUpdated(
|
||||
const std::u16string& message) {}
|
||||
|
||||
@ -108,9 +105,6 @@ void LoginDataDispatcher::Observer::
|
||||
void LoginDataDispatcher::Observer::OnDetachableBasePairingStatusChanged(
|
||||
DetachableBasePairingStatus pairing_status) {}
|
||||
|
||||
void LoginDataDispatcher::Observer::OnFocusLeavingLockScreenApps(bool reverse) {
|
||||
}
|
||||
|
||||
void LoginDataDispatcher::Observer::OnOobeDialogStateChanged(
|
||||
OobeDialogState state) {}
|
||||
|
||||
@ -239,12 +233,6 @@ void LoginDataDispatcher::ForceOnlineSignInForUser(const AccountId& user) {
|
||||
}
|
||||
}
|
||||
|
||||
void LoginDataDispatcher::SetLockScreenNoteState(mojom::TrayActionState state) {
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnLockScreenNoteStateChanged(state);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginDataDispatcher::SetSmartLockState(const AccountId& user,
|
||||
SmartLockState state) {
|
||||
for (auto& observer : observers_) {
|
||||
@ -316,12 +304,6 @@ void LoginDataDispatcher::SetDetachableBasePairingStatus(
|
||||
}
|
||||
}
|
||||
|
||||
void LoginDataDispatcher::HandleFocusLeavingLockScreenApps(bool reverse) {
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnFocusLeavingLockScreenApps(reverse);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginDataDispatcher::NotifyOobeDialogState(OobeDialogState state) {
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnOobeDialogStateChanged(state);
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/detachable_base/detachable_base_pairing_status.h"
|
||||
#include "ash/public/cpp/login_screen_model.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/time/time.h"
|
||||
|
||||
@ -115,9 +114,6 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
|
||||
// token is revoked).
|
||||
virtual void OnForceOnlineSignInForUser(const AccountId& user);
|
||||
|
||||
// Called when the lock screen note state changes.
|
||||
virtual void OnLockScreenNoteStateChanged(mojom::TrayActionState state);
|
||||
|
||||
// Called when a warning message should be displayed, or hidden if |message|
|
||||
// is empty.
|
||||
virtual void OnWarningMessageUpdated(const std::u16string& message);
|
||||
@ -161,10 +157,6 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
|
||||
virtual void OnDetachableBasePairingStatusChanged(
|
||||
DetachableBasePairingStatus pairing_status);
|
||||
|
||||
// Called when focus is leaving a lock screen app window due to tabbing.
|
||||
// |reverse| - whether the tab order is reversed.
|
||||
virtual void OnFocusLeavingLockScreenApps(bool reverse);
|
||||
|
||||
// Called when the state of the OOBE dialog is changed.
|
||||
virtual void OnOobeDialogStateChanged(OobeDialogState state);
|
||||
|
||||
@ -221,7 +213,6 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
|
||||
void SetTapToUnlockEnabledForUser(const AccountId& user,
|
||||
bool enabled) override;
|
||||
void ForceOnlineSignInForUser(const AccountId& user) override;
|
||||
void SetLockScreenNoteState(mojom::TrayActionState state);
|
||||
void UpdateWarningMessage(const std::u16string& message) override;
|
||||
void SetSystemInfo(bool show,
|
||||
bool enforced,
|
||||
@ -243,7 +234,6 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
|
||||
bool show_full_management_disclosure) override;
|
||||
void SetDetachableBasePairingStatus(
|
||||
DetachableBasePairingStatus pairing_status);
|
||||
void HandleFocusLeavingLockScreenApps(bool reverse) override;
|
||||
void NotifyOobeDialogState(OobeDialogState state) override;
|
||||
void NotifyFocusPod(const AccountId& account_id) override;
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "ash/login/ui/lock_screen.h"
|
||||
#include "ash/login/ui/login_test_utils.h"
|
||||
#include "ash/public/cpp/shell_window_ids.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "ash/session/test_session_controller_client.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/wallpaper/wallpaper_controller_impl.h"
|
||||
|
@ -38,8 +38,7 @@ TEST_F(ManagementDisclosureDialogTest, CheckStaticTextTest) {
|
||||
DeviceEnterpriseInfo{"BestCompanyEver", ManagementDeviceMode::kNone});
|
||||
|
||||
auto* contents = new LockContentsView(
|
||||
mojom::TrayActionState::kAvailable, LockScreen::ScreenType::kLock,
|
||||
DataDispatcher(),
|
||||
LockScreen::ScreenType::kLock, DataDispatcher(),
|
||||
std::make_unique<FakeLoginDetachableBaseModel>(DataDispatcher()));
|
||||
SetUserCount(1);
|
||||
|
||||
|
@ -1,394 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/login/ui/note_action_launch_button.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ash/metrics/user_metrics_recorder.h"
|
||||
#include "ash/public/cpp/shelf_config.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "ash/resources/vector_icons/vector_icons.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/ash_color_id.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/compositor/layer_animator.h"
|
||||
#include "ui/compositor/paint_recorder.h"
|
||||
#include "ui/compositor/scoped_layer_animation_settings.h"
|
||||
#include "ui/gfx/canvas.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/animation/ink_drop_painted_layer_delegates.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
#include "ui/views/controls/button/image_button.h"
|
||||
#include "ui/views/layout/fill_layout.h"
|
||||
#include "ui/views/masked_targeter_delegate.h"
|
||||
#include "ui/views/view_targeter.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
// The default note action bubble size.
|
||||
constexpr int kSmallBubbleRadiusDp = 48;
|
||||
|
||||
// The default note action bubble opacity.
|
||||
constexpr float kSmallBubbleOpacity = 0.34;
|
||||
|
||||
// The note action bubble size when it's hovered/focused.
|
||||
constexpr int kLargeBubbleRadiusDp = 56;
|
||||
|
||||
// The note action bubble opacity when it's hovered/focused.
|
||||
constexpr float kLargeBubbleOpacity = 0.46;
|
||||
|
||||
// The note action background color.
|
||||
constexpr int kBubbleColor = SkColorSetRGB(0x9E, 0x9E, 0x9E);
|
||||
|
||||
// The note action icon size.
|
||||
constexpr int kIconSizeDp = 16;
|
||||
|
||||
// The note action icon padding from top and right bubble edges (assuming LTR
|
||||
// layout).
|
||||
constexpr int kIconPaddingDp = 12;
|
||||
|
||||
// Layer delegate for painting a bubble of the specified radius and color to a
|
||||
// layer. The bubble is painted as a quarter of a circle with the center in top
|
||||
// right corner of the painted bounds.
|
||||
// This is used to paint the bubble on the background view's layer.
|
||||
class BubbleLayerDelegate : public views::BasePaintedLayerDelegate {
|
||||
public:
|
||||
BubbleLayerDelegate(SkColor color, int radius)
|
||||
: views::BasePaintedLayerDelegate(color), radius_(radius) {}
|
||||
|
||||
BubbleLayerDelegate(const BubbleLayerDelegate&) = delete;
|
||||
BubbleLayerDelegate& operator=(const BubbleLayerDelegate&) = delete;
|
||||
|
||||
~BubbleLayerDelegate() override = default;
|
||||
|
||||
// views::BasePaintedLayerDelegate:
|
||||
gfx::RectF GetPaintedBounds() const override {
|
||||
return gfx::RectF(0, 0, radius_, radius_);
|
||||
}
|
||||
|
||||
void OnPaintLayer(const ui::PaintContext& context) override {
|
||||
cc::PaintFlags flags;
|
||||
flags.setColor(color());
|
||||
flags.setAntiAlias(true);
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
|
||||
ui::PaintRecorder recorder(context, gfx::Size(radius_, radius_));
|
||||
gfx::Canvas* canvas = recorder.canvas();
|
||||
canvas->Save();
|
||||
canvas->ClipRect(GetPaintedBounds());
|
||||
canvas->DrawCircle(base::i18n::IsRTL() ? GetPaintedBounds().origin()
|
||||
: GetPaintedBounds().top_right(),
|
||||
radius_, flags);
|
||||
canvas->Restore();
|
||||
}
|
||||
|
||||
private:
|
||||
// The radius of the circle.
|
||||
int radius_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// The (background) view that paints and animates the note action bubble.
|
||||
class NoteActionLaunchButton::BackgroundView : public NonAccessibleView {
|
||||
METADATA_HEADER(BackgroundView, NonAccessibleView)
|
||||
|
||||
public:
|
||||
// NOTE: the background layer is set to the large bubble bounds and scaled
|
||||
// down when needed.
|
||||
BackgroundView()
|
||||
: background_layer_delegate_(kBubbleColor, kLargeBubbleRadiusDp) {
|
||||
// Painted to layer to provide background animations when the background
|
||||
// bubble is resized due to the action button changing its state (for
|
||||
// example when the button is hovered, the background should be expanded to
|
||||
// kLargeBubbleRadiusDp).
|
||||
SetPaintToLayer();
|
||||
|
||||
layer()->set_delegate(&background_layer_delegate_);
|
||||
layer()->SetMasksToBounds(true);
|
||||
layer()->SetFillsBoundsOpaquely(false);
|
||||
layer()->SetVisible(true);
|
||||
layer()->SetOpacity(opacity_);
|
||||
}
|
||||
|
||||
BackgroundView(const BackgroundView&) = delete;
|
||||
BackgroundView& operator=(const BackgroundView&) = delete;
|
||||
|
||||
~BackgroundView() override = default;
|
||||
|
||||
// Updates the bubble's opacity and radius. The bubble radius is updated
|
||||
// applying scale transform to the view's layout. Transformations are
|
||||
// animated.
|
||||
void SetBubbleRadiusAndOpacity(int target_radius, float opacity) {
|
||||
if (target_radius == bubble_radius_ && opacity_ == opacity) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
|
||||
settings.SetPreemptionStrategy(
|
||||
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
|
||||
settings.SetTweenType(gfx::Tween::EASE_IN);
|
||||
|
||||
gfx::Transform transform;
|
||||
if (target_radius != kLargeBubbleRadiusDp) {
|
||||
// Move the buble to it's new origin before scaling the image - note that
|
||||
// in RTL layout, the origin remains the same - (0, 0) in local bounds.
|
||||
if (!base::i18n::IsRTL()) {
|
||||
transform.Translate(kLargeBubbleRadiusDp - target_radius, 0);
|
||||
}
|
||||
float scale = target_radius / static_cast<float>(kLargeBubbleRadiusDp);
|
||||
transform.Scale(scale, scale);
|
||||
}
|
||||
|
||||
layer()->SetTransform(transform);
|
||||
layer()->SetOpacity(opacity);
|
||||
|
||||
bubble_radius_ = target_radius;
|
||||
}
|
||||
|
||||
private:
|
||||
float opacity_ = 0;
|
||||
int bubble_radius_ = 0;
|
||||
|
||||
BubbleLayerDelegate background_layer_delegate_;
|
||||
};
|
||||
|
||||
BEGIN_METADATA(NoteActionLaunchButton, BackgroundView)
|
||||
END_METADATA
|
||||
|
||||
// The event target delegate used for the note action view. It matches the
|
||||
// shape of the bubble with the provided radius.
|
||||
class BubbleTargeterDelegate : public views::MaskedTargeterDelegate {
|
||||
public:
|
||||
explicit BubbleTargeterDelegate(int view_width, int circle_radius)
|
||||
: view_width_(view_width), circle_radius_(circle_radius) {}
|
||||
|
||||
BubbleTargeterDelegate(const BubbleTargeterDelegate&) = delete;
|
||||
BubbleTargeterDelegate& operator=(const BubbleTargeterDelegate&) = delete;
|
||||
|
||||
~BubbleTargeterDelegate() override = default;
|
||||
|
||||
bool GetHitTestMask(SkPath* mask) const override {
|
||||
int center_x = base::i18n::IsRTL() ? 0 : view_width_;
|
||||
mask->addCircle(SkIntToScalar(center_x), SkIntToScalar(0),
|
||||
SkIntToScalar(circle_radius_));
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
int view_width_;
|
||||
int circle_radius_;
|
||||
};
|
||||
|
||||
// The action button foreground - an image button with actionable area matching
|
||||
// the (small) bubble shape centered in the top right corner of the action
|
||||
// button bounds.
|
||||
class NoteActionLaunchButton::ActionButton : public views::ImageButton {
|
||||
METADATA_HEADER(ActionButton, views::ImageButton)
|
||||
|
||||
public:
|
||||
explicit ActionButton(NoteActionLaunchButton::BackgroundView* background)
|
||||
: views::ImageButton(base::BindRepeating(&ActionButton::ButtonPressed,
|
||||
base::Unretained(this))),
|
||||
background_(background),
|
||||
event_targeter_delegate_(kLargeBubbleRadiusDp, kSmallBubbleRadiusDp) {
|
||||
GetViewAccessibility().SetName(
|
||||
l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CREATE_NOTE_ACTION));
|
||||
SetImageModel(
|
||||
views::Button::STATE_NORMAL,
|
||||
ui::ImageModel::FromVectorIcon(kTrayActionNewLockScreenNoteIcon,
|
||||
kColorAshButtonIconColor));
|
||||
SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
|
||||
SetFocusPainter(nullptr);
|
||||
SetFlipCanvasOnPaintForRTLUI(true);
|
||||
SetPreferredSize(gfx::Size(kLargeBubbleRadiusDp, kLargeBubbleRadiusDp));
|
||||
SetEventTargeter(
|
||||
std::make_unique<views::ViewTargeter>(&event_targeter_delegate_));
|
||||
|
||||
// Paint to layer because the background is painted to layer - if the button
|
||||
// was not painted to layer as well, the background would be painted over
|
||||
// it.
|
||||
SetPaintToLayer();
|
||||
layer()->SetMasksToBounds(true);
|
||||
layer()->SetFillsBoundsOpaquely(false);
|
||||
|
||||
UpdateBubbleRadiusAndOpacity();
|
||||
}
|
||||
|
||||
ActionButton(const ActionButton&) = delete;
|
||||
ActionButton& operator=(const ActionButton&) = delete;
|
||||
|
||||
~ActionButton() override = default;
|
||||
|
||||
// views::ImageButton:
|
||||
void PaintButtonContents(gfx::Canvas* canvas) override {
|
||||
canvas->Save();
|
||||
// Correctly position the icon image on the button's canvas.
|
||||
canvas->Translate(gfx::Vector2d(
|
||||
kLargeBubbleRadiusDp - kIconSizeDp - kIconPaddingDp, kIconPaddingDp));
|
||||
canvas->ClipRect(gfx::Rect(0, 0, kIconSizeDp, kIconSizeDp));
|
||||
|
||||
views::ImageButton::PaintButtonContents(canvas);
|
||||
canvas->Restore();
|
||||
}
|
||||
void StateChanged(ButtonState old_state) override {
|
||||
ImageButton::StateChanged(old_state);
|
||||
UpdateBubbleRadiusAndOpacity();
|
||||
}
|
||||
void OnFocus() override {
|
||||
ImageButton::OnFocus();
|
||||
UpdateBubbleRadiusAndOpacity();
|
||||
}
|
||||
void OnBlur() override {
|
||||
ImageButton::OnBlur();
|
||||
UpdateBubbleRadiusAndOpacity();
|
||||
}
|
||||
void OnGestureEvent(ui::GestureEvent* event) override {
|
||||
switch (event->type()) {
|
||||
case ui::EventType::kGestureScrollBegin:
|
||||
// Mark scroll begin handled, so the view starts receiving scroll
|
||||
// events (in particular) fling/swipe.
|
||||
// Ignore multi-finger gestures - the note action requests are
|
||||
// restricted to single finger gestures.
|
||||
if (event->details().touch_points() == 1) {
|
||||
SetTrackingPotentialActivationGesture(true);
|
||||
event->SetHandled();
|
||||
}
|
||||
break;
|
||||
case ui::EventType::kGestureScrollUpdate:
|
||||
// If the user has added fingers to the gesture, cancel the fling
|
||||
// detection - the note action requests are restricted to single finger
|
||||
// gestures.
|
||||
if (event->details().touch_points() != 1) {
|
||||
SetTrackingPotentialActivationGesture(false);
|
||||
}
|
||||
break;
|
||||
case ui::EventType::kGestureEnd:
|
||||
case ui::EventType::kGestureScrollEnd:
|
||||
case ui::EventType::kScrollFlingCancel:
|
||||
SetTrackingPotentialActivationGesture(false);
|
||||
break;
|
||||
case ui::EventType::kScrollFlingStart:
|
||||
MaybeActivateActionOnFling(event);
|
||||
SetTrackingPotentialActivationGesture(false);
|
||||
event->StopPropagation();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!event->handled()) {
|
||||
views::ImageButton::OnGestureEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Updates the background view size and opacity depending on the current note
|
||||
// action button state.
|
||||
void UpdateBubbleRadiusAndOpacity() {
|
||||
bool show_large_bubble = HasFocus() || GetState() == STATE_HOVERED ||
|
||||
GetState() == STATE_PRESSED ||
|
||||
tracking_activation_gesture_;
|
||||
background_->SetBubbleRadiusAndOpacity(
|
||||
show_large_bubble ? kLargeBubbleRadiusDp : kSmallBubbleRadiusDp,
|
||||
show_large_bubble ? kLargeBubbleOpacity : kSmallBubbleOpacity);
|
||||
}
|
||||
|
||||
void ButtonPressed(const ui::Event& event) {
|
||||
UserMetricsRecorder::RecordUserClickOnTray(
|
||||
LoginMetricsRecorder::TrayClickTarget::kTrayActionNoteButton);
|
||||
if (event.IsKeyEvent()) {
|
||||
Shell::Get()->tray_action()->RequestNewLockScreenNote(
|
||||
mojom::LockScreenNoteOrigin::kLockScreenButtonKeyboard);
|
||||
} else {
|
||||
Shell::Get()->tray_action()->RequestNewLockScreenNote(
|
||||
mojom::LockScreenNoteOrigin::kLockScreenButtonTap);
|
||||
}
|
||||
}
|
||||
|
||||
// Called when a fling is detected - if the gesture direction was bottom-left,
|
||||
// it requests a new lock screen note.
|
||||
void MaybeActivateActionOnFling(ui::GestureEvent* event) {
|
||||
int adjust_x_for_rtl = base::i18n::IsRTL() ? -1 : 1;
|
||||
if (!tracking_activation_gesture_ || event->details().touch_points() != 1 ||
|
||||
adjust_x_for_rtl * event->details().velocity_x() > 0 ||
|
||||
event->details().velocity_y() < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Shell::Get()->tray_action()->RequestNewLockScreenNote(
|
||||
mojom::LockScreenNoteOrigin::kLockScreenButtonSwipe);
|
||||
}
|
||||
|
||||
// Sets a flag indicating that the button is tracking a potential note
|
||||
// activation gesture, updating the background view appearance (as the
|
||||
// background bubble should be expanded if a gesture is tracked.
|
||||
void SetTrackingPotentialActivationGesture(bool tracking_activation_gesture) {
|
||||
tracking_activation_gesture_ = tracking_activation_gesture;
|
||||
UpdateBubbleRadiusAndOpacity();
|
||||
}
|
||||
|
||||
// The background view, which paints the note action bubble.
|
||||
raw_ptr<NoteActionLaunchButton::BackgroundView, DanglingUntriaged>
|
||||
background_;
|
||||
|
||||
BubbleTargeterDelegate event_targeter_delegate_;
|
||||
|
||||
// Set when a potention note activation gesture is tracked - i.e. while a
|
||||
// scroll gesture (which could lead to a fling) is in progress.
|
||||
bool tracking_activation_gesture_ = false;
|
||||
};
|
||||
|
||||
BEGIN_METADATA(NoteActionLaunchButton, ActionButton)
|
||||
END_METADATA
|
||||
|
||||
NoteActionLaunchButton::TestApi::TestApi(NoteActionLaunchButton* launch_button)
|
||||
: launch_button_(launch_button) {}
|
||||
|
||||
NoteActionLaunchButton::TestApi::~TestApi() = default;
|
||||
|
||||
const views::View* NoteActionLaunchButton::TestApi::ActionButtonView() const {
|
||||
return launch_button_->action_button_;
|
||||
}
|
||||
|
||||
const views::View* NoteActionLaunchButton::TestApi::BackgroundView() const {
|
||||
return launch_button_->background_;
|
||||
}
|
||||
|
||||
NoteActionLaunchButton::NoteActionLaunchButton(
|
||||
mojom::TrayActionState initial_note_action_state) {
|
||||
SetLayoutManager(std::make_unique<views::FillLayout>());
|
||||
|
||||
background_ = new BackgroundView();
|
||||
AddChildView(background_.get());
|
||||
|
||||
action_button_ = new ActionButton(background_);
|
||||
AddChildView(action_button_.get());
|
||||
|
||||
UpdateVisibility(initial_note_action_state);
|
||||
}
|
||||
|
||||
NoteActionLaunchButton::~NoteActionLaunchButton() = default;
|
||||
|
||||
void NoteActionLaunchButton::UpdateVisibility(
|
||||
mojom::TrayActionState action_state) {
|
||||
SetVisible(action_state == mojom::TrayActionState::kAvailable);
|
||||
}
|
||||
|
||||
BEGIN_METADATA(NoteActionLaunchButton)
|
||||
END_METADATA
|
||||
|
||||
} // namespace ash
|
@ -1,78 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_LOGIN_UI_NOTE_ACTION_LAUNCH_BUTTON_H_
|
||||
#define ASH_LOGIN_UI_NOTE_ACTION_LAUNCH_BUTTON_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/login/ui/non_accessible_view.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/tray_action/tray_action_observer.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace mojom {
|
||||
enum class TrayActionState;
|
||||
}
|
||||
|
||||
// View for lock sreen UI element for launching note taking action handler app.
|
||||
// The element is an image button with a semi-transparent bubble background,
|
||||
// which is expanded upon hovering/focusing the element.
|
||||
// The bubble is a quarter of a circle with the center in top right corner of
|
||||
// the view (in LTR layout).
|
||||
// The button is only visible if the lock screen note taking action is available
|
||||
// (the view observes the action availability using login data dispatcher, and
|
||||
// updates itself accordingly).
|
||||
class ASH_EXPORT NoteActionLaunchButton : public NonAccessibleView {
|
||||
METADATA_HEADER(NoteActionLaunchButton, NonAccessibleView)
|
||||
|
||||
public:
|
||||
// Used by tests to get internal implementation details.
|
||||
class ASH_EXPORT TestApi {
|
||||
public:
|
||||
explicit TestApi(NoteActionLaunchButton* launch_button);
|
||||
|
||||
TestApi(const TestApi&) = delete;
|
||||
TestApi& operator=(const TestApi&) = delete;
|
||||
|
||||
~TestApi();
|
||||
|
||||
// Gets the foreground, action image button view.
|
||||
const views::View* ActionButtonView() const;
|
||||
|
||||
// Gets the background view.
|
||||
const views::View* BackgroundView() const;
|
||||
|
||||
private:
|
||||
raw_ptr<NoteActionLaunchButton> launch_button_;
|
||||
};
|
||||
|
||||
explicit NoteActionLaunchButton(
|
||||
mojom::TrayActionState initial_note_action_state);
|
||||
|
||||
NoteActionLaunchButton(const NoteActionLaunchButton&) = delete;
|
||||
NoteActionLaunchButton& operator=(const NoteActionLaunchButton&) = delete;
|
||||
|
||||
~NoteActionLaunchButton() override;
|
||||
|
||||
// Updates the bubble visibility depending on the note taking action state.
|
||||
void UpdateVisibility(mojom::TrayActionState action_state);
|
||||
|
||||
private:
|
||||
class BackgroundView;
|
||||
class ActionButton;
|
||||
|
||||
// The background bubble view.
|
||||
raw_ptr<BackgroundView> background_ = nullptr;
|
||||
|
||||
// The actionable image button view.
|
||||
raw_ptr<ActionButton> action_button_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_LOGIN_UI_NOTE_ACTION_LAUNCH_BUTTON_H_
|
@ -70,11 +70,6 @@ const ShelfButtonClickMapping kShelfTargets[] = {
|
||||
LoginMetricsRecorder::LockScreenUserClickTarget::kTargetCount,
|
||||
LoginMetricsRecorder::LoginScreenUserClickTarget::kAddUserButton,
|
||||
LoginMetricsRecorder::OobeUserClickTarget::kTargetCount},
|
||||
// |kCloseNoteButton|
|
||||
{LoginMetricsRecorder::ShelfButtonClickTarget::kCloseNoteButton,
|
||||
LoginMetricsRecorder::LockScreenUserClickTarget::kCloseNoteButton,
|
||||
LoginMetricsRecorder::LoginScreenUserClickTarget::kTargetCount,
|
||||
LoginMetricsRecorder::OobeUserClickTarget::kTargetCount},
|
||||
// |kParentAccessButton|
|
||||
{LoginMetricsRecorder::ShelfButtonClickTarget::kParentAccessButton,
|
||||
LoginMetricsRecorder::LockScreenUserClickTarget::kParentAccessButton,
|
||||
@ -133,11 +128,6 @@ const TrayClickMapping kTrayTargets[] = {
|
||||
LoginMetricsRecorder::LockScreenUserClickTarget::kNotificationTray,
|
||||
LoginMetricsRecorder::LoginScreenUserClickTarget::kTargetCount,
|
||||
LoginMetricsRecorder::OobeUserClickTarget::kTargetCount},
|
||||
// |kTrayActionNoteButton|
|
||||
{LoginMetricsRecorder::TrayClickTarget::kTrayActionNoteButton,
|
||||
LoginMetricsRecorder::LockScreenUserClickTarget::kTrayActionNoteButton,
|
||||
LoginMetricsRecorder::LoginScreenUserClickTarget::kTargetCount,
|
||||
LoginMetricsRecorder::OobeUserClickTarget::kTargetCount},
|
||||
};
|
||||
|
||||
bool ShouldRecordMetrics() {
|
||||
|
@ -21,12 +21,10 @@ class ASH_EXPORT LoginMetricsRecorder {
|
||||
kShutDownButton = 0,
|
||||
kRestartButton,
|
||||
kSignOutButton,
|
||||
kCloseNoteButton,
|
||||
kSystemTray,
|
||||
kVirtualKeyboardTray,
|
||||
kImeTray,
|
||||
kNotificationTray,
|
||||
kTrayActionNoteButton,
|
||||
kParentAccessButton,
|
||||
kTargetCount,
|
||||
};
|
||||
@ -67,7 +65,6 @@ class ASH_EXPORT LoginMetricsRecorder {
|
||||
kVirtualKeyboardTray,
|
||||
kImeTray,
|
||||
kNotificationTray,
|
||||
kTrayActionNoteButton,
|
||||
kTargetCount,
|
||||
};
|
||||
|
||||
@ -79,7 +76,6 @@ class ASH_EXPORT LoginMetricsRecorder {
|
||||
kSignOutButton,
|
||||
kBrowseAsGuestButton,
|
||||
kAddUserButton,
|
||||
kCloseNoteButton,
|
||||
kCancelButton,
|
||||
kParentAccessButton,
|
||||
kEnterpriseEnrollmentButton,
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define ASH_PUBLIC_ASH_INTERFACES_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "chromeos/crosapi/mojom/cros_display_config.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
|
||||
@ -17,8 +16,6 @@ namespace ash {
|
||||
ASH_EXPORT void BindCrosDisplayConfigController(
|
||||
mojo::PendingReceiver<crosapi::mojom::CrosDisplayConfigController>
|
||||
receiver);
|
||||
ASH_EXPORT
|
||||
void BindTrayAction(mojo::PendingReceiver<mojom::TrayAction> receiver);
|
||||
|
||||
} // namespace ash
|
||||
|
||||
|
@ -83,14 +83,6 @@ class ASH_PUBLIC_EXPORT LoginScreenClient {
|
||||
// User with |account_id| has reached maximum incorrect password attempts.
|
||||
virtual void OnMaxIncorrectPasswordAttempted(const AccountId& account_id) = 0;
|
||||
|
||||
// Should pass the focus to the active lock screen app window, if there is
|
||||
// one. This is called when a lock screen app is reported to be active (using
|
||||
// tray_action mojo interface), and is next in the tab order.
|
||||
// |HandleFocusLeavingLockScreenApps| should be called to return focus to the
|
||||
// lock screen.
|
||||
// |reverse|: Whether the tab order is reversed.
|
||||
virtual void FocusLockScreenApps(bool reverse) = 0;
|
||||
|
||||
// Passes focus to the OOBE dialog if it is showing. No-op otherwise.
|
||||
virtual void FocusOobeDialog() = 0;
|
||||
|
||||
|
@ -168,11 +168,6 @@ class ASH_PUBLIC_EXPORT LoginScreenModel {
|
||||
virtual void SetPublicSessionShowFullManagementDisclosure(
|
||||
bool show_full_management_disclosure) = 0;
|
||||
|
||||
// Called when focus is reported to be leaving a lock screen app window.
|
||||
// Requests focus to be handed off to the next suitable widget.
|
||||
// |reverse|: Whether the tab order is reversed.
|
||||
virtual void HandleFocusLeavingLockScreenApps(bool reverse) = 0;
|
||||
|
||||
// Called when the dialog hosting oobe has changed state. The oobe dialog
|
||||
// provides support for any part of login that is implemented in JS/HTML, such
|
||||
// as add user or powerwash.
|
||||
|
@ -10,10 +10,7 @@ assert(is_chromeos_ash)
|
||||
mojom("mojom") {
|
||||
disable_variants = true
|
||||
|
||||
sources = [
|
||||
"assistant_volume_control.mojom",
|
||||
"tray_action.mojom",
|
||||
]
|
||||
sources = [ "assistant_volume_control.mojom" ]
|
||||
|
||||
public_deps = [
|
||||
":accelerator_actions",
|
||||
|
@ -1,96 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
module ash.mojom;
|
||||
|
||||
// An action handler state.
|
||||
enum TrayActionState {
|
||||
// The action cannot be handled - due to no client being set, the client not
|
||||
// supporting the action, user session not being locked etc.
|
||||
kNotAvailable,
|
||||
|
||||
// The client supports the action and is not currently handling the action.
|
||||
kAvailable,
|
||||
|
||||
// The client received the request for the action and it is launching the
|
||||
// flow to handle it.
|
||||
kLaunching,
|
||||
|
||||
// The client is currently handling the action.
|
||||
kActive,
|
||||
};
|
||||
|
||||
// The user action that triggered a request for a new note.
|
||||
enum LockScreenNoteOrigin {
|
||||
// The note request originated from the new note button in the system
|
||||
// tray - note that this UI element is deprecated.
|
||||
kTrayAction,
|
||||
|
||||
// The user tapped the note action button shown on the lock screen.
|
||||
kLockScreenButtonTap,
|
||||
|
||||
// The user swiped from the note action button shown on the lock screen.
|
||||
kLockScreenButtonSwipe,
|
||||
|
||||
// The user activated the lock screen button shown on the lock screen using
|
||||
// the keyboard.
|
||||
kLockScreenButtonKeyboard,
|
||||
|
||||
// The user ejected the stylus tool from the device.
|
||||
kStylusEject,
|
||||
};
|
||||
|
||||
// Reason for closing a lock screen note, and consequentially closing any
|
||||
// existing note handler app windows.
|
||||
enum CloseLockScreenNoteReason {
|
||||
// The user session was unlocked.
|
||||
kSessionUnlock,
|
||||
|
||||
// The user session was shut down (e.g. due to user sign-out).
|
||||
kShutdown,
|
||||
|
||||
// The user display was completely dimmed (e.g. due to user inactivity).
|
||||
kScreenDimmed,
|
||||
|
||||
// Device suspended.
|
||||
kSuspend,
|
||||
|
||||
// The app window associated with the note was closed by the app.
|
||||
kAppWindowClosed,
|
||||
|
||||
// The note taking app's support for the lock screen note taking was disabled
|
||||
// (e.g. because of a policy update).
|
||||
kAppLockScreenSupportDisabled,
|
||||
|
||||
// The user pressed "Unlock" button on the lock screen UI.
|
||||
kUnlockButtonPressed,
|
||||
};
|
||||
|
||||
// Used by a client (e.g. Chrome) to set up a handler for a tray action, and
|
||||
// notify ash on the action handler's state changes. A tray action is one of
|
||||
// predefined actions (currently only the "new note on lock screen" action is
|
||||
// supported) that appear as an ash status area button if the client declares
|
||||
// the action as available. Clicking the button invokes a client method that
|
||||
// requests the action associated with the button to be handled.
|
||||
interface TrayAction {
|
||||
// Sets the client to be used to handle action requests.
|
||||
// |lock_screen_note_state|: The current lock screen note action state
|
||||
// associated with the client.
|
||||
SetClient(pending_remote<TrayActionClient> client,
|
||||
TrayActionState lock_screen_note_state);
|
||||
|
||||
// Updates action state for the lock screen note action. If called with no
|
||||
// client set, the state change will not take effect until a client is set.
|
||||
// Null client is equivalent to kNotAvailable state.
|
||||
UpdateLockScreenNoteState(TrayActionState state);
|
||||
};
|
||||
|
||||
// Used by ash to request Chrome to handle an action.
|
||||
interface TrayActionClient {
|
||||
// Requests a lock screen note action to be handled.
|
||||
RequestNewLockScreenNote(LockScreenNoteOrigin origin);
|
||||
|
||||
// Closes lock screen note.
|
||||
CloseLockScreenNote(CloseLockScreenNoteReason reason);
|
||||
};
|
@ -25,7 +25,6 @@
|
||||
#include "ash/keyboard/ui/keyboard_layout_manager.h"
|
||||
#include "ash/keyboard/ui/keyboard_ui_controller.h"
|
||||
#include "ash/keyboard/virtual_keyboard_container_layout_manager.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
#include "ash/login_status.h"
|
||||
#include "ash/public/cpp/app_menu_constants.h"
|
||||
#include "ash/public/cpp/shell_window_ids.h"
|
||||
@ -56,7 +55,6 @@
|
||||
#include "ash/wm/desks/desks_util.h"
|
||||
#include "ash/wm/float/float_controller.h"
|
||||
#include "ash/wm/fullscreen_window_finder.h"
|
||||
#include "ash/wm/lock_action_handler_layout_manager.h"
|
||||
#include "ash/wm/lock_layout_manager.h"
|
||||
#include "ash/wm/mru_window_tracker.h"
|
||||
#include "ash/wm/overlay_layout_manager.h"
|
||||
@ -243,7 +241,6 @@ void ReparentAllWindows(aura::Window* src, aura::Window* dst) {
|
||||
kShellWindowId_FloatContainer,
|
||||
kShellWindowId_PipContainer,
|
||||
kShellWindowId_SystemModalContainer,
|
||||
kShellWindowId_LockActionHandlerContainer,
|
||||
kShellWindowId_LockSystemModalContainer,
|
||||
kShellWindowId_MenuContainer,
|
||||
kShellWindowId_LiveCaptionContainer,
|
||||
@ -721,7 +718,6 @@ void RootWindowController::Shutdown(aura::Window* destination_root) {
|
||||
}
|
||||
window_parenting_controller_.reset();
|
||||
security_curtain_widget_controller_.reset();
|
||||
lock_screen_action_background_controller_.reset();
|
||||
aura::client::SetScreenPositionClient(root_window, nullptr);
|
||||
|
||||
// The targeter may still on the stack, so delete it later.
|
||||
@ -967,8 +963,6 @@ RootWindowController::RootWindowController(AshWindowTreeHost* ash_host)
|
||||
: ash_host_(ash_host),
|
||||
window_tree_host_(ash_host->AsWindowTreeHost()),
|
||||
shelf_(std::make_unique<Shelf>()),
|
||||
lock_screen_action_background_controller_(
|
||||
LockScreenActionBackgroundController::Create()),
|
||||
work_area_insets_(std::make_unique<WorkAreaInsets>(this)) {
|
||||
DCHECK(ash_host_);
|
||||
DCHECK(window_tree_host_);
|
||||
@ -1090,16 +1084,6 @@ void RootWindowController::InitLayoutManagers(
|
||||
std::make_unique<SystemModalContainerLayoutManager>(
|
||||
lock_modal_container));
|
||||
|
||||
aura::Window* lock_action_handler_container =
|
||||
GetContainer(kShellWindowId_LockActionHandlerContainer);
|
||||
DCHECK(lock_action_handler_container);
|
||||
lock_screen_action_background_controller_->SetParentWindow(
|
||||
lock_action_handler_container);
|
||||
lock_action_handler_container->SetLayoutManager(
|
||||
std::make_unique<LockActionHandlerLayoutManager>(
|
||||
lock_action_handler_container,
|
||||
lock_screen_action_background_controller_.get()));
|
||||
|
||||
aura::Window* lock_container =
|
||||
GetContainer(kShellWindowId_LockScreenContainer);
|
||||
DCHECK(lock_container);
|
||||
@ -1275,13 +1259,6 @@ void RootWindowController::CreateContainers() {
|
||||
lock_screen_containers);
|
||||
lock_container->SetProperty(::wm::kUsesScreenCoordinatesKey, true);
|
||||
|
||||
aura::Window* lock_action_handler_container =
|
||||
CreateContainer(kShellWindowId_LockActionHandlerContainer,
|
||||
"LockActionHandlerContainer", lock_screen_containers);
|
||||
::wm::SetChildWindowVisibilityChangesAnimated(lock_action_handler_container);
|
||||
lock_action_handler_container->SetProperty(::wm::kUsesScreenCoordinatesKey,
|
||||
true);
|
||||
|
||||
aura::Window* lock_modal_container =
|
||||
CreateContainer(kShellWindowId_LockSystemModalContainer,
|
||||
"LockSystemModalContainer", lock_screen_containers);
|
||||
|
@ -45,7 +45,6 @@ class AccessibilityPanelLayoutManager;
|
||||
class AlwaysOnTopController;
|
||||
class AppMenuModelAdapter;
|
||||
class AshWindowTreeHost;
|
||||
class LockScreenActionBackgroundController;
|
||||
class RootWindowLayoutManager;
|
||||
class ScreenRotationAnimator;
|
||||
class Shelf;
|
||||
@ -191,11 +190,6 @@ class ASH_EXPORT RootWindowController {
|
||||
return wallpaper_widget_controller_.get();
|
||||
}
|
||||
|
||||
LockScreenActionBackgroundController*
|
||||
lock_screen_action_background_controller() {
|
||||
return lock_screen_action_background_controller_.get();
|
||||
}
|
||||
|
||||
AshColorProviderSource* color_provider_source() {
|
||||
return color_provider_source_.get();
|
||||
}
|
||||
@ -358,9 +352,6 @@ class ASH_EXPORT RootWindowController {
|
||||
|
||||
std::unique_ptr<::wm::ScopedCaptureClient> capture_client_;
|
||||
|
||||
std::unique_ptr<LockScreenActionBackgroundController>
|
||||
lock_screen_action_background_controller_;
|
||||
|
||||
std::unique_ptr<views::Widget> ambient_widget_;
|
||||
|
||||
std::unique_ptr<curtain::SecurityCurtainWidgetController>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "ash/constants/ash_features.h"
|
||||
#include "ash/constants/ash_switches.h"
|
||||
#include "ash/focus_cycler.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_state.h"
|
||||
#include "ash/login/login_screen_controller.h"
|
||||
#include "ash/login/ui/lock_screen.h"
|
||||
#include "ash/metrics/login_metrics_recorder.h"
|
||||
@ -90,7 +89,6 @@ constexpr LoginShelfView::ButtonId kButtonIds[] = {
|
||||
LoginShelfView::kShutdown,
|
||||
LoginShelfView::kRestart,
|
||||
LoginShelfView::kSignOut,
|
||||
LoginShelfView::kCloseNote,
|
||||
LoginShelfView::kCancel,
|
||||
LoginShelfView::kParentAccess,
|
||||
LoginShelfView::kBrowseAsGuest,
|
||||
@ -109,8 +107,6 @@ LoginMetricsRecorder::ShelfButtonClickTarget GetUserClickTarget(int button_id) {
|
||||
return LoginMetricsRecorder::ShelfButtonClickTarget::kRestartButton;
|
||||
case LoginShelfView::kSignOut:
|
||||
return LoginMetricsRecorder::ShelfButtonClickTarget::kSignOutButton;
|
||||
case LoginShelfView::kCloseNote:
|
||||
return LoginMetricsRecorder::ShelfButtonClickTarget::kCloseNoteButton;
|
||||
case LoginShelfView::kBrowseAsGuest:
|
||||
return LoginMetricsRecorder::ShelfButtonClickTarget::kBrowseAsGuestButton;
|
||||
case LoginShelfView::kAddUser:
|
||||
@ -235,9 +231,7 @@ void LoginShelfView::RequestShutdown() {
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
LoginShelfView::LoginShelfView(
|
||||
LockScreenActionBackgroundController* lock_screen_action_background)
|
||||
: lock_screen_action_background_(lock_screen_action_background) {
|
||||
LoginShelfView::LoginShelfView() {
|
||||
ShelfConfig::Get()->AddObserver(this);
|
||||
// We reuse the focusable state on this view as a signal that focus should
|
||||
// switch to the lock screen or status area. This view should otherwise not
|
||||
@ -304,12 +298,6 @@ LoginShelfView::LoginShelfView(
|
||||
login_shelf_buttons_.push_back(
|
||||
static_cast<LoginShelfButton*>(kiosk_apps_button_));
|
||||
|
||||
add_button(kCloseNote,
|
||||
base::BindRepeating(
|
||||
&TrayAction::CloseLockScreenNote,
|
||||
base::Unretained(Shell::Get()->tray_action()),
|
||||
mojom::CloseLockScreenNoteReason::kUnlockButtonPressed),
|
||||
IDS_ASH_SHELF_UNLOCK_BUTTON, kShelfUnlockButtonIcon);
|
||||
add_button(kCancel,
|
||||
base::BindRepeating(
|
||||
[](LoginShelfView* shelf) {
|
||||
@ -372,10 +360,7 @@ LoginShelfView::LoginShelfView(
|
||||
IDS_ASH_SHELF_OS_INSTALL_BUTTON, kShelfOsInstallButtonIcon);
|
||||
|
||||
// Adds observers for states that affect the visibility of different buttons.
|
||||
tray_action_observation_.Observe(Shell::Get()->tray_action());
|
||||
shutdown_controller_observation_.Observe(Shell::Get()->shutdown_controller());
|
||||
lock_screen_action_background_observation_.Observe(
|
||||
lock_screen_action_background);
|
||||
login_data_dispatcher_observation_.Observe(
|
||||
Shell::Get()->login_screen_controller()->data_dispatcher());
|
||||
enterprise_domain_model_observation_.Observe(
|
||||
@ -570,16 +555,6 @@ LoginShelfView::GetScopedGuestButtonBlocker() {
|
||||
weak_ptr_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
void LoginShelfView::OnLockScreenNoteStateChanged(
|
||||
mojom::TrayActionState state) {
|
||||
UpdateUi();
|
||||
}
|
||||
|
||||
void LoginShelfView::OnLockScreenActionBackgroundStateChanged(
|
||||
LockScreenActionBackgroundState state) {
|
||||
UpdateUi();
|
||||
}
|
||||
|
||||
void LoginShelfView::OnShutdownPolicyChanged(bool reboot_on_shutdown) {
|
||||
UpdateUi();
|
||||
}
|
||||
@ -621,13 +596,6 @@ LoginShelfView::GetShutdownConfirmationBubbleForTesting() {
|
||||
return test_shutdown_confirmation_bubble_;
|
||||
}
|
||||
|
||||
bool LoginShelfView::LockScreenActionBackgroundAnimating() const {
|
||||
return lock_screen_action_background_->state() ==
|
||||
LockScreenActionBackgroundState::kShowing ||
|
||||
lock_screen_action_background_->state() ==
|
||||
LockScreenActionBackgroundState::kHiding;
|
||||
}
|
||||
|
||||
void LoginShelfView::SetButtonVisible(ButtonId button_id, bool visible) {
|
||||
GetButtonContainerByID(button_id)->SetVisible(visible);
|
||||
GetViewByID(button_id)->SetVisible(visible);
|
||||
@ -656,23 +624,14 @@ void LoginShelfView::UpdateUi() {
|
||||
|
||||
const gfx::Size old_preferred_size = GetPreferredSize();
|
||||
bool show_reboot = Shell::Get()->shutdown_controller()->reboot_on_shutdown();
|
||||
mojom::TrayActionState tray_action_state =
|
||||
Shell::Get()->tray_action()->GetLockScreenNoteState();
|
||||
bool is_locked = (session_state == SessionState::LOCKED);
|
||||
bool is_lock_screen_note_in_foreground =
|
||||
(tray_action_state == mojom::TrayActionState::kActive ||
|
||||
tray_action_state == mojom::TrayActionState::kLaunching) &&
|
||||
!LockScreenActionBackgroundAnimating();
|
||||
|
||||
SetButtonVisible(kShutdown, !show_reboot &&
|
||||
!is_lock_screen_note_in_foreground &&
|
||||
ShouldShowShutdownButton());
|
||||
|
||||
SetButtonVisible(kRestart, show_reboot &&
|
||||
!is_lock_screen_note_in_foreground &&
|
||||
ShouldShowShutdownButton());
|
||||
SetButtonVisible(kSignOut, is_locked && !is_lock_screen_note_in_foreground);
|
||||
SetButtonVisible(kCloseNote, is_locked && is_lock_screen_note_in_foreground);
|
||||
SetButtonVisible(kSignOut, is_locked);
|
||||
SetButtonVisible(kCancel, session_state == SessionState::LOGIN_SECONDARY);
|
||||
SetButtonVisible(kParentAccess, is_locked && show_parent_access_);
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_observer.h"
|
||||
#include "ash/login/ui/lock_screen.h"
|
||||
#include "ash/login/ui/login_data_dispatcher.h"
|
||||
#include "ash/public/cpp/kiosk_app_menu.h"
|
||||
@ -23,8 +21,6 @@
|
||||
#include "ash/shutdown_controller_impl.h"
|
||||
#include "ash/system/enterprise/enterprise_domain_observer.h"
|
||||
#include "ash/system/model/enterprise_domain_model.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/tray_action/tray_action_observer.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/scoped_observation.h"
|
||||
@ -43,8 +39,6 @@ enum class SessionState;
|
||||
|
||||
namespace ash {
|
||||
|
||||
enum class LockScreenActionBackgroundState;
|
||||
|
||||
class LoginShelfButton;
|
||||
class KioskAppsButton;
|
||||
class TrayBackgroundView;
|
||||
@ -52,8 +46,6 @@ class TrayBackgroundView;
|
||||
// LoginShelfView contains the shelf buttons visible outside of an active user
|
||||
// session. ShelfView and LoginShelfView should never be shown together.
|
||||
class ASH_EXPORT LoginShelfView : public views::View,
|
||||
public TrayActionObserver,
|
||||
public LockScreenActionBackgroundObserver,
|
||||
public ShutdownControllerImpl::Observer,
|
||||
public LoginDataDispatcher::Observer,
|
||||
public EnterpriseDomainObserver,
|
||||
@ -65,7 +57,6 @@ class ASH_EXPORT LoginShelfView : public views::View,
|
||||
kShutdown = 1, // Shut down the device.
|
||||
kRestart, // Restart the device.
|
||||
kSignOut, // Sign out the active user session.
|
||||
kCloseNote, // Close the lock screen note.
|
||||
kCancel, // Cancel multiple user sign-in.
|
||||
kBrowseAsGuest, // Use in guest mode.
|
||||
kAddUser, // Add a new user.
|
||||
@ -84,8 +75,7 @@ class ASH_EXPORT LoginShelfView : public views::View,
|
||||
virtual void OnUiUpdate() = 0;
|
||||
};
|
||||
|
||||
explicit LoginShelfView(
|
||||
LockScreenActionBackgroundController* lock_screen_action_background);
|
||||
LoginShelfView();
|
||||
|
||||
LoginShelfView(const LoginShelfView&) = delete;
|
||||
LoginShelfView& operator=(const LoginShelfView&) = delete;
|
||||
@ -162,13 +152,6 @@ class ASH_EXPORT LoginShelfView : public views::View,
|
||||
// Returns the button container.
|
||||
views::View* GetButtonContainerByID(ButtonId button_id);
|
||||
|
||||
// TrayActionObserver:
|
||||
void OnLockScreenNoteStateChanged(mojom::TrayActionState state) override;
|
||||
|
||||
// LockScreenActionBackgroundObserver:
|
||||
void OnLockScreenActionBackgroundStateChanged(
|
||||
LockScreenActionBackgroundState state) override;
|
||||
|
||||
// ShutdownControllerImpl::Observer:
|
||||
void OnShutdownPolicyChanged(bool reboot_on_shutdown) override;
|
||||
|
||||
@ -195,8 +178,6 @@ class ASH_EXPORT LoginShelfView : public views::View,
|
||||
private:
|
||||
class ScopedGuestButtonBlockerImpl;
|
||||
|
||||
bool LockScreenActionBackgroundAnimating() const;
|
||||
|
||||
// Updates the visibility of buttons based on state changes, e.g. shutdown
|
||||
// policy updates, session state changes etc.
|
||||
void UpdateUi();
|
||||
@ -261,15 +242,6 @@ class ASH_EXPORT LoginShelfView : public views::View,
|
||||
// appear if there are no user views.
|
||||
bool login_screen_has_users_ = false;
|
||||
|
||||
raw_ptr<LockScreenActionBackgroundController> lock_screen_action_background_;
|
||||
|
||||
base::ScopedObservation<TrayAction, TrayActionObserver>
|
||||
tray_action_observation_{this};
|
||||
|
||||
base::ScopedObservation<LockScreenActionBackgroundController,
|
||||
LockScreenActionBackgroundObserver>
|
||||
lock_screen_action_background_observation_{this};
|
||||
|
||||
base::ScopedObservation<ShutdownControllerImpl,
|
||||
ShutdownControllerImpl::Observer>
|
||||
shutdown_controller_observation_{this};
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include "ash/app_list/app_list_controller_impl.h"
|
||||
#include "ash/constants/ash_switches.h"
|
||||
#include "ash/focus_cycler.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
#include "ash/lock_screen_action/test_lock_screen_action_background_controller.h"
|
||||
#include "ash/login/login_screen_controller.h"
|
||||
#include "ash/login/mock_login_screen_client.h"
|
||||
#include "ash/login/ui/login_test_base.h"
|
||||
@ -33,7 +31,6 @@
|
||||
#include "ash/system/status_area_widget.h"
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "ash/test/ash_test_helper.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/wm/lock_state_controller.h"
|
||||
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
|
||||
#include "base/command_line.h"
|
||||
@ -85,12 +82,6 @@ class LoginShelfViewTest : public LoginTestBase {
|
||||
~LoginShelfViewTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
action_background_controller_factory_ = base::BindRepeating(
|
||||
&LoginShelfViewTest::CreateActionBackgroundController,
|
||||
base::Unretained(this));
|
||||
LockScreenActionBackgroundController::SetFactoryCallbackForTesting(
|
||||
&action_background_controller_factory_);
|
||||
|
||||
// Guest Button is visible while session hasn't started.
|
||||
LoginTestBase::SetUp();
|
||||
login_shelf_view_ = GetPrimaryShelf()->shelf_widget()->GetLoginShelfView();
|
||||
@ -99,12 +90,6 @@ class LoginShelfViewTest : public LoginTestBase {
|
||||
NotifyShutdownPolicyChanged(false);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
LockScreenActionBackgroundController::SetFactoryCallbackForTesting(nullptr);
|
||||
action_background_controller_ = nullptr;
|
||||
LoginTestBase::TearDown();
|
||||
}
|
||||
|
||||
protected:
|
||||
void NotifySessionStateChanged(SessionState state) {
|
||||
GetSessionControllerClient()->SetSessionState(state);
|
||||
@ -116,10 +101,6 @@ class LoginShelfViewTest : public LoginTestBase {
|
||||
reboot_on_shutdown);
|
||||
}
|
||||
|
||||
void NotifyLockScreenNoteStateChanged(mojom::TrayActionState state) {
|
||||
Shell::Get()->tray_action()->UpdateLockScreenNoteState(state);
|
||||
}
|
||||
|
||||
// Simulates a click event on the button.
|
||||
void Click(LoginShelfView::ButtonId id) {
|
||||
DCHECK(login_shelf_view_->GetViewByID(id)->GetVisible());
|
||||
@ -199,27 +180,6 @@ class LoginShelfViewTest : public LoginTestBase {
|
||||
|
||||
raw_ptr<LoginShelfView, DanglingUntriaged> login_shelf_view_ =
|
||||
nullptr; // Unowned.
|
||||
|
||||
TestLockScreenActionBackgroundController* action_background_controller() {
|
||||
return action_background_controller_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<LockScreenActionBackgroundController>
|
||||
CreateActionBackgroundController() {
|
||||
auto result = std::make_unique<TestLockScreenActionBackgroundController>();
|
||||
EXPECT_FALSE(action_background_controller_);
|
||||
action_background_controller_ = result.get();
|
||||
return result;
|
||||
}
|
||||
|
||||
LockScreenActionBackgroundController::FactoryCallback
|
||||
action_background_controller_factory_;
|
||||
|
||||
// LockScreenActionBackgroundController created by
|
||||
// |CreateActionBackgroundController|.
|
||||
raw_ptr<TestLockScreenActionBackgroundController>
|
||||
action_background_controller_ = nullptr;
|
||||
};
|
||||
|
||||
// Checks the login shelf updates UI after session state changes.
|
||||
|
@ -88,9 +88,8 @@ LoginShelfWidget::LoginShelfWidget(Shelf* shelf, aura::Window* container)
|
||||
delegate_(new LoginShelfWidgetDelegate(shelf)),
|
||||
scoped_session_observer_(this) {
|
||||
DCHECK(container);
|
||||
login_shelf_view_ = delegate_->AddChildView(std::make_unique<LoginShelfView>(
|
||||
RootWindowController::ForWindow(container)
|
||||
->lock_screen_action_background_controller()));
|
||||
login_shelf_view_ =
|
||||
delegate_->AddChildView(std::make_unique<LoginShelfView>());
|
||||
|
||||
views::Widget::InitParams params(
|
||||
views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET,
|
||||
|
@ -207,7 +207,6 @@
|
||||
#include "ash/system/video_conference/fake_video_conference_tray_controller.h"
|
||||
#include "ash/touch/ash_touch_transform_controller.h"
|
||||
#include "ash/touch/touch_devices_controller.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/user_education/user_education_controller.h"
|
||||
#include "ash/user_education/user_education_delegate.h"
|
||||
#include "ash/utility/occlusion_tracker_pauser.h"
|
||||
@ -1019,8 +1018,6 @@ Shell::~Shell() {
|
||||
toplevel_window_event_handler_.reset();
|
||||
visibility_controller_.reset();
|
||||
|
||||
tray_action_.reset();
|
||||
|
||||
power_button_controller_.reset();
|
||||
lock_state_controller_.reset();
|
||||
backlights_forced_off_setter_.reset();
|
||||
@ -1579,9 +1576,6 @@ void Shell::Init(
|
||||
|
||||
backlights_forced_off_setter_ = std::make_unique<BacklightsForcedOffSetter>();
|
||||
|
||||
tray_action_ =
|
||||
std::make_unique<TrayAction>(backlights_forced_off_setter_.get());
|
||||
|
||||
lock_state_controller_ = std::make_unique<LockStateController>(
|
||||
shutdown_controller_.get(), local_state_);
|
||||
power_button_controller_ = std::make_unique<PowerButtonController>(
|
||||
|
@ -269,7 +269,6 @@ class ToastManagerImpl;
|
||||
class ToplevelWindowEventHandler;
|
||||
class ClipboardHistoryControllerImpl;
|
||||
class TouchDevicesController;
|
||||
class TrayAction;
|
||||
class UserEducationController;
|
||||
class UserMetricsRecorder;
|
||||
class VideoActivityNotifier;
|
||||
@ -819,8 +818,6 @@ class ASH_EXPORT Shell : public SessionObserver,
|
||||
AshTouchTransformController* touch_transformer_controller() {
|
||||
return touch_transformer_controller_.get();
|
||||
}
|
||||
TrayAction* tray_action() { return tray_action_.get(); }
|
||||
|
||||
UserMetricsRecorder* metrics() { return user_metrics_recorder_.get(); }
|
||||
|
||||
VideoDetector* video_detector() { return video_detector_.get(); }
|
||||
@ -1161,7 +1158,6 @@ class ASH_EXPORT Shell : public SessionObserver,
|
||||
std::unique_ptr<ToastManagerImpl> toast_manager_;
|
||||
std::unique_ptr<ClipboardHistoryControllerImpl> clipboard_history_controller_;
|
||||
std::unique_ptr<TouchDevicesController> touch_devices_controller_;
|
||||
std::unique_ptr<TrayAction> tray_action_;
|
||||
std::unique_ptr<UserEducationController> user_education_controller_;
|
||||
std::unique_ptr<TabStripDelegate> tab_strip_delegate_;
|
||||
std::unique_ptr<WallpaperControllerImpl> wallpaper_controller_;
|
||||
|
@ -1,120 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "ash/lock_screen_action/lock_screen_note_display_state_handler.h"
|
||||
#include "ash/tray_action/tray_action_observer.h"
|
||||
#include "base/check.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "ui/events/devices/stylus_state.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
TrayAction::TrayAction(BacklightsForcedOffSetter* backlights_forced_off_setter)
|
||||
: backlights_forced_off_setter_(backlights_forced_off_setter) {
|
||||
stylus_observation_.Observe(ui::DeviceDataManager::GetInstance());
|
||||
}
|
||||
|
||||
TrayAction::~TrayAction() = default;
|
||||
|
||||
void TrayAction::AddObserver(TrayActionObserver* observer) {
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void TrayAction::RemoveObserver(TrayActionObserver* observer) {
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void TrayAction::BindReceiver(
|
||||
mojo::PendingReceiver<mojom::TrayAction> receiver) {
|
||||
receivers_.Add(this, std::move(receiver));
|
||||
}
|
||||
|
||||
mojom::TrayActionState TrayAction::GetLockScreenNoteState() const {
|
||||
if (!tray_action_client_)
|
||||
return mojom::TrayActionState::kNotAvailable;
|
||||
return lock_screen_note_state_;
|
||||
}
|
||||
|
||||
bool TrayAction::IsLockScreenNoteActive() const {
|
||||
return GetLockScreenNoteState() == mojom::TrayActionState::kActive;
|
||||
}
|
||||
|
||||
void TrayAction::SetClient(
|
||||
mojo::PendingRemote<mojom::TrayActionClient> tray_action_client,
|
||||
mojom::TrayActionState lock_screen_note_state) {
|
||||
mojom::TrayActionState old_lock_screen_note_state = GetLockScreenNoteState();
|
||||
|
||||
if (tray_action_client) {
|
||||
tray_action_client_.Bind(std::move(tray_action_client));
|
||||
|
||||
// Makes sure the state is updated in case the connection is lost.
|
||||
tray_action_client_.set_disconnect_handler(base::BindOnce(
|
||||
&TrayAction::SetClient, base::Unretained(this), mojo::NullRemote(),
|
||||
mojom::TrayActionState::kNotAvailable));
|
||||
lock_screen_note_state_ = lock_screen_note_state;
|
||||
|
||||
lock_screen_note_display_state_handler_ =
|
||||
std::make_unique<LockScreenNoteDisplayStateHandler>(
|
||||
backlights_forced_off_setter_);
|
||||
} else {
|
||||
tray_action_client_.reset();
|
||||
lock_screen_note_display_state_handler_.reset();
|
||||
}
|
||||
|
||||
// Setting action handler value can change effective state - notify observers
|
||||
// if that was the case.
|
||||
if (GetLockScreenNoteState() != old_lock_screen_note_state)
|
||||
NotifyLockScreenNoteStateChanged();
|
||||
}
|
||||
|
||||
void TrayAction::UpdateLockScreenNoteState(mojom::TrayActionState state) {
|
||||
if (state == lock_screen_note_state_)
|
||||
return;
|
||||
|
||||
lock_screen_note_state_ = state;
|
||||
|
||||
if (lock_screen_note_state_ == mojom::TrayActionState::kNotAvailable)
|
||||
lock_screen_note_display_state_handler_->Reset();
|
||||
|
||||
// If the client is not set, the effective state has not changed, so no need
|
||||
// to notify observers of a state change.
|
||||
if (tray_action_client_)
|
||||
NotifyLockScreenNoteStateChanged();
|
||||
}
|
||||
|
||||
void TrayAction::RequestNewLockScreenNote(mojom::LockScreenNoteOrigin origin) {
|
||||
if (GetLockScreenNoteState() != mojom::TrayActionState::kAvailable)
|
||||
return;
|
||||
|
||||
// An action state can be kAvailable only if |tray_action_client_| is set.
|
||||
DCHECK(tray_action_client_);
|
||||
tray_action_client_->RequestNewLockScreenNote(origin);
|
||||
}
|
||||
|
||||
void TrayAction::CloseLockScreenNote(mojom::CloseLockScreenNoteReason reason) {
|
||||
if (tray_action_client_)
|
||||
tray_action_client_->CloseLockScreenNote(reason);
|
||||
}
|
||||
|
||||
void TrayAction::OnStylusStateChanged(ui::StylusState state) {
|
||||
if (state == ui::StylusState::REMOVED)
|
||||
lock_screen_note_display_state_handler_->AttemptNoteLaunchForStylusEject();
|
||||
}
|
||||
|
||||
void TrayAction::FlushMojoForTesting() {
|
||||
if (tray_action_client_)
|
||||
tray_action_client_.FlushForTesting();
|
||||
}
|
||||
|
||||
void TrayAction::NotifyLockScreenNoteStateChanged() {
|
||||
for (auto& observer : observers_)
|
||||
observer.OnLockScreenNoteStateChanged(GetLockScreenNoteState());
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,113 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_TRAY_ACTION_TRAY_ACTION_H_
|
||||
#define ASH_TRAY_ACTION_TRAY_ACTION_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/scoped_observation.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "mojo/public/cpp/bindings/receiver_set.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "ui/events/devices/device_data_manager.h"
|
||||
#include "ui/events/devices/input_device_event_observer.h"
|
||||
|
||||
namespace ui {
|
||||
enum class StylusState;
|
||||
} // namespace ui
|
||||
|
||||
namespace ash {
|
||||
|
||||
class BacklightsForcedOffSetter;
|
||||
class LockScreenNoteDisplayStateHandler;
|
||||
class TrayActionObserver;
|
||||
|
||||
// Controller that ash can use to request a predefined set of actions to be
|
||||
// performed by clients.
|
||||
// The controller provides an interface to:
|
||||
// * Send a request to the client to handle an action.
|
||||
// * Observe the state of support for an action as reported by the current ash
|
||||
// client.
|
||||
// Currently, only single action is supported - creating new note on the lock
|
||||
// screen - Chrome handles this action by launching an app (if any) that is
|
||||
// registered as a lock screen enabled action handler for the new note action.
|
||||
class ASH_EXPORT TrayAction : public mojom::TrayAction,
|
||||
public ui::InputDeviceEventObserver {
|
||||
public:
|
||||
explicit TrayAction(BacklightsForcedOffSetter* backlights_forced_off_setter);
|
||||
|
||||
TrayAction(const TrayAction&) = delete;
|
||||
TrayAction& operator=(const TrayAction&) = delete;
|
||||
|
||||
~TrayAction() override;
|
||||
|
||||
LockScreenNoteDisplayStateHandler*
|
||||
lock_screen_note_display_state_handler_for_test() {
|
||||
return lock_screen_note_display_state_handler_.get();
|
||||
}
|
||||
|
||||
void AddObserver(TrayActionObserver* observer);
|
||||
void RemoveObserver(TrayActionObserver* observer);
|
||||
|
||||
void BindReceiver(mojo::PendingReceiver<mojom::TrayAction> receiver);
|
||||
|
||||
// Gets last known handler state for the lock screen note action.
|
||||
// It will return kNotAvailable if an action handler has not been set using
|
||||
// |SetClient|.
|
||||
mojom::TrayActionState GetLockScreenNoteState() const;
|
||||
|
||||
// Helper method for determining if lock screen not action is in active state.
|
||||
bool IsLockScreenNoteActive() const;
|
||||
|
||||
// If the client is set, sends it a request to handle the lock screen note
|
||||
// action.
|
||||
void RequestNewLockScreenNote(mojom::LockScreenNoteOrigin origin);
|
||||
|
||||
// If the client is set, sends a request to close the lock screen note.
|
||||
void CloseLockScreenNote(mojom::CloseLockScreenNoteReason reason);
|
||||
|
||||
// mojom::TrayAction:
|
||||
void SetClient(mojo::PendingRemote<mojom::TrayActionClient> action_handler,
|
||||
mojom::TrayActionState lock_screen_note_state) override;
|
||||
void UpdateLockScreenNoteState(mojom::TrayActionState state) override;
|
||||
|
||||
// ui::InputDeviceEventObserver:
|
||||
void OnStylusStateChanged(ui::StylusState state) override;
|
||||
|
||||
void FlushMojoForTesting();
|
||||
|
||||
private:
|
||||
// Notifies the observers that state for the lock screen note action has been
|
||||
// updated.
|
||||
void NotifyLockScreenNoteStateChanged();
|
||||
|
||||
const raw_ptr<BacklightsForcedOffSetter> backlights_forced_off_setter_;
|
||||
|
||||
// Last known state for lock screen note action.
|
||||
mojom::TrayActionState lock_screen_note_state_ =
|
||||
mojom::TrayActionState::kNotAvailable;
|
||||
|
||||
std::unique_ptr<LockScreenNoteDisplayStateHandler>
|
||||
lock_screen_note_display_state_handler_;
|
||||
|
||||
base::ObserverList<TrayActionObserver>::Unchecked observers_;
|
||||
|
||||
// Receivers for users of the mojo interface.
|
||||
mojo::ReceiverSet<mojom::TrayAction> receivers_;
|
||||
|
||||
mojo::Remote<mojom::TrayActionClient> tray_action_client_;
|
||||
|
||||
base::ScopedObservation<ui::DeviceDataManager, ui::InputDeviceEventObserver>
|
||||
stylus_observation_{this};
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_TRAY_ACTION_TRAY_ACTION_H_
|
@ -1,23 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_TRAY_ACTION_TRAY_ACTION_OBSERVER_H_
|
||||
#define ASH_TRAY_ACTION_TRAY_ACTION_OBSERVER_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
class ASH_EXPORT TrayActionObserver {
|
||||
public:
|
||||
virtual ~TrayActionObserver() {}
|
||||
|
||||
// Called when action handler state changes.
|
||||
virtual void OnLockScreenNoteStateChanged(mojom::TrayActionState state) = 0;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_TRAY_ACTION_TRAY_ACTION_OBSERVER_H_
|
@ -8,7 +8,6 @@
|
||||
#include "ash/public/cpp/shell_window_ids.h"
|
||||
#include "ash/session/session_controller_impl.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ui/aura/window.h"
|
||||
|
||||
namespace ash {
|
||||
|
@ -1,139 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/wm/lock_action_handler_layout_manager.h"
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "ash/public/cpp/shell_window_ids.h"
|
||||
#include "ash/public/mojom/tray_action.mojom.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/wm/lock_window_state.h"
|
||||
#include "ash/wm/window_state.h"
|
||||
#include "ash/wm/window_util.h"
|
||||
#include "ash/wm/wm_event.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "ui/wm/core/window_animations.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
// Whether child windows should be shown depending on lock screen note action
|
||||
// state and lock screen action background state.
|
||||
// This should not be used for lock screen background windows.
|
||||
bool ShowChildWindows(mojom::TrayActionState action_state,
|
||||
LockScreenActionBackgroundState background_state) {
|
||||
return (action_state == mojom::TrayActionState::kActive ||
|
||||
action_state == mojom::TrayActionState::kLaunching) &&
|
||||
(background_state == LockScreenActionBackgroundState::kShown ||
|
||||
background_state == LockScreenActionBackgroundState::kHidden);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
LockActionHandlerLayoutManager::LockActionHandlerLayoutManager(
|
||||
aura::Window* window,
|
||||
LockScreenActionBackgroundController* action_background_controller)
|
||||
: LockLayoutManager(window),
|
||||
action_background_controller_(action_background_controller) {
|
||||
TrayAction* tray_action = Shell::Get()->tray_action();
|
||||
tray_action_observation_.Observe(tray_action);
|
||||
action_background_observation_.Observe(action_background_controller_.get());
|
||||
}
|
||||
|
||||
LockActionHandlerLayoutManager::~LockActionHandlerLayoutManager() = default;
|
||||
|
||||
void LockActionHandlerLayoutManager::OnWindowAddedToLayout(
|
||||
aura::Window* child) {
|
||||
wm::SetWindowVisibilityAnimationTransition(child, wm::ANIMATE_NONE);
|
||||
|
||||
// The lock action background should be shown behind the shelf (which is
|
||||
// transparent on the lock screen), unlike lock action handler windows.
|
||||
const bool shelf_excluded =
|
||||
!action_background_controller_->IsBackgroundWindow(child);
|
||||
WindowState* window_state =
|
||||
LockWindowState::SetLockWindowState(child, shelf_excluded);
|
||||
WMEvent event(WM_EVENT_ADDED_TO_WORKSPACE);
|
||||
window_state->OnWMEvent(&event);
|
||||
}
|
||||
|
||||
void LockActionHandlerLayoutManager::OnChildWindowVisibilityChanged(
|
||||
aura::Window* child,
|
||||
bool visible) {
|
||||
if (action_background_controller_->IsBackgroundWindow(child)) {
|
||||
window()->StackChildAtBottom(child);
|
||||
return;
|
||||
}
|
||||
|
||||
// Windows should be shown only in active state.
|
||||
if (visible &&
|
||||
!ShowChildWindows(Shell::Get()->tray_action()->GetLockScreenNoteState(),
|
||||
action_background_controller_->state())) {
|
||||
child->Hide();
|
||||
}
|
||||
}
|
||||
|
||||
void LockActionHandlerLayoutManager::OnLockScreenNoteStateChanged(
|
||||
mojom::TrayActionState state) {
|
||||
// Update the background controller state first.
|
||||
bool background_changed = false;
|
||||
switch (state) {
|
||||
case mojom::TrayActionState::kNotAvailable:
|
||||
background_changed =
|
||||
action_background_controller_->HideBackgroundImmediately();
|
||||
break;
|
||||
case mojom::TrayActionState::kAvailable:
|
||||
background_changed = action_background_controller_->HideBackground();
|
||||
break;
|
||||
case mojom::TrayActionState::kLaunching:
|
||||
case mojom::TrayActionState::kActive:
|
||||
background_changed = action_background_controller_->ShowBackground();
|
||||
break;
|
||||
}
|
||||
|
||||
// Given that background state changes invoke the background controller
|
||||
// observers (one of which is |this|), and |UpdateChildren| is called as part
|
||||
// of handling background state changes, the child windows state has alreday
|
||||
// been updated if |background_changed| is true - no need to do it again.
|
||||
if (background_changed)
|
||||
return;
|
||||
|
||||
UpdateChildren(state, action_background_controller_->state());
|
||||
}
|
||||
|
||||
void LockActionHandlerLayoutManager::OnLockScreenActionBackgroundStateChanged(
|
||||
LockScreenActionBackgroundState state) {
|
||||
UpdateChildren(Shell::Get()->tray_action()->GetLockScreenNoteState(), state);
|
||||
}
|
||||
|
||||
void LockActionHandlerLayoutManager::UpdateChildren(
|
||||
mojom::TrayActionState action_state,
|
||||
LockScreenActionBackgroundState background_state) {
|
||||
// Update children state:
|
||||
// * a child can be visible only in active state
|
||||
// * on transition to active state:
|
||||
// * show hidden windows, so children that were added when action was not
|
||||
// in active state are shown
|
||||
// * activate a container child to ensure the container gets focus when
|
||||
// moving from background state.
|
||||
bool show_children = ShowChildWindows(action_state, background_state);
|
||||
aura::Window* child_to_activate = nullptr;
|
||||
for (aura::Window* child : window()->children()) {
|
||||
if (action_background_controller_->IsBackgroundWindow(child))
|
||||
continue;
|
||||
if (show_children) {
|
||||
child->Show();
|
||||
child_to_activate = child;
|
||||
} else {
|
||||
child->Hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (child_to_activate)
|
||||
wm::ActivateWindow(child_to_activate);
|
||||
}
|
||||
|
||||
} // namespace ash
|
@ -1,81 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_WM_LOCK_ACTION_HANDLER_LAYOUT_MANAGER_H_
|
||||
#define ASH_WM_LOCK_ACTION_HANDLER_LAYOUT_MANAGER_H_
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_controller.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_observer.h"
|
||||
#include "ash/lock_screen_action/lock_screen_action_background_state.h"
|
||||
#include "ash/public/cpp/shelf_types.h"
|
||||
#include "ash/tray_action/tray_action.h"
|
||||
#include "ash/tray_action/tray_action_observer.h"
|
||||
#include "ash/wm/lock_layout_manager.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/scoped_observation.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
// Window layout manager for windows intended to handle lock tray actions.
|
||||
// Since "new note" is currently the only supported action, the layout
|
||||
// manager uses new note tray action state to determine it state.
|
||||
// The layout is intended to be used for LockActionHandlerContainer. The
|
||||
// container state depends on the lock screen "new_note" action state:
|
||||
// * for active action state - the windows should be visible above the lock
|
||||
// screen
|
||||
// * for rest of the states - the windows should not be visible.
|
||||
// The layout manager will observe new note action state changes and update
|
||||
// the container's children state as needed.
|
||||
// The windows in this container will have be maximized, if possible. If they
|
||||
// are not resizable, they will be centered on the screen - similar to windows
|
||||
// in lock screen container.
|
||||
// Unlike lock layout manager, when maximizing windows, this layout manager will
|
||||
// ensure that the windows do not obscure the system shelf.
|
||||
class ASH_EXPORT LockActionHandlerLayoutManager
|
||||
: public LockLayoutManager,
|
||||
public TrayActionObserver,
|
||||
public LockScreenActionBackgroundObserver {
|
||||
public:
|
||||
LockActionHandlerLayoutManager(
|
||||
aura::Window* window,
|
||||
LockScreenActionBackgroundController* action_background_controller);
|
||||
|
||||
LockActionHandlerLayoutManager(const LockActionHandlerLayoutManager&) =
|
||||
delete;
|
||||
LockActionHandlerLayoutManager& operator=(
|
||||
const LockActionHandlerLayoutManager&) = delete;
|
||||
|
||||
~LockActionHandlerLayoutManager() override;
|
||||
|
||||
// WmDefaultLayoutManager:
|
||||
void OnWindowAddedToLayout(aura::Window* child) override;
|
||||
void OnChildWindowVisibilityChanged(aura::Window* child,
|
||||
bool visibile) override;
|
||||
|
||||
// TrayActionObserver:
|
||||
void OnLockScreenNoteStateChanged(mojom::TrayActionState state) override;
|
||||
|
||||
// LockScreenActionBackgroundObserver:
|
||||
void OnLockScreenActionBackgroundStateChanged(
|
||||
LockScreenActionBackgroundState state) override;
|
||||
|
||||
private:
|
||||
// Updates the child window visibility depending on lock screen note action
|
||||
// state and the lock screen action background state.
|
||||
void UpdateChildren(mojom::TrayActionState action_state,
|
||||
LockScreenActionBackgroundState background_state);
|
||||
|
||||
raw_ptr<LockScreenActionBackgroundController> action_background_controller_;
|
||||
|
||||
base::ScopedObservation<TrayAction, TrayActionObserver>
|
||||
tray_action_observation_{this};
|
||||
base::ScopedObservation<LockScreenActionBackgroundController,
|
||||
LockScreenActionBackgroundObserver>
|
||||
action_background_observation_{this};
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_WM_LOCK_ACTION_HANDLER_LAYOUT_MANAGER_H_
|
@ -142,11 +142,6 @@ void ViewsScreenLocker::HandleOnFocusPod(const AccountId& account_id) {
|
||||
WallpaperControllerClientImpl::Get()->ShowUserWallpaper(account_id);
|
||||
}
|
||||
|
||||
bool ViewsScreenLocker::HandleFocusLockScreenApps(bool reverse) {
|
||||
// TODO(crbug.com/376354347): Remove this method.
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViewsScreenLocker::HandleFocusOobeDialog() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ class ViewsScreenLocker : public LoginScreenClientImpl::Delegate,
|
||||
const AccountId& account_id,
|
||||
base::OnceCallback<void(bool)> callback) override;
|
||||
void HandleOnFocusPod(const AccountId& account_id) override;
|
||||
bool HandleFocusLockScreenApps(bool reverse) override;
|
||||
void HandleFocusOobeDialog() override;
|
||||
void HandleLaunchPublicSession(const AccountId& account_id,
|
||||
const std::string& locale,
|
||||
|
@ -787,10 +787,6 @@ void LoginDisplayHostMojo::HandleOnFocusPod(const AccountId& account_id) {
|
||||
focused_pod_account_id_ = account_id;
|
||||
}
|
||||
|
||||
bool LoginDisplayHostMojo::HandleFocusLockScreenApps(bool reverse) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void LoginDisplayHostMojo::HandleFocusOobeDialog() {
|
||||
if (!dialog_->IsVisible()) {
|
||||
return;
|
||||
|
@ -123,7 +123,6 @@ class LoginDisplayHostMojo : public LoginDisplayHostCommon,
|
||||
const AccountId& account_id,
|
||||
base::OnceCallback<void(bool)> callback) override;
|
||||
void HandleOnFocusPod(const AccountId& account_id) override;
|
||||
bool HandleFocusLockScreenApps(bool reverse) override;
|
||||
void HandleFocusOobeDialog() override;
|
||||
void HandleLaunchPublicSession(const AccountId& account_id,
|
||||
const std::string& locale,
|
||||
|
@ -172,10 +172,6 @@ void LoginScreenClientImpl::OnFocusPod(const AccountId& account_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void LoginScreenClientImpl::FocusLockScreenApps(bool reverse) {
|
||||
// TODO(crbug.com/376354347): Remove this method.
|
||||
}
|
||||
|
||||
void LoginScreenClientImpl::FocusOobeDialog() {
|
||||
if (delegate_) {
|
||||
delegate_->HandleFocusOobeDialog();
|
||||
|
@ -50,7 +50,6 @@ class LoginScreenClientImpl : public ash::LoginScreenClient,
|
||||
// Handles request to focus a lock screen app window. Returns whether the
|
||||
// focus has been handed over to a lock screen app. For example, this might
|
||||
// fail if a hander for lock screen apps focus has not been set.
|
||||
virtual bool HandleFocusLockScreenApps(bool reverse) = 0;
|
||||
virtual void HandleFocusOobeDialog() = 0;
|
||||
virtual void HandleLaunchPublicSession(const AccountId& account_id,
|
||||
const std::string& locale,
|
||||
@ -103,7 +102,6 @@ class LoginScreenClientImpl : public ash::LoginScreenClient,
|
||||
void CancelAddUser() override;
|
||||
void ShowGuestTosScreen() override;
|
||||
void OnMaxIncorrectPasswordAttempted(const AccountId& account_id) override;
|
||||
void FocusLockScreenApps(bool reverse) override;
|
||||
void FocusOobeDialog() override;
|
||||
void ShowGaiaSignin(const AccountId& prefilled_account) override;
|
||||
void StartUserRecovery(const AccountId& account_to_recover) override;
|
||||
|
@ -207,12 +207,6 @@ BrowserContextHelper::DeprecatedGetOrCreateSigninBrowserContext() {
|
||||
return delegate_->GetOrCreatePrimaryOTRBrowserContext(browser_context);
|
||||
}
|
||||
|
||||
base::FilePath BrowserContextHelper::GetLockScreenAppBrowserContextPath()
|
||||
const {
|
||||
return delegate_->GetUserDataDir()->Append(
|
||||
kLockScreenAppBrowserContextBaseName);
|
||||
}
|
||||
|
||||
base::FilePath BrowserContextHelper::GetLockScreenBrowserContextPath() const {
|
||||
return delegate_->GetUserDataDir()->Append(kLockScreenBrowserContextBaseName);
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
namespace ash {
|
||||
|
||||
const char kSigninBrowserContextBaseName[] = "Default";
|
||||
const char kLockScreenAppBrowserContextBaseName[] = "LockScreenAppsProfile";
|
||||
const char kLockScreenBrowserContextBaseName[] = "LockScreenProfile";
|
||||
const char kShimlessRmaAppBrowserContextBaseName[] = "ShimlessRmaAppProfile";
|
||||
|
||||
@ -19,11 +18,6 @@ bool IsSigninBrowserContext(content::BrowserContext* browser_context) {
|
||||
kSigninBrowserContextBaseName;
|
||||
}
|
||||
|
||||
bool IsLockScreenAppBrowserContext(content::BrowserContext* browser_context) {
|
||||
return browser_context && browser_context->GetPath().BaseName().value() ==
|
||||
kLockScreenAppBrowserContextBaseName;
|
||||
}
|
||||
|
||||
bool IsLockScreenBrowserContext(content::BrowserContext* browser_context) {
|
||||
return browser_context && browser_context->GetPath().BaseName().value() ==
|
||||
kLockScreenBrowserContextBaseName;
|
||||
@ -42,7 +36,6 @@ bool IsUserBrowserContext(content::BrowserContext* browser_context) {
|
||||
bool IsUserBrowserContextBaseName(const base::FilePath& base_name) {
|
||||
const auto& value = base_name.value();
|
||||
return value != kSigninBrowserContextBaseName &&
|
||||
value != kLockScreenAppBrowserContextBaseName &&
|
||||
value != kLockScreenBrowserContextBaseName &&
|
||||
value != kShimlessRmaAppBrowserContextBaseName;
|
||||
}
|
||||
|
@ -34,10 +34,6 @@ namespace ash {
|
||||
COMPONENT_EXPORT(ASH_BROWSER_CONTEXT_HELPER)
|
||||
extern const char kSigninBrowserContextBaseName[];
|
||||
|
||||
// Base name of the lock-screen-app browser context.
|
||||
COMPONENT_EXPORT(ASH_BROWSER_CONTEXT_HELPER)
|
||||
extern const char kLockScreenAppBrowserContextBaseName[];
|
||||
|
||||
// Base name of the lock-screen browser context.
|
||||
COMPONENT_EXPORT(ASH_BROWSER_CONTEXT_HELPER)
|
||||
extern const char kLockScreenBrowserContextBaseName[];
|
||||
@ -51,11 +47,6 @@ extern const char kShimlessRmaAppBrowserContextBaseName[];
|
||||
COMPONENT_EXPORT(ASH_BROWSER_CONTEXT_HELPER)
|
||||
bool IsSigninBrowserContext(content::BrowserContext* browser_context);
|
||||
|
||||
// Returns true if given |browser_context| is for Lock-screen-app.
|
||||
// Returns false if nullptr is given.
|
||||
COMPONENT_EXPORT(ASH_BROWSER_CONTEXT_HELPER)
|
||||
bool IsLockScreenAppBrowserContext(content::BrowserContext* browser_context);
|
||||
|
||||
// Returns true if given |browser_context| is for Lock-screen.
|
||||
// Returns false if nullptr is given.
|
||||
COMPONENT_EXPORT(ASH_BROWSER_CONTEXT_HELPER)
|
||||
|
Reference in New Issue
Block a user