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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) OVERRIDE; | 122 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) OVERRIDE; |
123 virtual void OnUberAuthTokenSuccess(const std::string& token) OVERRIDE; | 123 virtual void OnUberAuthTokenSuccess(const std::string& token) OVERRIDE; |
124 virtual void OnUberAuthTokenFailure( | 124 virtual void OnUberAuthTokenFailure( |
125 const GoogleServiceAuthError& error) OVERRIDE; | 125 const GoogleServiceAuthError& error) OVERRIDE; |
126 | 126 |
127 // content::NotificationObserver | 127 // content::NotificationObserver |
128 virtual void Observe(int type, | 128 virtual void Observe(int type, |
129 const content::NotificationSource& source, | 129 const content::NotificationSource& source, |
130 const content::NotificationDetails& details) OVERRIDE; | 130 const content::NotificationDetails& details) OVERRIDE; |
131 | 131 |
132 const std::string& convenient_password() const { return convenient_password_; } | |
Andrew T Wilson (Slow)
2012/04/03 17:45:13
nit: line too long
kochi
2012/04/03 21:55:29
This line is removed.
I'll run cpplint and fix all
| |
133 | |
132 private: | 134 private: |
133 friend class FakeSigninManager; | 135 friend class FakeSigninManager; |
134 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); | 136 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); |
135 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); | 137 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); |
136 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); | 138 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); |
137 void PrepareForSignin(); | 139 void PrepareForSignin(); |
138 | 140 |
139 // Called when a new request to re-authenticate a user is in progress. | 141 // Called when a new request to re-authenticate a user is in progress. |
140 // Will clear in memory data but leaves the db as such so when the browser | 142 // Will clear in memory data but leaves the db as such so when the browser |
141 // restarts we can use the old token(which might throw a password error). | 143 // restarts we can use the old token(which might throw a password error). |
142 void ClearTransientSigninData(); | 144 void ClearTransientSigninData(); |
143 | 145 |
144 // Called to handle an error from a GAIA auth fetch. Sets the last error | 146 // Called to handle an error from a GAIA auth fetch. Sets the last error |
145 // to |error|, sends out a notification of login failure, and clears the | 147 // to |error|, sends out a notification of login failure, and clears the |
146 // transient signin data. | 148 // transient signin data. |
147 void HandleAuthError(const GoogleServiceAuthError& error); | 149 void HandleAuthError(const GoogleServiceAuthError& error); |
148 | 150 |
149 Profile* profile_; | 151 Profile* profile_; |
150 | 152 |
151 // ClientLogin identity. | 153 // ClientLogin identity. |
152 std::string possibly_invalid_username_; | 154 std::string possibly_invalid_username_; |
153 std::string password_; // This is kept empty whenever possible. | 155 std::string password_; // This is kept empty whenever possible. |
156 std::string convenient_password_; | |
154 bool had_two_factor_error_; | 157 bool had_two_factor_error_; |
155 | 158 |
156 void CleanupNotificationRegistration(); | 159 void CleanupNotificationRegistration(); |
157 | 160 |
158 // Result of the last client login, kept pending the lookup of the | 161 // Result of the last client login, kept pending the lookup of the |
159 // canonical email. | 162 // canonical email. |
160 ClientLoginResult last_result_; | 163 ClientLoginResult last_result_; |
161 | 164 |
162 // Actual client login handler. | 165 // Actual client login handler. |
163 scoped_ptr<GaiaAuthFetcher> client_login_; | 166 scoped_ptr<GaiaAuthFetcher> client_login_; |
164 | 167 |
165 // Register for notifications from the TokenService. | 168 // Register for notifications from the TokenService. |
166 content::NotificationRegistrar registrar_; | 169 content::NotificationRegistrar registrar_; |
167 | 170 |
168 std::string authenticated_username_; | 171 std::string authenticated_username_; |
169 | 172 |
170 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 173 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
171 }; | 174 }; |
172 | 175 |
173 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 176 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
OLD | NEW |