OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ |
6 #define CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ | 6 #define CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other | 22 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other |
23 // platforms, it delegates calls to UserManagerUI (and friends). | 23 // platforms, it delegates calls to UserManagerUI (and friends). |
24 class ScreenlockBridge { | 24 class ScreenlockBridge { |
25 public: | 25 public: |
26 class Observer { | 26 class Observer { |
27 public: | 27 public: |
28 // Invoked after the screen is locked. | 28 // Invoked after the screen is locked. |
29 virtual void OnScreenDidLock() = 0; | 29 virtual void OnScreenDidLock() = 0; |
30 // Invoked after the screen lock is dismissed. | 30 // Invoked after the screen lock is dismissed. |
31 virtual void OnScreenDidUnlock() = 0; | 31 virtual void OnScreenDidUnlock() = 0; |
| 32 // Invoked when the user focused on the lock screen changes. |
| 33 virtual void OnFocusedUserChanged(const std::string& user_id) = 0; |
32 protected: | 34 protected: |
33 virtual ~Observer() {} | 35 virtual ~Observer() {} |
34 }; | 36 }; |
35 | 37 |
36 // Class containing parameters describing the custom icon that should be | 38 // Class containing parameters describing the custom icon that should be |
37 // shown on a user's screen lock pod next to the input field. | 39 // shown on a user's screen lock pod next to the input field. |
38 class UserPodCustomIconOptions { | 40 class UserPodCustomIconOptions { |
39 public: | 41 public: |
40 UserPodCustomIconOptions(); | 42 UserPodCustomIconOptions(); |
41 ~UserPodCustomIconOptions(); | 43 ~UserPodCustomIconOptions(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 virtual void Unlock(const std::string& user_email) = 0; | 134 virtual void Unlock(const std::string& user_email) = 0; |
133 | 135 |
134 protected: | 136 protected: |
135 virtual ~LockHandler() {} | 137 virtual ~LockHandler() {} |
136 }; | 138 }; |
137 | 139 |
138 static ScreenlockBridge* Get(); | 140 static ScreenlockBridge* Get(); |
139 static std::string GetAuthenticatedUserEmail(Profile* profile); | 141 static std::string GetAuthenticatedUserEmail(Profile* profile); |
140 | 142 |
141 void SetLockHandler(LockHandler* lock_handler); | 143 void SetLockHandler(LockHandler* lock_handler); |
| 144 void SetFocusedUser(const std::string& user_id); |
142 | 145 |
143 bool IsLocked() const; | 146 bool IsLocked() const; |
144 void Lock(Profile* profile); | 147 void Lock(Profile* profile); |
145 void Unlock(Profile* profile); | 148 void Unlock(Profile* profile); |
146 | 149 |
147 void AddObserver(Observer* observer); | 150 void AddObserver(Observer* observer); |
148 void RemoveObserver(Observer* observer); | 151 void RemoveObserver(Observer* observer); |
149 | 152 |
150 LockHandler* lock_handler() { return lock_handler_; } | 153 LockHandler* lock_handler() { return lock_handler_; } |
151 | 154 |
| 155 std::string focused_user_id() const { return focused_user_id_; } |
| 156 |
152 private: | 157 private: |
153 friend struct base::DefaultLazyInstanceTraits<ScreenlockBridge>; | 158 friend struct base::DefaultLazyInstanceTraits<ScreenlockBridge>; |
154 friend struct base::DefaultDeleter<ScreenlockBridge>; | 159 friend struct base::DefaultDeleter<ScreenlockBridge>; |
155 | 160 |
156 ScreenlockBridge(); | 161 ScreenlockBridge(); |
157 ~ScreenlockBridge(); | 162 ~ScreenlockBridge(); |
158 | 163 |
159 LockHandler* lock_handler_; // Not owned | 164 LockHandler* lock_handler_; // Not owned |
| 165 // The last focused user's id. |
| 166 std::string focused_user_id_; |
160 ObserverList<Observer, true> observers_; | 167 ObserverList<Observer, true> observers_; |
161 | 168 |
162 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); | 169 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); |
163 }; | 170 }; |
164 | 171 |
165 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ | 172 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ |
OLD | NEW |