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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOCK_SCREEN_APPS_STATE_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOCK_SCREEN_APPS_STATE_CONTROLLER_H_
7
8 #include "base/lazy_instance.h"
9 #include "base/observer_list.h"
10 #include "chrome/browser/chromeos/lock_screen_apps/state_observer.h"
11 #include "chrome/browser/chromeos/lock_screen_apps/types.h"
12
13 namespace lock_screen_apps {
14 class StateObserver;
xiyuan 2017/05/02 18:12:23 nit: move this down after line 17. Prevailing styl
tbarzic 2017/05/02 18:43:37 Done.
15 }
16
17 namespace lock_screen_apps {
18
19 // Manages state of lock scree action handler apps, and notifies
20 // interested parties as the state changes.
21 // Currently assumes single supported action - NEW_NOTE.
22 class StateController {
23 public:
24 static StateController* Get();
25
26 void AddObserver(StateObserver* observer);
27 void RemoveObserver(StateObserver* observer);
28
29 // Gets current state assiciated with the action.
30 ActionState GetActionState(Action action) const;
31
32 // Handles an action request - if the action handler is available, this will
33 // show an app window for the specified action.
34 void HandleAction(Action action);
xiyuan 2017/05/02 18:12:23 Do we care about whether the action is handled? e.
tbarzic 2017/05/02 18:43:37 Not necessarily, but it could be useful, e.g. for
35
36 // If there are any active lock screen action handlers, moved their windows
37 // to background, to ensure lock screen UI is visible.
38 void MoveToBackground();
39
40 private:
41 friend struct base::LazyInstanceTraitsBase<StateController>;
42
43 StateController();
44 ~StateController();
45
46 // Requests action state change to |state|.
47 // Returns whether the action state has changed.
48 bool UpdateActionState(Action action, ActionState state);
xiyuan 2017/05/02 18:12:23 How do we plan to change state with this method be
tbarzic 2017/05/02 18:43:37 Yes, I plan not to have this expose explicit updat
xiyuan 2017/05/02 19:23:03 Acknowledged.
49
50 // notifies observers that an action state changed.
51 void NotifyStateChanged(Action action);
52
53 // New note action state.
54 ActionState new_note_state_ = ActionState::kNotSupported;
55
56 base::ObserverList<StateObserver> observers_;
57
58 DISALLOW_COPY_AND_ASSIGN(StateController);
59 };
60
61 } // namespace lock_screen_apps
62
63 #endif // CHROME_BROWSER_CHROMEOS_LOCK_SCREEN_APPS_STATE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698