Chromium Code Reviews| 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. See SigninManagerBase for full description of |
| 7 // request is run on their behalf. Auth tokens are fetched from Google | 7 // responsibilities. The class defined in this file provides functionality |
| 8 // and the results are stored in the TokenService. | 8 // required by non non-Chrome OS platforms. |
|
Roger Tawa OOO till Jul 10th
2013/04/05 20:53:57
"non non-Chrome OS platforms" --> "all platforms e
tim (not reviewing)
2013/04/05 22:14:12
Oh, that was one 'non's too many :) All non Chrom
| |
| 9 // | 9 // |
| 10 // **NOTE** on semantics of SigninManager: | 10 // When a user is signed in, a ClientLogin request is run on their behalf. |
|
Roger Tawa OOO till Jul 10th
2013/04/05 20:53:57
ClientLogin request is not used anymore. Mention
tim (not reviewing)
2013/04/05 22:14:12
Actually after signin happens we still use client
| |
| 11 // | 11 // Auth tokens are fetched from Googleand the results are stored in the |
| 12 // Once a signin is successful, the username becomes "established" and will not | 12 // TokenService. |
|
Andrew T Wilson (Slow)
2013/04/09 15:39:25
Googleand -> Google and
or Googleland! The tokeni
| |
| 13 // be cleared until a SignOut operation is performed (persists across | |
| 14 // restarts). Until that happens, the signin manager can still be used to | |
| 15 // refresh credentials, but changing the username is not permitted. | |
| 16 | 13 |
| 17 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 14 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
| 18 #define CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 15 #define CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
| 19 | 16 |
| 17 #if defined(OS_CHROMEOS) | |
| 18 // On Chrome OS, SigninManagerBase is all that exists. | |
| 19 #include "chrome/browser/signin/signin_manager_base.h" | |
| 20 | |
|
Andrew T Wilson (Slow)
2013/04/09 15:39:25
This seems weird - is this just to avoid changing
tim (not reviewing)
2013/04/16 03:28:29
This is what I was talking about in my earlier mes
| |
| 21 #else | |
| 22 | |
| 20 #include <string> | 23 #include <string> |
| 21 | 24 |
| 22 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
| 23 #include "base/gtest_prod_util.h" | 26 #include "base/gtest_prod_util.h" |
| 24 #include "base/logging.h" | 27 #include "base/logging.h" |
| 25 #include "base/memory/scoped_ptr.h" | 28 #include "base/memory/scoped_ptr.h" |
| 26 #include "base/observer_list.h" | 29 #include "base/observer_list.h" |
| 27 #include "base/prefs/pref_change_registrar.h" | 30 #include "base/prefs/pref_change_registrar.h" |
| 28 #include "base/prefs/pref_member.h" | 31 #include "base/prefs/pref_member.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/profiles/profile_keyed_service.h" | 33 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 31 #include "chrome/browser/signin/signin_internals_util.h" | 34 #include "chrome/browser/signin/signin_internals_util.h" |
| 35 #include "chrome/browser/signin/signin_manager_base.h" | |
| 32 #include "chrome/browser/signin/ubertoken_fetcher.h" | 36 #include "chrome/browser/signin/ubertoken_fetcher.h" |
| 33 #include "content/public/browser/notification_observer.h" | 37 #include "content/public/browser/notification_observer.h" |
| 34 #include "content/public/browser/notification_registrar.h" | 38 #include "content/public/browser/notification_registrar.h" |
| 35 #include "google_apis/gaia/gaia_auth_consumer.h" | 39 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 36 #include "google_apis/gaia/google_service_auth_error.h" | 40 #include "google_apis/gaia/google_service_auth_error.h" |
| 37 #include "net/cookies/canonical_cookie.h" | 41 #include "net/cookies/canonical_cookie.h" |
| 38 | 42 |
| 39 class CookieSettings; | 43 class CookieSettings; |
| 40 class GaiaAuthFetcher; | 44 class GaiaAuthFetcher; |
| 41 class ProfileIOData; | 45 class ProfileIOData; |
| 42 class PrefService; | 46 class PrefService; |
| 43 class SigninGlobalError; | 47 class SigninGlobalError; |
| 44 | 48 |
| 45 namespace policy { | 49 namespace policy { |
| 46 class CloudPolicyClient; | 50 class CloudPolicyClient; |
| 47 } | 51 } |
| 48 | 52 |
| 49 // Details for the Notification type GOOGLE_SIGNIN_SUCCESSFUL. | 53 class SigninManager : public SigninManagerBase, |
| 50 // A listener might use this to make note of a username / password | 54 public GaiaAuthConsumer, |
| 51 // pair for encryption keys. | |
| 52 struct GoogleServiceSigninSuccessDetails { | |
| 53 GoogleServiceSigninSuccessDetails(const std::string& in_username, | |
| 54 const std::string& in_password) | |
| 55 : username(in_username), | |
| 56 password(in_password) {} | |
| 57 std::string username; | |
| 58 std::string password; | |
| 59 }; | |
| 60 | |
| 61 // Details for the Notification type NOTIFICATION_GOOGLE_SIGNED_OUT. | |
| 62 struct GoogleServiceSignoutDetails { | |
| 63 explicit GoogleServiceSignoutDetails(const std::string& in_username) | |
| 64 : username(in_username) {} | |
| 65 std::string username; | |
| 66 }; | |
| 67 | |
| 68 class SigninManager : public GaiaAuthConsumer, | |
| 69 public UbertokenConsumer, | 55 public UbertokenConsumer, |
| 70 public content::NotificationObserver, | 56 public content::NotificationObserver { |
| 71 public ProfileKeyedService { | |
| 72 public: | 57 public: |
| 73 // Methods to register or remove SigninDiagnosticObservers | |
| 74 void AddSigninDiagnosticsObserver( | |
| 75 signin_internals_util::SigninDiagnosticsObserver* observer); | |
| 76 void RemoveSigninDiagnosticsObserver( | |
| 77 signin_internals_util::SigninDiagnosticsObserver* observer); | |
| 78 | |
| 79 // Returns true if the cookie policy for the given profile allows cookies | |
| 80 // for the Google signin domain. | |
| 81 static bool AreSigninCookiesAllowed(Profile* profile); | |
| 82 static bool AreSigninCookiesAllowed(CookieSettings* cookie_settings); | |
| 83 | |
| 84 // Returns true if the username is allowed based on the policy string. | |
| 85 static bool IsAllowedUsername(const std::string& username, | |
| 86 const std::string& policy); | |
| 87 | |
| 88 // Returns true if |url| is a web signin URL and should be hosted in an | 58 // Returns true if |url| is a web signin URL and should be hosted in an |
| 89 // isolated, privileged signin process. | 59 // isolated, privileged signin process. |
| 90 static bool IsWebBasedSigninFlowURL(const GURL& url); | 60 static bool IsWebBasedSigninFlowURL(const GURL& url); |
| 91 | 61 |
| 92 // This is used to distinguish URLs belonging to the special web signin flow | 62 // This is used to distinguish URLs belonging to the special web signin flow |
| 93 // running in the special signin process from other URLs on the same domain. | 63 // running in the special signin process from other URLs on the same domain. |
| 94 // We do not grant WebUI privilieges / bindings to this process or to URLs of | 64 // We do not grant WebUI privilieges / bindings to this process or to URLs of |
| 95 // this scheme; enforcement of privileges is handled separately by | 65 // this scheme; enforcement of privileges is handled separately by |
| 96 // OneClickSigninHelper. | 66 // OneClickSigninHelper. |
| 97 static const char* kChromeSigninEffectiveSite; | 67 static const char* kChromeSigninEffectiveSite; |
| 98 | 68 |
| 99 SigninManager(); | 69 SigninManager(); |
| 100 virtual ~SigninManager(); | 70 virtual ~SigninManager(); |
| 101 | 71 |
| 102 // If user was signed in, load tokens from DB if available. | |
| 103 void Initialize(Profile* profile); | |
| 104 bool IsInitialized() const; | |
| 105 | |
| 106 // Returns true if the passed username is allowed by policy. Virtual for | |
| 107 // mocking in tests. | |
| 108 virtual bool IsAllowedUsername(const std::string& username) const; | |
| 109 | |
| 110 // Returns true if a signin to Chrome is allowed (by policy or pref). | |
| 111 bool IsSigninAllowed() const; | |
| 112 | |
| 113 // Checks if signin is allowed for the profile that owns |io_data|. This must | |
| 114 // be invoked on the IO thread, and can be used to check if signin is enabled | |
| 115 // on that thread. | |
| 116 static bool IsSigninAllowedOnIOThread(ProfileIOData* io_data); | |
| 117 | |
| 118 // If a user has previously established a username and SignOut has not been | |
| 119 // called, this will return the username. | |
| 120 // Otherwise, it will return an empty string. | |
| 121 const std::string& GetAuthenticatedUsername() const; | |
| 122 | |
| 123 // Sets the user name. Note: |username| should be already authenticated as | |
| 124 // this is a sticky operation (in contrast to StartSignIn). | |
| 125 // TODO(tim): Remove this in favor of passing username on construction by | |
| 126 // (by platform / depending on StartBehavior). Bug 88109. | |
| 127 void SetAuthenticatedUsername(const std::string& username); | |
| 128 | |
| 129 // Attempt to sign in this user with ClientLogin. If successful, set a | 72 // Attempt to sign in this user with ClientLogin. If successful, set a |
| 130 // preference indicating the signed in user and send out a notification, | 73 // preference indicating the signed in user and send out a notification, |
| 131 // then start fetching tokens for the user. | 74 // then start fetching tokens for the user. |
| 132 // This is overridden for test subclasses that don't want to issue auth | 75 // This is overridden for test subclasses that don't want to issue auth |
| 133 // requests. | 76 // requests. |
| 134 virtual void StartSignIn(const std::string& username, | 77 virtual void StartSignIn(const std::string& username, |
| 135 const std::string& password, | 78 const std::string& password, |
| 136 const std::string& login_token, | 79 const std::string& login_token, |
| 137 const std::string& login_captcha); | 80 const std::string& login_captcha); |
| 138 | 81 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 157 // Provide a challenge solution to a failed signin attempt with | 100 // Provide a challenge solution to a failed signin attempt with |
| 158 // StartSignInWithOAuth(). |type| and |token| come from the | 101 // StartSignInWithOAuth(). |type| and |token| come from the |
| 159 // GoogleServiceAuthError of the failed attempt. | 102 // GoogleServiceAuthError of the failed attempt. |
| 160 // |solution| is the answer typed by the user. | 103 // |solution| is the answer typed by the user. |
| 161 void ProvideOAuthChallengeResponse(GoogleServiceAuthError::State type, | 104 void ProvideOAuthChallengeResponse(GoogleServiceAuthError::State type, |
| 162 const std::string& token, | 105 const std::string& token, |
| 163 const std::string& solution); | 106 const std::string& solution); |
| 164 | 107 |
| 165 // Sign a user out, removing the preference, erasing all keys | 108 // Sign a user out, removing the preference, erasing all keys |
| 166 // associated with the user, and canceling all auth in progress. | 109 // associated with the user, and canceling all auth in progress. |
| 167 virtual void SignOut(); | 110 virtual void SignOut() OVERRIDE; |
| 168 | 111 |
| 169 // Returns true if there's a signin in progress. Virtual so it can be | 112 // Returns true if there's a signin in progress. |
| 170 // overridden by mocks. | 113 virtual bool AuthInProgress() const OVERRIDE; |
| 171 virtual bool AuthInProgress() const; | |
| 172 | 114 |
| 173 // Handles errors if a required user info key is not returned from the | 115 // Handles errors if a required user info key is not returned from the |
| 174 // GetUserInfo call. | 116 // GetUserInfo call. |
| 175 void OnGetUserInfoKeyNotFound(const std::string& key); | 117 void OnGetUserInfoKeyNotFound(const std::string& key); |
| 176 | 118 |
| 177 // Set the profile preference to turn off one-click sign-in so that it won't | 119 // Set the profile preference to turn off one-click sign-in so that it won't |
| 178 // ever show it again in this profile (even if the user tries a new account). | 120 // ever show it again in this profile (even if the user tries a new account). |
| 179 static void DisableOneClickSignIn(Profile* profile); | 121 static void DisableOneClickSignIn(Profile* profile); |
| 180 | 122 |
| 181 // GaiaAuthConsumer | 123 // GaiaAuthConsumer |
| 182 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; | 124 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; |
| 183 virtual void OnClientLoginFailure( | 125 virtual void OnClientLoginFailure( |
| 184 const GoogleServiceAuthError& error) OVERRIDE; | 126 const GoogleServiceAuthError& error) OVERRIDE; |
| 185 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; | 127 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; |
| 186 virtual void OnClientOAuthFailure( | 128 virtual void OnClientOAuthFailure( |
| 187 const GoogleServiceAuthError& error) OVERRIDE; | 129 const GoogleServiceAuthError& error) OVERRIDE; |
| 188 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; | 130 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; |
| 189 virtual void OnGetUserInfoFailure( | 131 virtual void OnGetUserInfoFailure( |
| 190 const GoogleServiceAuthError& error) OVERRIDE; | 132 const GoogleServiceAuthError& error) OVERRIDE; |
| 191 | 133 |
| 192 // UbertokenConsumer | 134 // UbertokenConsumer |
| 193 virtual void OnUbertokenSuccess(const std::string& token) OVERRIDE; | 135 virtual void OnUbertokenSuccess(const std::string& token) OVERRIDE; |
| 194 virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE; | 136 virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE; |
| 195 | 137 |
| 196 // content::NotificationObserver | 138 // content::NotificationObserver |
| 197 virtual void Observe(int type, | 139 virtual void Observe(int type, |
| 198 const content::NotificationSource& source, | 140 const content::NotificationSource& source, |
| 199 const content::NotificationDetails& details) OVERRIDE; | 141 const content::NotificationDetails& details) OVERRIDE; |
| 200 | 142 |
| 201 SigninGlobalError* signin_global_error() { | |
| 202 return signin_global_error_.get(); | |
| 203 } | |
| 204 | |
| 205 const SigninGlobalError* signin_global_error() const { | |
| 206 return signin_global_error_.get(); | |
| 207 } | |
| 208 | |
| 209 // ProfileKeyedService implementation. | |
| 210 virtual void Shutdown() OVERRIDE; | |
| 211 | |
| 212 // Tells the SigninManager to prohibit signout for this profile. | 143 // Tells the SigninManager to prohibit signout for this profile. |
| 213 void ProhibitSignout(); | 144 void ProhibitSignout(); |
| 214 | 145 |
| 215 // If true, signout is prohibited for this profile (calls to SignOut() are | 146 // If true, signout is prohibited for this profile (calls to SignOut() are |
| 216 // ignored). | 147 // ignored). |
| 217 bool IsSignoutProhibited() const; | 148 bool IsSignoutProhibited() const; |
| 218 | 149 |
| 219 // Allows the SigninManager to track the privileged signin process | 150 // Allows the SigninManager to track the privileged signin process |
| 220 // identified by |process_id| so that we can later ask (via IsSigninProcess) | 151 // identified by |process_id| so that we can later ask (via IsSigninProcess) |
| 221 // if it is safe to sign the user in from the current context (see | 152 // if it is safe to sign the user in from the current context (see |
| 222 // OneClickSigninHelper). All of this tracking state is reset once the | 153 // OneClickSigninHelper). All of this tracking state is reset once the |
| 223 // renderer process terminates. | 154 // renderer process terminates. |
| 224 void SetSigninProcess(int process_id); | 155 void SetSigninProcess(int process_id); |
| 225 bool IsSigninProcess(int process_id) const; | 156 bool IsSigninProcess(int process_id) const; |
| 226 bool HasSigninProcess() const; | 157 bool HasSigninProcess() const; |
| 227 | 158 |
| 228 protected: | 159 protected: |
| 229 // Weak pointer to parent profile (protected so FakeSigninManager can access | 160 virtual bool ShouldSignOut() OVERRIDE; |
| 230 // it). | 161 // If user was signed in, load tokens from DB if available. |
| 231 Profile* profile_; | 162 virtual void InitTokenService() OVERRIDE; |
| 232 | |
| 233 // Used to show auth errors in the wrench menu. The SigninGlobalError is | |
| 234 // different than most GlobalErrors in that its lifetime is controlled by | |
| 235 // SigninManager (so we can expose a reference for use in the wrench menu). | |
| 236 scoped_ptr<SigninGlobalError> signin_global_error_; | |
| 237 | 163 |
| 238 // Flag saying whether signing out is allowed. | 164 // Flag saying whether signing out is allowed. |
| 239 bool prohibit_signout_; | 165 bool prohibit_signout_; |
| 240 | 166 |
| 241 private: | 167 private: |
| 242 enum SigninType { | 168 enum SigninType { |
| 243 SIGNIN_TYPE_NONE, | 169 SIGNIN_TYPE_NONE, |
| 244 SIGNIN_TYPE_CLIENT_LOGIN, | 170 SIGNIN_TYPE_CLIENT_LOGIN, |
| 245 SIGNIN_TYPE_WITH_CREDENTIALS, | 171 SIGNIN_TYPE_WITH_CREDENTIALS, |
| 246 SIGNIN_TYPE_CLIENT_OAUTH, | 172 SIGNIN_TYPE_CLIENT_OAUTH, |
| 247 }; | 173 }; |
| 248 | 174 |
| 249 std::string SigninTypeToString(SigninType type); | 175 std::string SigninTypeToString(SigninType type); |
| 250 | 176 |
| 251 friend class FakeSigninManager; | |
| 252 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); | 177 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); |
| 253 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); | 178 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); |
| 254 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); | 179 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); |
| 255 | 180 |
| 256 // Called to setup the transient signin data during one of the | 181 // Called to setup the transient signin data during one of the |
| 257 // StartSigninXXX methods. |type| indicates which of the methods is being | 182 // StartSigninXXX methods. |type| indicates which of the methods is being |
| 258 // used to perform the signin while |username| and |password| identify the | 183 // used to perform the signin while |username| and |password| identify the |
| 259 // account to be signed in. Returns false and generates an auth error if the | 184 // account to be signed in. Returns false and generates an auth error if the |
| 260 // passed |username| is not allowed by policy. | 185 // passed |username| is not allowed by policy. |
| 261 bool PrepareForSignin(SigninType type, | 186 bool PrepareForSignin(SigninType type, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 275 // Will clear in memory data but leaves the db as such so when the browser | 200 // Will clear in memory data but leaves the db as such so when the browser |
| 276 // restarts we can use the old token(which might throw a password error). | 201 // restarts we can use the old token(which might throw a password error). |
| 277 void ClearTransientSigninData(); | 202 void ClearTransientSigninData(); |
| 278 | 203 |
| 279 // Called to handle an error from a GAIA auth fetch. Sets the last error | 204 // Called to handle an error from a GAIA auth fetch. Sets the last error |
| 280 // to |error|, sends out a notification of login failure, and clears the | 205 // to |error|, sends out a notification of login failure, and clears the |
| 281 // transient signin data if |clear_transient_data| is true. | 206 // transient signin data if |clear_transient_data| is true. |
| 282 void HandleAuthError(const GoogleServiceAuthError& error, | 207 void HandleAuthError(const GoogleServiceAuthError& error, |
| 283 bool clear_transient_data); | 208 bool clear_transient_data); |
| 284 | 209 |
| 285 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) | 210 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 286 // Callback invoked once policy registration is complete. If registration | 211 // Callback invoked once policy registration is complete. If registration |
| 287 // fails, |client| will be null. | 212 // fails, |client| will be null. |
| 288 void OnRegisteredForPolicy(scoped_ptr<policy::CloudPolicyClient> client); | 213 void OnRegisteredForPolicy(scoped_ptr<policy::CloudPolicyClient> client); |
| 289 | 214 |
| 290 // Callback invoked when a policy fetch request has completed. |success| is | 215 // Callback invoked when a policy fetch request has completed. |success| is |
| 291 // true if policy was successfully fetched. | 216 // true if policy was successfully fetched. |
| 292 void OnPolicyFetchComplete(bool success); | 217 void OnPolicyFetchComplete(bool success); |
| 293 | 218 |
| 294 // Called to create a new profile, which is then signed in with the | 219 // Called to create a new profile, which is then signed in with the |
| 295 // in-progress auth credentials currently stored in this object. | 220 // in-progress auth credentials currently stored in this object. |
| 296 void TransferCredentialsToNewProfile(); | 221 void TransferCredentialsToNewProfile(); |
| 297 | 222 |
| 298 // Helper function that loads policy with the passed CloudPolicyClient, then | 223 // Helper function that loads policy with the passed CloudPolicyClient, then |
| 299 // completes the signin process. | 224 // completes the signin process. |
| 300 void LoadPolicyWithCachedClient(); | 225 void LoadPolicyWithCachedClient(); |
| 301 | 226 |
| 302 // Callback invoked once a profile is created, so we can complete the | 227 // Callback invoked once a profile is created, so we can complete the |
| 303 // credentials transfer and load policy. | 228 // credentials transfer and load policy. |
| 304 void CompleteSigninForNewProfile(Profile* profile, | 229 void CompleteSigninForNewProfile(Profile* profile, |
| 305 Profile::CreateStatus status); | 230 Profile::CreateStatus status); |
| 306 #endif // defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) | 231 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 307 | 232 |
| 308 // Invoked once policy has been loaded to complete user signin. | 233 // Invoked once policy has been loaded to complete user signin. |
| 309 void CompleteSigninAfterPolicyLoad(); | 234 void CompleteSigninAfterPolicyLoad(); |
| 310 | 235 |
| 311 // ClientLogin identity. | 236 // ClientLogin identity. |
| 312 std::string possibly_invalid_username_; | 237 std::string possibly_invalid_username_; |
| 313 std::string password_; // This is kept empty whenever possible. | 238 std::string password_; // This is kept empty whenever possible. |
| 314 bool had_two_factor_error_; | 239 bool had_two_factor_error_; |
| 315 | 240 |
| 316 void CleanupNotificationRegistration(); | 241 void CleanupNotificationRegistration(); |
| 317 | 242 |
| 318 void OnGoogleServicesUsernamePatternChanged(); | |
| 319 | |
| 320 void OnSigninAllowedPrefChanged(); | |
| 321 | |
| 322 // Helper methods to notify all registered diagnostics observers with. | |
| 323 void NotifyDiagnosticsObservers( | |
| 324 const signin_internals_util::UntimedSigninStatusField& field, | |
| 325 const std::string& value); | |
| 326 void NotifyDiagnosticsObservers( | |
| 327 const signin_internals_util::TimedSigninStatusField& field, | |
| 328 const std::string& value); | |
| 329 | |
| 330 // Result of the last client login, kept pending the lookup of the | 243 // Result of the last client login, kept pending the lookup of the |
| 331 // canonical email. | 244 // canonical email. |
| 332 ClientLoginResult last_result_; | 245 ClientLoginResult last_result_; |
| 333 | 246 |
| 334 // Actual client login handler. | 247 // Actual client login handler. |
| 335 scoped_ptr<GaiaAuthFetcher> client_login_; | 248 scoped_ptr<GaiaAuthFetcher> client_login_; |
| 336 | 249 |
| 337 // Registrar for notifications from the TokenService. | 250 // Registrar for notifications from the TokenService. |
| 338 content::NotificationRegistrar registrar_; | 251 content::NotificationRegistrar registrar_; |
| 339 | 252 |
| 340 // UbertokenFetcher to login to user to the web property. | 253 // UbertokenFetcher to login to user to the web property. |
| 341 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_; | 254 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_; |
| 342 | 255 |
| 343 // Helper object to listen for changes to signin preferences stored in non- | |
| 344 // profile-specific local prefs (like kGoogleServicesUsernamePattern). | |
| 345 PrefChangeRegistrar local_state_pref_registrar_; | |
| 346 | |
| 347 // Helper object to listen for changes to the signin allowed preference. | |
| 348 BooleanPrefMember signin_allowed_; | |
| 349 | |
| 350 // Actual username after successful authentication. | |
| 351 std::string authenticated_username_; | |
| 352 | |
| 353 // The type of sign being performed. This value is valid only between a call | 256 // The type of sign being performed. This value is valid only between a call |
| 354 // to one of the StartSigninXXX methods and when the sign in is either | 257 // to one of the StartSigninXXX methods and when the sign in is either |
| 355 // successful or not. | 258 // successful or not. |
| 356 SigninType type_; | 259 SigninType type_; |
| 357 | 260 |
| 358 // Temporarily saves the oauth2 refresh and access tokens when signing in | 261 // Temporarily saves the oauth2 refresh and access tokens when signing in |
| 359 // with credentials. These will be passed to TokenService so that it does | 262 // with credentials. These will be passed to TokenService so that it does |
| 360 // not need to mint new ones. | 263 // not need to mint new ones. |
| 361 ClientOAuthResult temp_oauth_login_tokens_; | 264 ClientOAuthResult temp_oauth_login_tokens_; |
| 362 | 265 |
| 363 // The list of SigninDiagnosticObservers. | |
| 364 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true> | |
| 365 signin_diagnostics_observers_; | |
| 366 | |
| 367 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; | 266 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; |
| 368 | 267 |
| 369 // See SetSigninProcess. Tracks the currently active signin process | 268 // See SetSigninProcess. Tracks the currently active signin process |
| 370 // by ID, if there is one. | 269 // by ID, if there is one. |
| 371 int signin_process_id_; | 270 int signin_process_id_; |
| 372 | 271 |
| 373 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) | 272 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 374 // CloudPolicyClient reference we keep while determining whether to create | 273 // CloudPolicyClient reference we keep while determining whether to create |
| 375 // a new profile for an enterprise user or not. | 274 // a new profile for an enterprise user or not. |
| 376 scoped_ptr<policy::CloudPolicyClient> policy_client_; | 275 scoped_ptr<policy::CloudPolicyClient> policy_client_; |
| 377 #endif | 276 #endif |
| 378 | 277 |
| 379 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 278 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
| 380 }; | 279 }; |
| 381 | 280 |
| 281 #endif // !defined(OS_CHROMEOS) | |
| 282 | |
| 382 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 283 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
| OLD | NEW |