| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The signin manager encapsulates some functionality tracking | 5 // The signin manager encapsulates some functionality tracking |
| 6 // which user is signed in. When a user is signed in, a ClientLogin | 6 // which user is signed in. When a user is signed in, a ClientLogin |
| 7 // request is run on their behalf. Auth tokens are fetched from Google | 7 // request is run on their behalf. Auth tokens are fetched from Google |
| 8 // and the results are stored in the TokenService. | 8 // and the results are stored in the TokenService. |
| 9 // | 9 // |
| 10 // **NOTE** on semantics of SigninManager: | 10 // **NOTE** on semantics of SigninManager: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const GoogleServiceAuthError& error) OVERRIDE; | 133 const GoogleServiceAuthError& error) OVERRIDE; |
| 134 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; | 134 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; |
| 135 virtual void OnGetUserInfoFailure( | 135 virtual void OnGetUserInfoFailure( |
| 136 const GoogleServiceAuthError& error) OVERRIDE; | 136 const GoogleServiceAuthError& error) OVERRIDE; |
| 137 | 137 |
| 138 // content::NotificationObserver | 138 // content::NotificationObserver |
| 139 virtual void Observe(int type, | 139 virtual void Observe(int type, |
| 140 const content::NotificationSource& source, | 140 const content::NotificationSource& source, |
| 141 const content::NotificationDetails& details) OVERRIDE; | 141 const content::NotificationDetails& details) OVERRIDE; |
| 142 | 142 |
| 143 protected: |
| 144 // Weak pointer to parent profile (protected so FakeSigninManager can access |
| 145 // it). |
| 146 Profile* profile_; |
| 147 |
| 143 private: | 148 private: |
| 144 enum SigninType { | 149 enum SigninType { |
| 145 SIGNIN_TYPE_NONE, | 150 SIGNIN_TYPE_NONE, |
| 146 SIGNIN_TYPE_CLIENT_LOGIN, | 151 SIGNIN_TYPE_CLIENT_LOGIN, |
| 147 SIGNIN_TYPE_WITH_CREDENTIALS, | 152 SIGNIN_TYPE_WITH_CREDENTIALS, |
| 148 SIGNIN_TYPE_CLIENT_OAUTH, | 153 SIGNIN_TYPE_CLIENT_OAUTH, |
| 149 }; | 154 }; |
| 150 | 155 |
| 151 friend class FakeSigninManager; | 156 friend class FakeSigninManager; |
| 152 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); | 157 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 166 // Will clear in memory data but leaves the db as such so when the browser | 171 // Will clear in memory data but leaves the db as such so when the browser |
| 167 // restarts we can use the old token(which might throw a password error). | 172 // restarts we can use the old token(which might throw a password error). |
| 168 void ClearTransientSigninData(); | 173 void ClearTransientSigninData(); |
| 169 | 174 |
| 170 // Called to handle an error from a GAIA auth fetch. Sets the last error | 175 // Called to handle an error from a GAIA auth fetch. Sets the last error |
| 171 // to |error|, sends out a notification of login failure, and clears the | 176 // to |error|, sends out a notification of login failure, and clears the |
| 172 // transient signin data if |clear_transient_data| is true. | 177 // transient signin data if |clear_transient_data| is true. |
| 173 void HandleAuthError(const GoogleServiceAuthError& error, | 178 void HandleAuthError(const GoogleServiceAuthError& error, |
| 174 bool clear_transient_data); | 179 bool clear_transient_data); |
| 175 | 180 |
| 176 Profile* profile_; | |
| 177 | |
| 178 // ClientLogin identity. | 181 // ClientLogin identity. |
| 179 std::string possibly_invalid_username_; | 182 std::string possibly_invalid_username_; |
| 180 std::string password_; // This is kept empty whenever possible. | 183 std::string password_; // This is kept empty whenever possible. |
| 181 bool had_two_factor_error_; | 184 bool had_two_factor_error_; |
| 182 | 185 |
| 183 void CleanupNotificationRegistration(); | 186 void CleanupNotificationRegistration(); |
| 184 | 187 |
| 185 // Result of the last client login, kept pending the lookup of the | 188 // Result of the last client login, kept pending the lookup of the |
| 186 // canonical email. | 189 // canonical email. |
| 187 ClientLoginResult last_result_; | 190 ClientLoginResult last_result_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 201 | 204 |
| 202 // The type of sign being performed. This value is valid only between a call | 205 // The type of sign being performed. This value is valid only between a call |
| 203 // to one of the StartSigninXXX methods and when the sign in is either | 206 // to one of the StartSigninXXX methods and when the sign in is either |
| 204 // successful or not. | 207 // successful or not. |
| 205 SigninType type_; | 208 SigninType type_; |
| 206 | 209 |
| 207 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 210 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
| 208 }; | 211 }; |
| 209 | 212 |
| 210 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 213 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
| OLD | NEW |