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 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/signin/signin_internals_util.h" | 29 #include "chrome/browser/signin/signin_internals_util.h" |
30 #include "content/public/browser/notification_observer.h" | 30 #include "content/public/browser/notification_observer.h" |
31 #include "content/public/browser/notification_registrar.h" | 31 #include "content/public/browser/notification_registrar.h" |
32 #include "google_apis/gaia/gaia_auth_consumer.h" | 32 #include "google_apis/gaia/gaia_auth_consumer.h" |
33 #include "google_apis/gaia/google_service_auth_error.h" | 33 #include "google_apis/gaia/google_service_auth_error.h" |
34 | 34 |
35 class CookieSettings; | 35 class CookieSettings; |
36 class GaiaAuthFetcher; | 36 class GaiaAuthFetcher; |
37 class Profile; | 37 class Profile; |
38 class PrefService; | 38 class PrefService; |
39 class SigninGlobalError; | |
40 | 39 |
41 // Details for the Notification type GOOGLE_SIGNIN_SUCCESSFUL. | 40 // Details for the Notification type GOOGLE_SIGNIN_SUCCESSFUL. |
42 // A listener might use this to make note of a username / password | 41 // A listener might use this to make note of a username / password |
43 // pair for encryption keys. | 42 // pair for encryption keys. |
44 struct GoogleServiceSigninSuccessDetails { | 43 struct GoogleServiceSigninSuccessDetails { |
45 GoogleServiceSigninSuccessDetails(const std::string& in_username, | 44 GoogleServiceSigninSuccessDetails(const std::string& in_username, |
46 const std::string& in_password) | 45 const std::string& in_password) |
47 : username(in_username), | 46 : username(in_username), |
48 password(in_password) {} | 47 password(in_password) {} |
49 std::string username; | 48 std::string username; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const GoogleServiceAuthError& error) OVERRIDE; | 158 const GoogleServiceAuthError& error) OVERRIDE; |
160 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; | 159 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; |
161 virtual void OnGetUserInfoFailure( | 160 virtual void OnGetUserInfoFailure( |
162 const GoogleServiceAuthError& error) OVERRIDE; | 161 const GoogleServiceAuthError& error) OVERRIDE; |
163 | 162 |
164 // content::NotificationObserver | 163 // content::NotificationObserver |
165 virtual void Observe(int type, | 164 virtual void Observe(int type, |
166 const content::NotificationSource& source, | 165 const content::NotificationSource& source, |
167 const content::NotificationDetails& details) OVERRIDE; | 166 const content::NotificationDetails& details) OVERRIDE; |
168 | 167 |
169 SigninGlobalError* signin_global_error() { | |
170 return signin_global_error_.get(); | |
171 } | |
172 | |
173 // ProfileKeyedService implementation. | |
174 virtual void Shutdown() OVERRIDE; | |
175 | |
176 protected: | 168 protected: |
177 // Weak pointer to parent profile (protected so FakeSigninManager can access | 169 // Weak pointer to parent profile (protected so FakeSigninManager can access |
178 // it). | 170 // it). |
179 Profile* profile_; | 171 Profile* profile_; |
180 | 172 |
181 // Used to show auth errors in the wrench menu. The SigninGlobalError is | |
182 // different than most GlobalErrors in that its lifetime is controlled by | |
183 // SigninManager (so we can expose a reference for use in the wrench menu). | |
184 scoped_ptr<SigninGlobalError> signin_global_error_; | |
185 | |
186 private: | 173 private: |
187 enum SigninType { | 174 enum SigninType { |
188 SIGNIN_TYPE_NONE, | 175 SIGNIN_TYPE_NONE, |
189 SIGNIN_TYPE_CLIENT_LOGIN, | 176 SIGNIN_TYPE_CLIENT_LOGIN, |
190 SIGNIN_TYPE_WITH_CREDENTIALS, | 177 SIGNIN_TYPE_WITH_CREDENTIALS, |
191 SIGNIN_TYPE_CLIENT_OAUTH, | 178 SIGNIN_TYPE_CLIENT_OAUTH, |
192 }; | 179 }; |
193 | 180 |
194 std::string SigninTypeToString(SigninType type); | 181 std::string SigninTypeToString(SigninType type); |
195 | 182 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // The type of sign being performed. This value is valid only between a call | 242 // The type of sign being performed. This value is valid only between a call |
256 // to one of the StartSigninXXX methods and when the sign in is either | 243 // to one of the StartSigninXXX methods and when the sign in is either |
257 // successful or not. | 244 // successful or not. |
258 SigninType type_; | 245 SigninType type_; |
259 | 246 |
260 // Temporarily saves the oauth2 refresh and access tokens when signing in | 247 // Temporarily saves the oauth2 refresh and access tokens when signing in |
261 // with credentials. These will be passed to TokenService so that it does | 248 // with credentials. These will be passed to TokenService so that it does |
262 // not need to mint new ones. | 249 // not need to mint new ones. |
263 ClientOAuthResult temp_oauth_login_tokens_; | 250 ClientOAuthResult temp_oauth_login_tokens_; |
264 | 251 |
265 // The list of SigninDiagnosticObservers. | 252 // The list of SigninDiagnosticObservers |
266 ObserverList<signin_internals_util::SigninDiagnosticsObserver> | 253 ObserverList<signin_internals_util::SigninDiagnosticsObserver> |
267 signin_diagnostics_observers_; | 254 signin_diagnostics_observers_; |
268 | 255 |
269 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 256 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
270 }; | 257 }; |
271 | 258 |
272 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 259 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
OLD | NEW |