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 #include "components/signin/core/browser/account_reconcilor.h" | 5 #include "components/signin/core/browser/account_reconcilor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // Reset state for validating gaia cookie. | 297 // Reset state for validating gaia cookie. |
298 are_gaia_accounts_set_ = false; | 298 are_gaia_accounts_set_ = false; |
299 gaia_accounts_.clear(); | 299 gaia_accounts_.clear(); |
300 | 300 |
301 // Reset state for validating oauth2 tokens. | 301 // Reset state for validating oauth2 tokens. |
302 primary_account_.clear(); | 302 primary_account_.clear(); |
303 chrome_accounts_.clear(); | 303 chrome_accounts_.clear(); |
304 add_to_cookie_.clear(); | 304 add_to_cookie_.clear(); |
305 ValidateAccountsFromTokenService(); | 305 ValidateAccountsFromTokenService(); |
306 | 306 |
307 // TODO(mlerman): Call this only from within the GaiaCookieManagerService, | 307 GetAccountsFromCookie(base::Bind( |
308 // once /ListAccounts is now called from that class instead of the | 308 &AccountReconcilor::ContinueReconcileActionAfterGetGaiaAccounts, |
309 // reconcilor's GaiaAuthFetcher (which will be removed). | 309 base::Unretained(this))); |
310 cookie_manager_service_->StartFetchingExternalCcResult(); | |
311 } | 310 } |
312 | 311 |
313 void AccountReconcilor::GetAccountsFromCookie( | 312 void AccountReconcilor::GetAccountsFromCookie( |
314 GetAccountsFromCookieCallback callback) { | 313 GetAccountsFromCookieCallback callback) { |
315 get_gaia_accounts_callbacks_.push_back(callback); | 314 get_gaia_accounts_callbacks_.push_back(callback); |
316 if (!gaia_fetcher_) | 315 if (!gaia_fetcher_) |
317 MayBeDoNextListAccounts(); | 316 MayBeDoNextListAccounts(); |
318 } | 317 } |
319 | 318 |
320 void AccountReconcilor::OnListAccountsSuccess(const std::string& data) { | 319 void AccountReconcilor::OnListAccountsSuccess(const std::string& data) { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 531 |
533 void AccountReconcilor::OnAddAccountToCookieCompleted( | 532 void AccountReconcilor::OnAddAccountToCookieCompleted( |
534 const std::string& account_id, | 533 const std::string& account_id, |
535 const GoogleServiceAuthError& error) { | 534 const GoogleServiceAuthError& error) { |
536 // Always listens to GaiaCookieManagerService. Only proceed if reconciling. | 535 // Always listens to GaiaCookieManagerService. Only proceed if reconciling. |
537 if (is_reconcile_started_ && MarkAccountAsAddedToCookie(account_id)) { | 536 if (is_reconcile_started_ && MarkAccountAsAddedToCookie(account_id)) { |
538 CalculateIfReconcileIsDone(); | 537 CalculateIfReconcileIsDone(); |
539 ScheduleStartReconcileIfChromeAccountsChanged(); | 538 ScheduleStartReconcileIfChromeAccountsChanged(); |
540 } | 539 } |
541 } | 540 } |
542 | |
543 void AccountReconcilor::GetCheckConnectionInfoCompleted(bool succeeded) { | |
544 if (is_reconcile_started_) { | |
545 GetAccountsFromCookie(base::Bind( | |
546 &AccountReconcilor::ContinueReconcileActionAfterGetGaiaAccounts, | |
547 base::Unretained(this))); | |
548 } | |
549 } | |
OLD | NEW |