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