| Index: chrome/browser/chromeos/lock_screen_apps/state_controller.h
|
| diff --git a/chrome/browser/chromeos/lock_screen_apps/state_controller.h b/chrome/browser/chromeos/lock_screen_apps/state_controller.h
|
| index 0d9d401aa158bcf3a1def3cf373436ce2df2e091..33bb5fb24d5b7ef8c78669b45ccd2ea2cabce19b 100644
|
| --- a/chrome/browser/chromeos/lock_screen_apps/state_controller.h
|
| +++ b/chrome/browser/chromeos/lock_screen_apps/state_controller.h
|
| @@ -9,9 +9,18 @@
|
|
|
| #include "ash/public/interfaces/tray_action.mojom.h"
|
| #include "base/observer_list.h"
|
| +#include "base/scoped_observer.h"
|
| +#include "chrome/browser/chromeos/lock_screen_apps/app_manager.h"
|
| #include "chrome/browser/chromeos/lock_screen_apps/state_observer.h"
|
| +#include "components/session_manager/core/session_manager_observer.h"
|
| #include "mojo/public/cpp/bindings/binding.h"
|
|
|
| +class Profile;
|
| +
|
| +namespace session_manager {
|
| +class SessionManager;
|
| +}
|
| +
|
| namespace lock_screen_apps {
|
|
|
| class StateObserver;
|
| @@ -19,7 +28,9 @@ class StateObserver;
|
| // Manages state of lock screen action handler apps, and notifies
|
| // interested parties as the state changes.
|
| // Currently assumes single supported action - NEW_NOTE.
|
| -class StateController : public ash::mojom::TrayActionClient {
|
| +class StateController : public ash::mojom::TrayActionClient,
|
| + public session_manager::SessionManagerObserver,
|
| + public AppManager::Observer {
|
| public:
|
| // Returns whether the StateController is enabled - it is currently guarded by
|
| // a feature flag. If not enabled, |StateController| instance is not allowed
|
| @@ -40,10 +51,14 @@ class StateController : public ash::mojom::TrayActionClient {
|
| // Has to be called before |Initialize|.
|
| void SetTrayActionPtrForTesting(ash::mojom::TrayActionPtr tray_action_ptr);
|
| void FlushTrayActionForTesting();
|
| + // Sets test AppManager implementation. Should be called before
|
| + // |SetPrimaryProfile|
|
| + void SetAppManagerForTesting(std::unique_ptr<AppManager> app_manager);
|
|
|
| // Initializes mojo bindings for the StateController - it creates binding to
|
| // ash's tray action interface and sets this object as the interface's client.
|
| void Initialize();
|
| + void SetPrimaryProfile(Profile* profile);
|
|
|
| void AddObserver(StateObserver* observer);
|
| void RemoveObserver(StateObserver* observer);
|
| @@ -54,6 +69,12 @@ class StateController : public ash::mojom::TrayActionClient {
|
| // ash::mojom::TrayActionClient:
|
| void RequestNewLockScreenNote() override;
|
|
|
| + // session_manager::SessionManagerObserver:
|
| + void OnSessionStateChanged() override;
|
| +
|
| + // AppManager::Observer:
|
| + void OnNoteTakingAvailabilityChanged() override;
|
| +
|
| // If there are any active lock screen action handlers, moved their windows
|
| // to background, to ensure lock screen UI is visible.
|
| void MoveToBackground();
|
| @@ -83,6 +104,12 @@ class StateController : public ash::mojom::TrayActionClient {
|
| mojo::Binding<ash::mojom::TrayActionClient> binding_;
|
| ash::mojom::TrayActionPtr tray_action_ptr_;
|
|
|
| + std::unique_ptr<AppManager> app_manager_;
|
| +
|
| + ScopedObserver<session_manager::SessionManager,
|
| + session_manager::SessionManagerObserver>
|
| + session_observer_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(StateController);
|
| };
|
|
|
|
|