Chromium Code Reviews| Index: components/signin/core/browser/account_reconcilor.cc |
| diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc |
| index aecbe9b19ad2e548582749410a6d16acc6b53ee8..a3aefc9c098a35af23e0162277121f453817f6fb 100644 |
| --- a/components/signin/core/browser/account_reconcilor.cc |
| +++ b/components/signin/core/browser/account_reconcilor.cc |
| @@ -64,6 +64,7 @@ AccountReconcilor::AccountReconcilor( |
| registered_with_content_settings_(false), |
| is_reconcile_started_(false), |
| first_execution_(true), |
| + error_during_last_reconcile_(false), |
| chrome_accounts_changed_(false) { |
| VLOG(1) << "AccountReconcilor::AccountReconcilor"; |
| } |
| @@ -176,6 +177,18 @@ bool AccountReconcilor::IsProfileConnected() { |
| return signin_manager_->IsAuthenticated(); |
| } |
| +AccountReconcilor::State AccountReconcilor::GetState() { |
| + if (!is_reconcile_started_) { |
| + return error_during_last_reconcile_ |
| + ? AccountReconcilor::State::NOT_RECONCILING_ERROR_OCCURED |
| + : AccountReconcilor::State::NOT_RECONCILING; |
| + } |
| + |
| + return add_to_cookie_.empty() |
| + ? AccountReconcilor::State::GATHERING_INFORMATION |
| + : AccountReconcilor::State::APPLYING_CHANGES; |
| +} |
| + |
| void AccountReconcilor::OnContentSettingChanged( |
| const ContentSettingsPattern& primary_pattern, |
| const ContentSettingsPattern& secondary_pattern, |
| @@ -249,6 +262,7 @@ void AccountReconcilor::StartReconcile() { |
| return; |
| is_reconcile_started_ = true; |
| + error_during_last_reconcile_ = false; |
| // Reset state for validating gaia cookie. |
| gaia_accounts_.clear(); |
| @@ -278,6 +292,8 @@ void AccountReconcilor::OnGaiaAccountsInCookieUpdated( |
| is_reconcile_started_ ? FinishReconcile() : StartReconcile(); |
| } else { |
| + if (is_reconcile_started_) |
| + error_during_last_reconcile_ = true; |
| AbortReconcile(); |
| } |
| } |
| @@ -434,6 +450,8 @@ void AccountReconcilor::OnAddAccountToCookieCompleted( |
| const GoogleServiceAuthError& error) { |
| // Always listens to GaiaCookieManagerService. Only proceed if reconciling. |
|
Roger Tawa OOO till Jul 10th
2015/04/27 20:08:49
Nit: can you add a VLOG here?
Mike Lerman
2015/04/27 20:16:49
Done.
|
| if (is_reconcile_started_ && MarkAccountAsAddedToCookie(account_id)) { |
| + if (error.state() != GoogleServiceAuthError::State::NONE) |
| + error_during_last_reconcile_ = true; |
| CalculateIfReconcileIsDone(); |
| ScheduleStartReconcileIfChromeAccountsChanged(); |
| } |