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 78e3938159dc1b885bf57f0c16490aaf463c09ad..176a5bb2199e4d6400a5c624abe9eba05f8d0fcc 100644 |
--- a/chrome/browser/chromeos/lock_screen_apps/state_controller.h |
+++ b/chrome/browser/chromeos/lock_screen_apps/state_controller.h |
@@ -13,23 +13,36 @@ |
#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 "extensions/browser/app_window/app_window_registry.h" |
+#include "extensions/common/api/app_runtime.h" |
#include "mojo/public/cpp/bindings/binding.h" |
class Profile; |
+namespace content { |
+class BrowserContext; |
+} |
+ |
+namespace extensions { |
+class AppWindow; |
+class Extension; |
+} |
+ |
namespace session_manager { |
class SessionManager; |
} |
namespace lock_screen_apps { |
+class AppManager; |
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, |
- public session_manager::SessionManagerObserver { |
+ public session_manager::SessionManagerObserver, |
+ public extensions::AppWindowRegistry::Observer { |
public: |
// Returns whether the StateController is enabled - it is currently guarded by |
// a feature flag. If not enabled, |StateController| instance is not allowed |
@@ -71,6 +84,23 @@ class StateController : public ash::mojom::TrayActionClient, |
// session_manager::SessionManagerObserver: |
void OnSessionStateChanged() override; |
+ // extensions::AppWindowREgistry::Observer: |
benwells
2017/06/13 10:30:46
Nit: REgistry
tbarzic
2017/06/13 19:17:59
Done.
|
+ void OnAppWindowRemoved(extensions::AppWindow* app_window) override; |
+ |
+ // Returns whether an extension should be allowed to create an app window on |
+ // the lock screen in order to handle the provided action. |
+ bool CanCreateAppWindowForAction( |
benwells
2017/06/13 10:30:46
Does this have to be public?
tbarzic
2017/06/13 19:17:59
It's currently used by ChromeAppWindowDelegate
|
+ content::BrowserContext* context, |
+ const extensions::Extension* extension, |
+ extensions::api::app_runtime::ActionType action) const; |
+ |
+ // Registers the app window as action handler for the action on Chrome OS lock |
+ // screen. |
+ // Returns whether the app window was successfully registered. |
+ bool RegisterAppWindowForAction( |
+ extensions::AppWindow* window, |
+ extensions::api::app_runtime::ActionType action); |
+ |
// If there are any active lock screen action handlers, moved their windows |
// to background, to ensure lock screen UI is visible. |
void MoveToBackground(); |
@@ -79,14 +109,16 @@ class StateController : public ash::mojom::TrayActionClient, |
// windows back to foreground (i.e. visible over lock screen UI). |
void MoveToForeground(); |
- // Sets the current state - to be used in tests. Hopefully, when this class |
- // has more logic implemented, this will not be needed. |
- void SetLockScreenNoteStateForTesting(ash::mojom::TrayActionState state); |
- |
private: |
// Called when app manager reports that note taking availability has changed. |
void OnNoteTakingAvailabilityChanged(); |
+ // If there is an app window registered as a handler for note taking action |
+ // on lock screen, unregisters the window, and closes is if |close_window| is |
+ // set. It changes the current state to kAvailable or kNotAvailable, depending |
+ // on whether lock screen note taking action can still be handled. |
+ void ResetNoteTakingWindowAndMoveToNextState(bool close_window); |
+ |
// Requests lock screen note action state change to |state|. |
// Returns whether the action state has changed. |
bool UpdateLockScreenNoteState(ash::mojom::TrayActionState state); |
@@ -105,6 +137,11 @@ class StateController : public ash::mojom::TrayActionClient, |
std::unique_ptr<AppManager> app_manager_; |
+ extensions::AppWindow* note_app_window_ = nullptr; |
+ |
+ ScopedObserver<extensions::AppWindowRegistry, |
+ extensions::AppWindowRegistry::Observer> |
+ app_window_observer_; |
ScopedObserver<session_manager::SessionManager, |
session_manager::SessionManagerObserver> |
session_observer_; |