Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1512)

Unified Diff: chrome/browser/chromeos/lock_screen_apps/state_controller.h

Issue 2839383002: Introduce lock_screen_apps to chrome/browser/chromeos (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
new file mode 100644
index 0000000000000000000000000000000000000000..1b043346e49e530a13a23cd1bd92b1243cf655e2
--- /dev/null
+++ b/chrome/browser/chromeos/lock_screen_apps/state_controller.h
@@ -0,0 +1,61 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOCK_SCREEN_APPS_STATE_CONTROLLER_H_
+#define CHROME_BROWSER_CHROMEOS_LOCK_SCREEN_APPS_STATE_CONTROLLER_H_
+
+#include "base/lazy_instance.h"
+#include "base/observer_list.h"
+#include "chrome/browser/chromeos/lock_screen_apps/state_observer.h"
+#include "chrome/browser/chromeos/lock_screen_apps/types.h"
+
+namespace lock_screen_apps {
+
+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:
+ static StateController* Get();
+
+ void AddObserver(StateObserver* observer);
+ void RemoveObserver(StateObserver* observer);
+
+ // Gets current state assiciated with the action.
+ ActionState GetActionState(Action action) const;
+
+ // Handles an action request - if the action handler is available, this will
+ // show an app window for the specified action.
+ bool HandleAction(Action action);
+
+ // If there are any active lock screen action handlers, moved their windows
+ // to background, to ensure lock screen UI is visible.
+ void MoveToBackground();
+
+ private:
+ friend struct base::LazyInstanceTraitsBase<StateController>;
+
+ StateController();
+ ~StateController();
+
+ // Requests action state change to |state|.
+ // Returns whether the action state has changed.
+ bool UpdateActionState(Action action, ActionState state);
+
+ // notifies observers that an action state changed.
+ void NotifyStateChanged(Action action);
+
+ // New note action state.
+ ActionState new_note_state_ = ActionState::kNotSupported;
+
+ base::ObserverList<StateObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(StateController);
+};
+
+} // namespace lock_screen_apps
+
+#endif // CHROME_BROWSER_CHROMEOS_LOCK_SCREEN_APPS_STATE_CONTROLLER_H_
« no previous file with comments | « chrome/browser/chromeos/lock_screen_apps/OWNERS ('k') | chrome/browser/chromeos/lock_screen_apps/state_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698