| 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" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 | 17 |
| 18 | 18 |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 // ScreenlockBridge brings together the screenLockPrivate API and underlying | 21 // ScreenlockBridge brings together the screenLockPrivate API and underlying |
| 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 // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not |
| 25 // used solely for the lock screen anymore. |
| 24 class ScreenlockBridge { | 26 class ScreenlockBridge { |
| 25 public: | 27 public: |
| 26 class Observer { | 28 class Observer { |
| 27 public: | 29 public: |
| 28 // Invoked after the screen is locked. | 30 // Invoked after the screen is locked. |
| 29 virtual void OnScreenDidLock() = 0; | 31 virtual void OnScreenDidLock() = 0; |
| 30 // Invoked after the screen lock is dismissed. | 32 // Invoked after the screen lock is dismissed. |
| 31 virtual void OnScreenDidUnlock() = 0; | 33 virtual void OnScreenDidUnlock() = 0; |
| 32 // Invoked when the user focused on the lock screen changes. | 34 // Invoked when the user focused on the lock screen changes. |
| 33 virtual void OnFocusedUserChanged(const std::string& user_id) = 0; | 35 virtual void OnFocusedUserChanged(const std::string& user_id) = 0; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 virtual void SetAuthType(const std::string& user_email, | 128 virtual void SetAuthType(const std::string& user_email, |
| 127 AuthType auth_type, | 129 AuthType auth_type, |
| 128 const base::string16& auth_value) = 0; | 130 const base::string16& auth_value) = 0; |
| 129 | 131 |
| 130 // Returns the authentication type used for a user. | 132 // Returns the authentication type used for a user. |
| 131 virtual AuthType GetAuthType(const std::string& user_email) const = 0; | 133 virtual AuthType GetAuthType(const std::string& user_email) const = 0; |
| 132 | 134 |
| 133 // Unlock from easy unlock app for a user. | 135 // Unlock from easy unlock app for a user. |
| 134 virtual void Unlock(const std::string& user_email) = 0; | 136 virtual void Unlock(const std::string& user_email) = 0; |
| 135 | 137 |
| 138 // Attempts to login the user using an easy unlock key. |
| 139 virtual void AttemptEasySignin(const std::string& user_email, |
| 140 const std::string& secret, |
| 141 const std::string& key_label) = 0; |
| 142 |
| 136 protected: | 143 protected: |
| 137 virtual ~LockHandler() {} | 144 virtual ~LockHandler() {} |
| 138 }; | 145 }; |
| 139 | 146 |
| 140 static ScreenlockBridge* Get(); | 147 static ScreenlockBridge* Get(); |
| 141 static std::string GetAuthenticatedUserEmail(Profile* profile); | 148 static std::string GetAuthenticatedUserEmail(Profile* profile); |
| 142 | 149 |
| 143 void SetLockHandler(LockHandler* lock_handler); | 150 void SetLockHandler(LockHandler* lock_handler); |
| 144 void SetFocusedUser(const std::string& user_id); | 151 void SetFocusedUser(const std::string& user_id); |
| 145 | 152 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 163 | 170 |
| 164 LockHandler* lock_handler_; // Not owned | 171 LockHandler* lock_handler_; // Not owned |
| 165 // The last focused user's id. | 172 // The last focused user's id. |
| 166 std::string focused_user_id_; | 173 std::string focused_user_id_; |
| 167 ObserverList<Observer, true> observers_; | 174 ObserverList<Observer, true> observers_; |
| 168 | 175 |
| 169 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); | 176 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); |
| 170 }; | 177 }; |
| 171 | 178 |
| 172 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ | 179 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_ |
| OLD | NEW |