| 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; | 19 class ProximityAuthClient; |
| 24 | 20 |
| 25 // ScreenlockBridge brings together the screenLockPrivate API and underlying | 21 // ScreenlockBridge brings together the screenLockPrivate API and underlying |
| 26 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other | 22 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other |
| 27 // platforms, it delegates calls to UserManagerUI (and friends). | 23 // platforms, it delegates calls to UserManagerUI (and friends). |
| 28 // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not | 24 // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not |
| 29 // used solely for the lock screen anymore. | 25 // used solely for the lock screen anymore. |
| 30 class ScreenlockBridge { | 26 class ScreenlockBridge { |
| 31 public: | 27 public: |
| 32 // |client| is not owned and must outlive this object. | 28 ScreenlockBridge(); |
| 33 explicit ScreenlockBridge(ProximityAuthClient* client); | |
| 34 ~ScreenlockBridge(); | 29 ~ScreenlockBridge(); |
| 35 | 30 |
| 36 // User pod icons supported by lock screen / signin screen UI. | 31 // User pod icons supported by lock screen / signin screen UI. |
| 37 enum UserPodCustomIcon { | 32 enum UserPodCustomIcon { |
| 38 USER_POD_CUSTOM_ICON_NONE, | 33 USER_POD_CUSTOM_ICON_NONE, |
| 39 USER_POD_CUSTOM_ICON_HARDLOCKED, | 34 USER_POD_CUSTOM_ICON_HARDLOCKED, |
| 40 USER_POD_CUSTOM_ICON_LOCKED, | 35 USER_POD_CUSTOM_ICON_LOCKED, |
| 41 USER_POD_CUSTOM_ICON_LOCKED_TO_BE_ACTIVATED, | 36 USER_POD_CUSTOM_ICON_LOCKED_TO_BE_ACTIVATED, |
| 42 // TODO(isherman): The "locked with proximity hint" icon is currently the | 37 // 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 | 38 // 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; | 153 virtual void OnFocusedUserChanged(const std::string& user_id) = 0; |
| 159 | 154 |
| 160 protected: | 155 protected: |
| 161 virtual ~Observer() {} | 156 virtual ~Observer() {} |
| 162 }; | 157 }; |
| 163 | 158 |
| 164 void SetLockHandler(LockHandler* lock_handler); | 159 void SetLockHandler(LockHandler* lock_handler); |
| 165 void SetFocusedUser(const std::string& user_id); | 160 void SetFocusedUser(const std::string& user_id); |
| 166 | 161 |
| 167 bool IsLocked() const; | 162 bool IsLocked() const; |
| 168 void Lock(content::BrowserContext* browser_context); | 163 void Lock(ProximityAuthClient* client); |
| 169 void Unlock(content::BrowserContext* browser_context); | 164 void Unlock(ProximityAuthClient* client); |
| 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 |