Index: chrome/browser/android/signin/signin_manager_android.cc |
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc |
index 29dc73140ec92dbed29017ae727449e2d0432825..09e76ce430795725277d462b0ddd112ac441447d 100644 |
--- a/chrome/browser/android/signin/signin_manager_android.cc |
+++ b/chrome/browser/android/signin/signin_manager_android.cc |
@@ -17,7 +17,10 @@ |
#include "chrome/browser/browsing_data/browsing_data_helper.h" |
#include "chrome/browser/browsing_data/browsing_data_remover.h" |
#include "chrome/browser/profiles/profile_manager.h" |
+#include "chrome/browser/profiles/profiles_state.h" |
#include "chrome/browser/signin/google_auto_login_helper.h" |
+#include "chrome/browser/signin/profile_oauth2_token_service.h" |
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
#include "chrome/browser/signin/signin_manager.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/common/pref_names.h" |
@@ -201,9 +204,40 @@ void SigninManagerAndroid::OnBrowsingDataRemoverDone() { |
} |
void SigninManagerAndroid::LogInSignedInUser(JNIEnv* env, jobject obj) { |
- // AutoLogin deletes itself. |
- GoogleAutoLoginHelper* autoLogin = new GoogleAutoLoginHelper(profile_); |
- autoLogin->LogIn(); |
+ if (profiles::IsNewProfileManagementEnabled()) { |
+ // New Mirror code path that just fires the events and let the |
+ // Account Reconcilor handles everything. |
+ |
+ AndroidProfileOAuth2TokenService* token_service = |
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
+ |
+ DVLOG(1) << "SigninManagerAndroid::LogInSignedInUser " |
+ "Firing RefreshTokenAvailable"; |
+ |
+ // The first account we merge should always be the primiary |
+ // account. The rest will just be whatever order the account manager |
+ // inform us. |
+ std::string primary_acct = token_service->GetPrimaryAccountId(); |
+ token_service->FireRefreshTokenAvailable(primary_acct); |
+ |
+ std::vector<std::string> ids = token_service->GetAccounts(); |
+ |
+ for (std::vector<std::string>::iterator it = ids.begin(); |
+ it != ids.end(); it++) { |
+ if (*it != primary_acct) { |
+ token_service->FireRefreshTokenAvailable(*it); |
+ } |
+ } |
Roger Tawa OOO till Jul 10th
2013/11/21 16:02:32
Given the changes in android_profile_oauth2_token_
acleung1
2013/11/26 09:28:31
Less duplicated code. I like that. Done.
|
+ } else { |
+ DVLOG(1) << "SigninManagerAndroid::LogInSignedInUser " |
+ " Manually calling GoogleAutoLoginHelper"; |
+ // Old code path that doesn't depend on the new Account Reconcilor. |
+ // We manually login. |
+ |
+ // AutoLogin deletes itself. |
+ GoogleAutoLoginHelper* autoLogin = new GoogleAutoLoginHelper(profile_); |
+ autoLogin->LogIn(); |
+ } |
} |
static int Init(JNIEnv* env, jobject obj) { |