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. 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 // requests. | 75 // requests. |
| 76 virtual void StartSignIn(const std::string& username, | 76 virtual void StartSignIn(const std::string& username, |
| 77 const std::string& password, | 77 const std::string& password, |
| 78 const std::string& login_token, | 78 const std::string& login_token, |
| 79 const std::string& login_captcha); | 79 const std::string& login_captcha); |
| 80 | 80 |
| 81 // Used when a second factor access code was required to complete a signin | 81 // Used when a second factor access code was required to complete a signin |
| 82 // attempt. | 82 // attempt. |
| 83 void ProvideSecondFactorAccessCode(const std::string& access_code); | 83 void ProvideSecondFactorAccessCode(const std::string& access_code); |
| 84 | 84 |
| 85 // Attempt to sign in this user with existing credentials from the cookie jar. | |
| 86 // Otherwise the result is the same as StartSignIn(). | |
|
Andrew T Wilson (Slow)
2012/02/27 19:00:10
Can you clarify this - does this mean we try to lo
Roger Tawa OOO till Jul 10th
2012/02/29 21:02:54
No only one login, and this with no user interacti
| |
| 87 virtual void StartSignInWithCredentials(const std::string& username, | |
| 88 const std::string& password); | |
| 89 | |
| 85 // Sign a user out, removing the preference, erasing all keys | 90 // Sign a user out, removing the preference, erasing all keys |
| 86 // associated with the user, and canceling all auth in progress. | 91 // associated with the user, and canceling all auth in progress. |
| 87 virtual void SignOut(); | 92 virtual void SignOut(); |
| 88 | 93 |
| 89 // Returns the auth error associated with the last login attempt, or None if | 94 // Returns the auth error associated with the last login attempt, or None if |
| 90 // there have been no login failures. | 95 // there have been no login failures. |
| 91 virtual const GoogleServiceAuthError& GetLoginAuthError() const; | 96 virtual const GoogleServiceAuthError& GetLoginAuthError() const; |
| 92 | 97 |
| 93 // Returns true if there's a signin in progress. | 98 // Returns true if there's a signin in progress. |
| 94 bool AuthInProgress() const; | 99 bool AuthInProgress() const; |
| 95 | 100 |
| 96 // Handles errors if a required user info key is not returned from the | 101 // Handles errors if a required user info key is not returned from the |
| 97 // GetUserInfo call. | 102 // GetUserInfo call. |
| 98 void OnGetUserInfoKeyNotFound(const std::string& key); | 103 void OnGetUserInfoKeyNotFound(const std::string& key); |
| 99 | 104 |
| 100 // GaiaAuthConsumer | 105 // GaiaAuthConsumer |
| 101 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; | 106 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; |
| 102 virtual void OnClientLoginFailure( | 107 virtual void OnClientLoginFailure( |
| 103 const GoogleServiceAuthError& error) OVERRIDE; | 108 const GoogleServiceAuthError& error) OVERRIDE; |
| 109 virtual void OnOAuthLoginTokenSuccess(const std::string& refresh_token, | |
| 110 const std::string& access_token, | |
| 111 int expires_in_secs) OVERRIDE; | |
| 112 virtual void OnOAuthLoginTokenFailure( | |
| 113 const GoogleServiceAuthError& error) OVERRIDE; | |
| 104 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; | 114 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; |
| 105 virtual void OnGetUserInfoFailure( | 115 virtual void OnGetUserInfoFailure( |
| 106 const GoogleServiceAuthError& error) OVERRIDE; | 116 const GoogleServiceAuthError& error) OVERRIDE; |
| 117 virtual void OnTokenAuthSuccess(const net::ResponseCookies& cookies, | |
| 118 const std::string& data) OVERRIDE; | |
| 107 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) OVERRIDE; | 119 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) OVERRIDE; |
| 120 virtual void OnUberAuthTokenSuccess(const std::string& token) OVERRIDE; | |
| 121 virtual void OnUberAuthTokenFailure( | |
| 122 const GoogleServiceAuthError& error) OVERRIDE; | |
| 108 | 123 |
| 109 // content::NotificationObserver | 124 // content::NotificationObserver |
| 110 virtual void Observe(int type, | 125 virtual void Observe(int type, |
| 111 const content::NotificationSource& source, | 126 const content::NotificationSource& source, |
| 112 const content::NotificationDetails& details) OVERRIDE; | 127 const content::NotificationDetails& details) OVERRIDE; |
| 113 | 128 |
| 114 private: | 129 private: |
| 115 friend class FakeSigninManager; | 130 friend class FakeSigninManager; |
| 116 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); | 131 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); |
| 117 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); | 132 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 145 // The last error we received when logging in (used to retrieve details like | 160 // The last error we received when logging in (used to retrieve details like |
| 146 // captchas, etc). | 161 // captchas, etc). |
| 147 GoogleServiceAuthError last_login_auth_error_; | 162 GoogleServiceAuthError last_login_auth_error_; |
| 148 | 163 |
| 149 std::string authenticated_username_; | 164 std::string authenticated_username_; |
| 150 | 165 |
| 151 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 166 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
| 152 }; | 167 }; |
| 153 | 168 |
| 154 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 169 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
| OLD | NEW |