| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual void OnListAccountsSuccess(const std::string& data) = 0; | 43 virtual void OnListAccountsSuccess(const std::string& data) = 0; |
| 44 | 44 |
| 45 // Invoked when post-merge session verification fails. | 45 // Invoked when post-merge session verification fails. |
| 46 virtual void OnListAccountsFailure(bool connection_error) = 0; | 46 virtual void OnListAccountsFailure(bool connection_error) = 0; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 OAuth2LoginVerifier(OAuth2LoginVerifier::Delegate* delegate, | 49 OAuth2LoginVerifier(OAuth2LoginVerifier::Delegate* delegate, |
| 50 net::URLRequestContextGetter* system_request_context, | 50 net::URLRequestContextGetter* system_request_context, |
| 51 net::URLRequestContextGetter* user_request_context, | 51 net::URLRequestContextGetter* user_request_context, |
| 52 const std::string& oauthlogin_access_token); | 52 const std::string& oauthlogin_access_token); |
| 53 virtual ~OAuth2LoginVerifier(); | 53 ~OAuth2LoginVerifier() override; |
| 54 | 54 |
| 55 // Initiates verification of GAIA cookies in |profile|'s cookie jar. | 55 // Initiates verification of GAIA cookies in |profile|'s cookie jar. |
| 56 void VerifyUserCookies(Profile* profile); | 56 void VerifyUserCookies(Profile* profile); |
| 57 | 57 |
| 58 // Attempts to restore session from OAuth2 refresh token minting all necesarry | 58 // Attempts to restore session from OAuth2 refresh token minting all necesarry |
| 59 // tokens along the way (OAuth2 access token, SID/LSID, GAIA service token). | 59 // tokens along the way (OAuth2 access token, SID/LSID, GAIA service token). |
| 60 void VerifyProfileTokens(Profile* profile); | 60 void VerifyProfileTokens(Profile* profile); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 enum SessionRestoreType { | 63 enum SessionRestoreType { |
| 64 RESTORE_UNDEFINED = 0, | 64 RESTORE_UNDEFINED = 0, |
| 65 RESTORE_FROM_GAIA_TOKEN = 1, | 65 RESTORE_FROM_GAIA_TOKEN = 1, |
| 66 RESTORE_FROM_OAUTH2_REFRESH_TOKEN = 2, | 66 RESTORE_FROM_OAUTH2_REFRESH_TOKEN = 2, |
| 67 }; | 67 }; |
| 68 // GaiaAuthConsumer overrides. | 68 // GaiaAuthConsumer overrides. |
| 69 virtual void OnUberAuthTokenSuccess(const std::string& token) override; | 69 void OnUberAuthTokenSuccess(const std::string& token) override; |
| 70 virtual void OnUberAuthTokenFailure( | 70 void OnUberAuthTokenFailure(const GoogleServiceAuthError& error) override; |
| 71 const GoogleServiceAuthError& error) override; | 71 void OnMergeSessionSuccess(const std::string& data) override; |
| 72 virtual void OnMergeSessionSuccess(const std::string& data) override; | 72 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; |
| 73 virtual void OnMergeSessionFailure( | 73 void OnListAccountsSuccess(const std::string& data) override; |
| 74 const GoogleServiceAuthError& error) override; | 74 void OnListAccountsFailure(const GoogleServiceAuthError& error) override; |
| 75 virtual void OnListAccountsSuccess(const std::string& data) override; | |
| 76 virtual void OnListAccountsFailure( | |
| 77 const GoogleServiceAuthError& error) override; | |
| 78 | 75 |
| 79 // OAuth2TokenService::Consumer overrides. | 76 // OAuth2TokenService::Consumer overrides. |
| 80 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 77 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 81 const std::string& access_token, | 78 const std::string& access_token, |
| 82 const base::Time& expiration_time) override; | 79 const base::Time& expiration_time) override; |
| 83 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 80 void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 84 const GoogleServiceAuthError& error) override; | 81 const GoogleServiceAuthError& error) override; |
| 85 | 82 |
| 86 // Starts fetching OAuth1 access token for OAuthLogin call. | 83 // Starts fetching OAuth1 access token for OAuthLogin call. |
| 87 void StartFetchingOAuthLoginAccessToken(Profile* profile); | 84 void StartFetchingOAuthLoginAccessToken(Profile* profile); |
| 88 | 85 |
| 89 // Starts OAuthLogin request for GAIA uber-token. | 86 // Starts OAuthLogin request for GAIA uber-token. |
| 90 void StartOAuthLoginForUberToken(); | 87 void StartOAuthLoginForUberToken(); |
| 91 | 88 |
| 92 // Attempts to merge session from present |gaia_token_|. | 89 // Attempts to merge session from present |gaia_token_|. |
| 93 void StartMergeSession(); | 90 void StartMergeSession(); |
| 94 | 91 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 118 scoped_ptr<OAuth2TokenService::Request> login_token_request_; | 115 scoped_ptr<OAuth2TokenService::Request> login_token_request_; |
| 119 // The retry counter. Increment this only when failure happened. | 116 // The retry counter. Increment this only when failure happened. |
| 120 int retry_count_; | 117 int retry_count_; |
| 121 | 118 |
| 122 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginVerifier); | 119 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginVerifier); |
| 123 }; | 120 }; |
| 124 | 121 |
| 125 } // namespace chromeos | 122 } // namespace chromeos |
| 126 | 123 |
| 127 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ | 124 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ |
| OLD | NEW |