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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void Shutdown() override; | 57 void Shutdown() override; |
58 | 58 |
59 // Determine what the reconcilor is currently doing. | 59 // Determine what the reconcilor is currently doing. |
60 signin_metrics::AccountReconcilorState GetState(); | 60 signin_metrics::AccountReconcilorState GetState(); |
61 | 61 |
62 private: | 62 private: |
63 bool IsRegisteredWithTokenService() const { | 63 bool IsRegisteredWithTokenService() const { |
64 return registered_with_token_service_; | 64 return registered_with_token_service_; |
65 } | 65 } |
66 | 66 |
67 const std::vector<std::pair<std::string, bool> >& GetGaiaAccountsForTesting() | |
68 const { | |
69 return gaia_accounts_; | |
70 } | |
71 | |
72 friend class AccountReconcilorTest; | 67 friend class AccountReconcilorTest; |
73 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, SigninManagerRegistration); | 68 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, SigninManagerRegistration); |
74 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, Reauth); | 69 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, Reauth); |
75 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ProfileAlreadyConnected); | 70 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ProfileAlreadyConnected); |
76 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, | 71 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, |
77 StartReconcileCookiesDisabled); | 72 StartReconcileCookiesDisabled); |
78 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, | 73 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, |
79 StartReconcileContentSettings); | 74 StartReconcileContentSettings); |
80 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, | 75 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, |
81 StartReconcileContentSettingsGaiaUrl); | 76 StartReconcileContentSettingsGaiaUrl); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 const ContentSettingsPattern& primary_pattern, | 128 const ContentSettingsPattern& primary_pattern, |
134 const ContentSettingsPattern& secondary_pattern, | 129 const ContentSettingsPattern& secondary_pattern, |
135 ContentSettingsType content_type, | 130 ContentSettingsType content_type, |
136 std::string resource_identifier) override; | 131 std::string resource_identifier) override; |
137 | 132 |
138 // Overriden from GaiaGookieManagerService::Observer. | 133 // Overriden from GaiaGookieManagerService::Observer. |
139 void OnAddAccountToCookieCompleted( | 134 void OnAddAccountToCookieCompleted( |
140 const std::string& account_id, | 135 const std::string& account_id, |
141 const GoogleServiceAuthError& error) override; | 136 const GoogleServiceAuthError& error) override; |
142 void OnGaiaAccountsInCookieUpdated( | 137 void OnGaiaAccountsInCookieUpdated( |
143 const std::vector<std::pair<std::string, bool> >& accounts, | 138 const std::vector<gaia::ListedAccount>& accounts, |
144 const GoogleServiceAuthError& error) override; | 139 const GoogleServiceAuthError& error) override; |
145 | 140 |
146 // Overriden from OAuth2TokenService::Observer. | 141 // Overriden from OAuth2TokenService::Observer. |
147 void OnEndBatchChanges() override; | 142 void OnEndBatchChanges() override; |
148 | 143 |
149 // Overriden from SigninManagerBase::Observer. | 144 // Overriden from SigninManagerBase::Observer. |
150 void GoogleSigninSucceeded(const std::string& account_id, | 145 void GoogleSigninSucceeded(const std::string& account_id, |
151 const std::string& username, | 146 const std::string& username, |
152 const std::string& password) override; | 147 const std::string& password) override; |
153 void GoogleSignedOut(const std::string& account_id, | 148 void GoogleSignedOut(const std::string& account_id, |
(...skipping 22 matching lines...) Expand all Loading... |
176 | 171 |
177 // True iff this is the first time the reconcilor is executing. | 172 // True iff this is the first time the reconcilor is executing. |
178 bool first_execution_; | 173 bool first_execution_; |
179 | 174 |
180 // True iff an error occured during the last attempt to reconcile. | 175 // True iff an error occured during the last attempt to reconcile. |
181 bool error_during_last_reconcile_; | 176 bool error_during_last_reconcile_; |
182 | 177 |
183 // Used during reconcile action. | 178 // Used during reconcile action. |
184 // These members are used to validate the gaia cookie. |gaia_accounts_| | 179 // These members are used to validate the gaia cookie. |gaia_accounts_| |
185 // holds the state of google accounts in the gaia cookie. Each element is | 180 // holds the state of google accounts in the gaia cookie. Each element is |
186 // a pair that holds the email address of the account and a boolean that | 181 // holds the email address, gaia id and validity as returned from GAIA. The |
187 // indicates whether the account is valid or not. The accounts in the vector | 182 // accounts in the vector are ordered the in same way as the gaia cookie. |
188 // are ordered the in same way as the gaia cookie. | 183 std::vector<gaia::ListedAccount> gaia_accounts_; |
189 std::vector<std::pair<std::string, bool> > gaia_accounts_; | |
190 | 184 |
191 // Used during reconcile action. | 185 // Used during reconcile action. |
192 // These members are used to validate the tokens in OAuth2TokenService. | 186 // These members are used to validate the tokens in OAuth2TokenService. |
193 std::string primary_account_; | 187 std::string primary_account_; |
194 std::vector<std::string> chrome_accounts_; | 188 std::vector<std::string> chrome_accounts_; |
195 std::vector<std::string> add_to_cookie_; | 189 std::vector<std::string> add_to_cookie_; |
196 bool chrome_accounts_changed_; | 190 bool chrome_accounts_changed_; |
197 | 191 |
198 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); | 192 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); |
199 }; | 193 }; |
200 | 194 |
201 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ | 195 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ |
OLD | NEW |