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 | |
148 private: | 143 private: |
149 enum SigninType { | 144 enum SigninType { |
150 SIGNIN_TYPE_NONE, | 145 SIGNIN_TYPE_NONE, |
151 SIGNIN_TYPE_CLIENT_LOGIN, | 146 SIGNIN_TYPE_CLIENT_LOGIN, |
152 SIGNIN_TYPE_WITH_CREDENTIALS, | 147 SIGNIN_TYPE_WITH_CREDENTIALS, |
153 SIGNIN_TYPE_CLIENT_OAUTH, | 148 SIGNIN_TYPE_CLIENT_OAUTH, |
154 }; | 149 }; |
155 | 150 |
156 friend class FakeSigninManager; | 151 friend class FakeSigninManager; |
157 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); | 152 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); |
(...skipping 13 matching lines...) Expand all Loading... |
171 // Will clear in memory data but leaves the db as such so when the browser | 166 // Will clear in memory data but leaves the db as such so when the browser |
172 // restarts we can use the old token(which might throw a password error). | 167 // restarts we can use the old token(which might throw a password error). |
173 void ClearTransientSigninData(); | 168 void ClearTransientSigninData(); |
174 | 169 |
175 // Called to handle an error from a GAIA auth fetch. Sets the last error | 170 // Called to handle an error from a GAIA auth fetch. Sets the last error |
176 // to |error|, sends out a notification of login failure, and clears the | 171 // to |error|, sends out a notification of login failure, and clears the |
177 // transient signin data if |clear_transient_data| is true. | 172 // transient signin data if |clear_transient_data| is true. |
178 void HandleAuthError(const GoogleServiceAuthError& error, | 173 void HandleAuthError(const GoogleServiceAuthError& error, |
179 bool clear_transient_data); | 174 bool clear_transient_data); |
180 | 175 |
| 176 Profile* profile_; |
| 177 |
181 // ClientLogin identity. | 178 // ClientLogin identity. |
182 std::string possibly_invalid_username_; | 179 std::string possibly_invalid_username_; |
183 std::string password_; // This is kept empty whenever possible. | 180 std::string password_; // This is kept empty whenever possible. |
184 bool had_two_factor_error_; | 181 bool had_two_factor_error_; |
185 | 182 |
186 void CleanupNotificationRegistration(); | 183 void CleanupNotificationRegistration(); |
187 | 184 |
188 // Result of the last client login, kept pending the lookup of the | 185 // Result of the last client login, kept pending the lookup of the |
189 // canonical email. | 186 // canonical email. |
190 ClientLoginResult last_result_; | 187 ClientLoginResult last_result_; |
(...skipping 13 matching lines...) Expand all Loading... |
204 | 201 |
205 // The type of sign being performed. This value is valid only between a call | 202 // The type of sign being performed. This value is valid only between a call |
206 // to one of the StartSigninXXX methods and when the sign in is either | 203 // to one of the StartSigninXXX methods and when the sign in is either |
207 // successful or not. | 204 // successful or not. |
208 SigninType type_; | 205 SigninType type_; |
209 | 206 |
210 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 207 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
211 }; | 208 }; |
212 | 209 |
213 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 210 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
OLD | NEW |