| 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 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 virtual ~Delegate() {} | 25 virtual ~Delegate() {} |
| 26 // Invoked when cookie session is successfully merged. | 26 // Invoked when cookie session is successfully merged. |
| 27 virtual void OnSessionMergeSuccess() = 0; | 27 virtual void OnSessionMergeSuccess() = 0; |
| 28 | 28 |
| 29 // Invoked when cookie session can not be merged. | 29 // Invoked when cookie session can not be merged. |
| 30 virtual void OnSessionMergeFailure(bool connection_error) = 0; | 30 virtual void OnSessionMergeFailure(bool connection_error) = 0; |
| 31 | 31 |
| 32 // Invoked when account list is retrieved during post-merge session | 32 // Invoked when account list is retrieved during post-merge session |
| 33 // verification. | 33 // verification. |
| 34 virtual void OnListAccountsSuccess( | 34 virtual void OnListAccountsSuccess( |
| 35 const std::vector<std::pair<std::string, bool>>& accounts) = 0; | 35 const std::vector<gaia::ListedAccount>& accounts) = 0; |
| 36 | 36 |
| 37 // Invoked when post-merge session verification fails. | 37 // Invoked when post-merge session verification fails. |
| 38 virtual void OnListAccountsFailure(bool connection_error) = 0; | 38 virtual void OnListAccountsFailure(bool connection_error) = 0; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 OAuth2LoginVerifier(OAuth2LoginVerifier::Delegate* delegate, | 41 OAuth2LoginVerifier(OAuth2LoginVerifier::Delegate* delegate, |
| 42 GaiaCookieManagerService* cookie_manager_service, | 42 GaiaCookieManagerService* cookie_manager_service, |
| 43 const std::string& primary_account_id, | 43 const std::string& primary_account_id, |
| 44 const std::string& oauthlogin_access_token); | 44 const std::string& oauthlogin_access_token); |
| 45 ~OAuth2LoginVerifier() override; | 45 ~OAuth2LoginVerifier() override; |
| 46 | 46 |
| 47 // Initiates verification of GAIA cookies in |profile|'s cookie jar. | 47 // Initiates verification of GAIA cookies in |profile|'s cookie jar. |
| 48 void VerifyUserCookies(Profile* profile); | 48 void VerifyUserCookies(Profile* profile); |
| 49 | 49 |
| 50 // Attempts to restore session from OAuth2 refresh token minting all necessary | 50 // Attempts to restore session from OAuth2 refresh token minting all necessary |
| 51 // tokens along the way (OAuth2 access token, SID/LSID, GAIA service token). | 51 // tokens along the way (OAuth2 access token, SID/LSID, GAIA service token). |
| 52 void VerifyProfileTokens(Profile* profile); | 52 void VerifyProfileTokens(Profile* profile); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 // GaiaCookieManagerService::Observer | 55 // GaiaCookieManagerService::Observer |
| 56 void OnAddAccountToCookieCompleted( | 56 void OnAddAccountToCookieCompleted( |
| 57 const std::string& account_id, | 57 const std::string& account_id, |
| 58 const GoogleServiceAuthError& error) override; | 58 const GoogleServiceAuthError& error) override; |
| 59 void OnGaiaAccountsInCookieUpdated( | 59 void OnGaiaAccountsInCookieUpdated( |
| 60 const std::vector<std::pair<std::string, bool> >& accounts, | 60 const std::vector<gaia::ListedAccount>& accounts, |
| 61 const GoogleServiceAuthError& error) override; | 61 const GoogleServiceAuthError& error) override; |
| 62 | 62 |
| 63 OAuth2LoginVerifier::Delegate* delegate_; | 63 OAuth2LoginVerifier::Delegate* delegate_; |
| 64 GaiaCookieManagerService* cookie_manager_service_; | 64 GaiaCookieManagerService* cookie_manager_service_; |
| 65 const std::string& primary_account_id_; | 65 const std::string& primary_account_id_; |
| 66 const std::string access_token_; | 66 const std::string access_token_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginVerifier); | 68 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginVerifier); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace chromeos | 71 } // namespace chromeos |
| 72 | 72 |
| 73 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ | 73 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_VERIFIER_H_ |
| OLD | NEW |