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

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

Issue 309843002: Improve UMA tests; improve no-op reconcilor; new reconcilor test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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
« no previous file with comments | « components/signin/core/browser/account_reconcilor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6156603ab89105b5ab052ed69f2869164afcb501..c5077bb1f12136e3d854f64fcb99c0d2308bd395 100644
--- a/components/signin/core/browser/account_reconcilor.cc
+++ b/components/signin/core/browser/account_reconcilor.cc
@@ -359,8 +359,10 @@ void AccountReconcilor::GoogleSignedOut(const std::string& username) {
}
void AccountReconcilor::PerformMergeAction(const std::string& account_id) {
- if (!switches::IsNewProfileManagement())
+ if (!switches::IsNewProfileManagement()) {
+ MarkAccountAsAddedToCookie(account_id);
return;
+ }
VLOG(1) << "AccountReconcilor::PerformMergeAction: " << account_id;
merge_session_helper_.LogIn(account_id);
}
@@ -398,8 +400,10 @@ void AccountReconcilor::PerformFinishRemoveAction(
void AccountReconcilor::PerformAddToChromeAction(const std::string& account_id,
int session_index) {
- if (!switches::IsNewProfileManagement())
+ if (!switches::IsNewProfileManagement()) {
+ MarkAccountAsAddedToChrome(account_id);
return;
+ }
VLOG(1) << "AccountReconcilor::PerformAddToChromeAction:"
<< " account=" << account_id << " session_index=" << session_index;
@@ -708,13 +712,9 @@ void AccountReconcilor::ScheduleStartReconcileIfChromeAccountsChanged() {
}
}
-void AccountReconcilor::MergeSessionCompleted(
- const std::string& account_id,
- const GoogleServiceAuthError& error) {
- VLOG(1) << "AccountReconcilor::MergeSessionCompleted: account_id="
- << account_id;
-
- // Remove the account from the list that is being merged.
+// Remove the account from the list that is being merged.
+void AccountReconcilor::MarkAccountAsAddedToCookie(
+ const std::string& account_id) {
for (std::vector<std::string>::iterator i = add_to_cookie_.begin();
i != add_to_cookie_.end();
++i) {
@@ -723,7 +723,15 @@ void AccountReconcilor::MergeSessionCompleted(
break;
}
}
+}
+
+void AccountReconcilor::MergeSessionCompleted(
+ const std::string& account_id,
+ const GoogleServiceAuthError& error) {
+ VLOG(1) << "AccountReconcilor::MergeSessionCompleted: account_id="
+ << account_id;
+ MarkAccountAsAddedToCookie(account_id);
CalculateIfReconcileIsDone();
ScheduleStartReconcileIfChromeAccountsChanged();
}
@@ -750,13 +758,9 @@ void AccountReconcilor::PerformAddAccountToTokenService(
token_service_->UpdateCredentials(account_id, refresh_token);
}
-void AccountReconcilor::HandleRefreshTokenFetched(
- const std::string& account_id,
- const std::string& refresh_token) {
- if (!refresh_token.empty()) {
- PerformAddAccountToTokenService(account_id, refresh_token);
- }
- // Remove the account from the list that is being updated.
+// Remove the account from the list that is being updated.
+void AccountReconcilor::MarkAccountAsAddedToChrome(
+ const std::string& account_id) {
for (std::vector<std::pair<std::string, int> >::iterator i =
add_to_chrome_.begin();
i != add_to_chrome_.end();
@@ -766,6 +770,14 @@ void AccountReconcilor::HandleRefreshTokenFetched(
break;
}
}
+}
+
+void AccountReconcilor::HandleRefreshTokenFetched(
+ const std::string& account_id,
+ const std::string& refresh_token) {
+ if (!refresh_token.empty())
+ PerformAddAccountToTokenService(account_id, refresh_token);
+ MarkAccountAsAddedToChrome(account_id);
CalculateIfReconcileIsDone();
}
« no previous file with comments | « components/signin/core/browser/account_reconcilor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698