| 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 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ | 4 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ |
| 5 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ | 5 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 void Shutdown() override; | 64 void Shutdown() override; |
| 65 | 65 |
| 66 // Determine what the reconcilor is currently doing. | 66 // Determine what the reconcilor is currently doing. |
| 67 State GetState(); | 67 State GetState(); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 bool IsRegisteredWithTokenService() const { | 70 bool IsRegisteredWithTokenService() const { |
| 71 return registered_with_token_service_; | 71 return registered_with_token_service_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 const std::vector<std::pair<std::string, bool> >& GetGaiaAccountsForTesting() | |
| 75 const { | |
| 76 return gaia_accounts_; | |
| 77 } | |
| 78 | |
| 79 friend class AccountReconcilorTest; | 74 friend class AccountReconcilorTest; |
| 80 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, SigninManagerRegistration); | 75 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, SigninManagerRegistration); |
| 81 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, Reauth); | 76 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, Reauth); |
| 82 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ProfileAlreadyConnected); | 77 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ProfileAlreadyConnected); |
| 83 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, | 78 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, |
| 84 StartReconcileCookiesDisabled); | 79 StartReconcileCookiesDisabled); |
| 85 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, | 80 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, |
| 86 StartReconcileContentSettings); | 81 StartReconcileContentSettings); |
| 87 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, | 82 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, |
| 88 StartReconcileContentSettingsGaiaUrl); | 83 StartReconcileContentSettingsGaiaUrl); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 const ContentSettingsPattern& primary_pattern, | 135 const ContentSettingsPattern& primary_pattern, |
| 141 const ContentSettingsPattern& secondary_pattern, | 136 const ContentSettingsPattern& secondary_pattern, |
| 142 ContentSettingsType content_type, | 137 ContentSettingsType content_type, |
| 143 std::string resource_identifier) override; | 138 std::string resource_identifier) override; |
| 144 | 139 |
| 145 // Overriden from GaiaGookieManagerService::Observer. | 140 // Overriden from GaiaGookieManagerService::Observer. |
| 146 void OnAddAccountToCookieCompleted( | 141 void OnAddAccountToCookieCompleted( |
| 147 const std::string& account_id, | 142 const std::string& account_id, |
| 148 const GoogleServiceAuthError& error) override; | 143 const GoogleServiceAuthError& error) override; |
| 149 void OnGaiaAccountsInCookieUpdated( | 144 void OnGaiaAccountsInCookieUpdated( |
| 150 const std::vector<std::pair<std::string, bool> >& accounts, | 145 const std::vector<gaia::ListedAccount>& accounts, |
| 151 const GoogleServiceAuthError& error) override; | 146 const GoogleServiceAuthError& error) override; |
| 152 | 147 |
| 153 // Overriden from OAuth2TokenService::Observer. | 148 // Overriden from OAuth2TokenService::Observer. |
| 154 void OnEndBatchChanges() override; | 149 void OnEndBatchChanges() override; |
| 155 | 150 |
| 156 // Overriden from SigninManagerBase::Observer. | 151 // Overriden from SigninManagerBase::Observer. |
| 157 void GoogleSigninSucceeded(const std::string& account_id, | 152 void GoogleSigninSucceeded(const std::string& account_id, |
| 158 const std::string& username, | 153 const std::string& username, |
| 159 const std::string& password) override; | 154 const std::string& password) override; |
| 160 void GoogleSignedOut(const std::string& account_id, | 155 void GoogleSignedOut(const std::string& account_id, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 183 | 178 |
| 184 // True iff this is the first time the reconcilor is executing. | 179 // True iff this is the first time the reconcilor is executing. |
| 185 bool first_execution_; | 180 bool first_execution_; |
| 186 | 181 |
| 187 // True iff an error occured during the last attempt to reconcile. | 182 // True iff an error occured during the last attempt to reconcile. |
| 188 bool error_during_last_reconcile_; | 183 bool error_during_last_reconcile_; |
| 189 | 184 |
| 190 // Used during reconcile action. | 185 // Used during reconcile action. |
| 191 // These members are used to validate the gaia cookie. |gaia_accounts_| | 186 // These members are used to validate the gaia cookie. |gaia_accounts_| |
| 192 // holds the state of google accounts in the gaia cookie. Each element is | 187 // holds the state of google accounts in the gaia cookie. Each element is |
| 193 // a pair that holds the email address of the account and a boolean that | 188 // holds the email address, gaia id and validity as returned from GAIA. The |
| 194 // indicates whether the account is valid or not. The accounts in the vector | 189 // accounts in the vector are ordered the in same way as the gaia cookie. |
| 195 // are ordered the in same way as the gaia cookie. | 190 std::vector<gaia::ListedAccount> gaia_accounts_; |
| 196 std::vector<std::pair<std::string, bool> > gaia_accounts_; | |
| 197 | 191 |
| 198 // Used during reconcile action. | 192 // Used during reconcile action. |
| 199 // These members are used to validate the tokens in OAuth2TokenService. | 193 // These members are used to validate the tokens in OAuth2TokenService. |
| 200 std::string primary_account_; | 194 std::string primary_account_; |
| 201 std::vector<std::string> chrome_accounts_; | 195 std::vector<std::string> chrome_accounts_; |
| 202 std::vector<std::string> add_to_cookie_; | 196 std::vector<std::string> add_to_cookie_; |
| 203 bool chrome_accounts_changed_; | 197 bool chrome_accounts_changed_; |
| 204 | 198 |
| 205 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); | 199 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); |
| 206 }; | 200 }; |
| 207 | 201 |
| 208 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ | 202 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ |
| OLD | NEW |