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 COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ |
6 #define COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ | 6 #define COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 | 16 |
17 namespace content { | |
18 class BrowserContext; | |
19 } // namespace content | |
20 | |
21 namespace proximity_auth { | 17 namespace proximity_auth { |
22 | 18 |
23 class ProximityAuthClient; | |
24 | |
25 // ScreenlockBridge brings together the screenLockPrivate API and underlying | 19 // ScreenlockBridge brings together the screenLockPrivate API and underlying |
26 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other | 20 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other |
27 // platforms, it delegates calls to UserManagerUI (and friends). | 21 // platforms, it delegates calls to UserManagerUI (and friends). |
28 // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not | 22 // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not |
29 // used solely for the lock screen anymore. | 23 // used solely for the lock screen anymore. |
30 class ScreenlockBridge { | 24 class ScreenlockBridge { |
31 public: | 25 public: |
32 // |client| is not owned and must outlive this object. | 26 ScreenlockBridge(); |
33 explicit ScreenlockBridge(ProximityAuthClient* client); | |
34 ~ScreenlockBridge(); | 27 ~ScreenlockBridge(); |
35 | 28 |
36 // User pod icons supported by lock screen / signin screen UI. | 29 // User pod icons supported by lock screen / signin screen UI. |
37 enum UserPodCustomIcon { | 30 enum UserPodCustomIcon { |
38 USER_POD_CUSTOM_ICON_NONE, | 31 USER_POD_CUSTOM_ICON_NONE, |
39 USER_POD_CUSTOM_ICON_HARDLOCKED, | 32 USER_POD_CUSTOM_ICON_HARDLOCKED, |
40 USER_POD_CUSTOM_ICON_LOCKED, | 33 USER_POD_CUSTOM_ICON_LOCKED, |
41 USER_POD_CUSTOM_ICON_LOCKED_TO_BE_ACTIVATED, | 34 USER_POD_CUSTOM_ICON_LOCKED_TO_BE_ACTIVATED, |
42 // TODO(isherman): The "locked with proximity hint" icon is currently the | 35 // TODO(isherman): The "locked with proximity hint" icon is currently the |
43 // same as the "locked" icon. It's treated as a separate case to allow an | 36 // same as the "locked" icon. It's treated as a separate case to allow an |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 virtual void OnFocusedUserChanged(const std::string& user_id) = 0; | 151 virtual void OnFocusedUserChanged(const std::string& user_id) = 0; |
159 | 152 |
160 protected: | 153 protected: |
161 virtual ~Observer() {} | 154 virtual ~Observer() {} |
162 }; | 155 }; |
163 | 156 |
164 void SetLockHandler(LockHandler* lock_handler); | 157 void SetLockHandler(LockHandler* lock_handler); |
165 void SetFocusedUser(const std::string& user_id); | 158 void SetFocusedUser(const std::string& user_id); |
166 | 159 |
167 bool IsLocked() const; | 160 bool IsLocked() const; |
168 void Lock(content::BrowserContext* browser_context); | 161 void Lock(); |
169 void Unlock(content::BrowserContext* browser_context); | 162 |
| 163 // Unlocks the screen for the authenticated user with the given |user_email|. |
| 164 void Unlock(const std::string& user_email); |
170 | 165 |
171 void AddObserver(Observer* observer); | 166 void AddObserver(Observer* observer); |
172 void RemoveObserver(Observer* observer); | 167 void RemoveObserver(Observer* observer); |
173 | 168 |
174 LockHandler* lock_handler() { return lock_handler_; } | 169 LockHandler* lock_handler() { return lock_handler_; } |
175 | 170 |
176 std::string focused_user_id() const { return focused_user_id_; } | 171 std::string focused_user_id() const { return focused_user_id_; } |
177 | 172 |
178 private: | 173 private: |
179 ProximityAuthClient* client_; // Not owned. Must outlive this object. | |
180 LockHandler* lock_handler_; // Not owned | 174 LockHandler* lock_handler_; // Not owned |
181 // The last focused user's id. | 175 // The last focused user's id. |
182 std::string focused_user_id_; | 176 std::string focused_user_id_; |
183 base::ObserverList<Observer, true> observers_; | 177 base::ObserverList<Observer, true> observers_; |
184 | 178 |
185 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); | 179 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); |
186 }; | 180 }; |
187 | 181 |
188 } // namespace proximity_auth | 182 } // namespace proximity_auth |
189 | 183 |
190 #endif // COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ | 184 #endif // COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ |
OLD | NEW |