Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: components/signin/core/browser/account_reconcilor.cc

Issue 1104153002: Expose ReconcilorState. Rename MergeSession in Signin Tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VLOGging the reconcilor Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..975dc0c81d24666fc4511a257ba1df2fab3755db 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();
@@ -269,6 +283,9 @@ void AccountReconcilor::StartReconcile() {
void AccountReconcilor::OnGaiaAccountsInCookieUpdated(
const std::vector<std::pair<std::string, bool> >& accounts,
const GoogleServiceAuthError& error) {
+ VLOG(1) << "AccountReconcilor::OnGaiaAccountsInCookieUpdated: "
+ << "CookieJar " << accounts.size() << " accounts, "
+ << "Error was " << error.ToString();
if (error.state() == GoogleServiceAuthError::NONE) {
gaia_accounts_ = accounts;
@@ -278,6 +295,8 @@ void AccountReconcilor::OnGaiaAccountsInCookieUpdated(
is_reconcile_started_ ? FinishReconcile() : StartReconcile();
} else {
+ if (is_reconcile_started_)
+ error_during_last_reconcile_ = true;
AbortReconcile();
}
}
@@ -432,8 +451,13 @@ bool AccountReconcilor::MarkAccountAsAddedToCookie(
void AccountReconcilor::OnAddAccountToCookieCompleted(
const std::string& account_id,
const GoogleServiceAuthError& error) {
+ VLOG(1) << "AccountReconcilor::OnAddAccountToCookieCompleted: "
+ << "Account added: " << account_id << ", "
+ << "Error was " << error.ToString();
// Always listens to GaiaCookieManagerService. Only proceed if reconciling.
if (is_reconcile_started_ && MarkAccountAsAddedToCookie(account_id)) {
+ if (error.state() != GoogleServiceAuthError::State::NONE)
+ error_during_last_reconcile_ = true;
CalculateIfReconcileIsDone();
ScheduleStartReconcileIfChromeAccountsChanged();
}
« no previous file with comments | « components/signin/core/browser/account_reconcilor.h ('k') | components/signin/core/browser/signin_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698