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 65c737073da99ed03a8c65ed08eabed9af3ead86..058bc3b3dc24c2d9be5f63d8efdec2aa26cce195 100644 |
--- a/components/signin/core/browser/account_reconcilor.cc |
+++ b/components/signin/core/browser/account_reconcilor.cc |
@@ -17,6 +17,7 @@ |
#include "components/signin/core/browser/signin_client.h" |
#include "components/signin/core/browser/signin_metrics.h" |
#include "components/signin/core/browser/signin_oauth_helper.h" |
+#include "components/signin/core/common/profile_management_switches.h" |
#include "google_apis/gaia/gaia_auth_fetcher.h" |
#include "google_apis/gaia/gaia_auth_util.h" |
#include "google_apis/gaia/gaia_constants.h" |
@@ -335,7 +336,7 @@ void AccountReconcilor::OnRefreshTokenAvailable(const std::string& account_id) { |
void AccountReconcilor::OnRefreshTokenRevoked(const std::string& account_id) { |
VLOG(1) << "AccountReconcilor::OnRefreshTokenRevoked: " << account_id; |
- StartRemoveAction(account_id); |
+ PerformStartRemoveAction(account_id); |
} |
void AccountReconcilor::OnRefreshTokensLoaded() {} |
@@ -358,22 +359,28 @@ void AccountReconcilor::GoogleSignedOut(const std::string& username) { |
} |
void AccountReconcilor::PerformMergeAction(const std::string& account_id) { |
+ if (!switches::IsNewProfileManagement()) |
+ return; |
VLOG(1) << "AccountReconcilor::PerformMergeAction: " << account_id; |
merge_session_helper_.LogIn(account_id); |
} |
-void AccountReconcilor::StartRemoveAction(const std::string& account_id) { |
- VLOG(1) << "AccountReconcilor::StartRemoveAction: " << account_id; |
- GetAccountsFromCookie(base::Bind(&AccountReconcilor::FinishRemoveAction, |
- base::Unretained(this), |
- account_id)); |
+void AccountReconcilor::PerformStartRemoveAction( |
+ const std::string& account_id) { |
+ VLOG(1) << "AccountReconcilor::PerformStartRemoveAction: " << account_id; |
+ GetAccountsFromCookie(base::Bind( |
+ &AccountReconcilor::PerformFinishRemoveAction, |
+ base::Unretained(this), |
+ account_id)); |
} |
-void AccountReconcilor::FinishRemoveAction( |
+void AccountReconcilor::PerformFinishRemoveAction( |
const std::string& account_id, |
const GoogleServiceAuthError& error, |
const std::vector<std::pair<std::string, bool> >& accounts) { |
- VLOG(1) << "AccountReconcilor::FinishRemoveAction:" |
+ if (!switches::IsNewProfileManagement()) |
+ return; |
+ VLOG(1) << "AccountReconcilor::PerformFinishRemoveAction:" |
<< " account=" << account_id << " error=" << error.ToString(); |
if (error.state() == GoogleServiceAuthError::NONE) { |
AbortReconcile(); |
@@ -391,6 +398,8 @@ void AccountReconcilor::FinishRemoveAction( |
void AccountReconcilor::PerformAddToChromeAction(const std::string& account_id, |
int session_index) { |
+ if (!switches::IsNewProfileManagement()) |
+ return; |
VLOG(1) << "AccountReconcilor::PerformAddToChromeAction:" |
<< " account=" << account_id << " session_index=" << session_index; |
@@ -401,6 +410,8 @@ void AccountReconcilor::PerformAddToChromeAction(const std::string& account_id, |
} |
void AccountReconcilor::PerformLogoutAllAccountsAction() { |
+ if (!switches::IsNewProfileManagement()) |
+ return; |
VLOG(1) << "AccountReconcilor::PerformLogoutAllAccountsAction"; |
merge_session_helper_.LogOutAllAccounts(); |
} |
@@ -714,13 +725,22 @@ void AccountReconcilor::HandleFailedAccountIdCheck( |
FinishReconcile(); |
} |
+void AccountReconcilor::PerformAddAccountToTokenService( |
+ const std::string& account_id, |
+ const std::string& refresh_token) { |
+ // The flow should never get to this method if new_profile_management is |
+ // false, but better safe than sorry. |
+ if (!switches::IsNewProfileManagement()) |
+ return; |
+ token_service_->UpdateCredentials(account_id, refresh_token); |
+} |
+ |
void AccountReconcilor::HandleRefreshTokenFetched( |
const std::string& account_id, |
const std::string& refresh_token) { |
if (!refresh_token.empty()) { |
- token_service_->UpdateCredentials(account_id, refresh_token); |
+ PerformAddAccountToTokenService(account_id, refresh_token); |
} |
- |
// Remove the account from the list that is being updated. |
for (std::vector<std::pair<std::string, int> >::iterator i = |
add_to_chrome_.begin(); |