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

Unified Diff: chrome/browser/android/signin/signin_manager_android.cc

Issue 63253003: Fix issues with token refresh in AccountReconcilor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 7 years, 1 month 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: 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..d81d1e0579a53e770a2dd841464bc36e00b104ef 100644
--- a/chrome/browser/android/signin/signin_manager_android.cc
+++ b/chrome/browser/android/signin/signin_manager_android.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/android/signin/signin_manager_android.h"
+#include <deque>
+
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/bind.h"
@@ -17,7 +19,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 +206,39 @@ 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_);
+
+ // 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();
+
+ std::vector<std::string> ids = token_service->GetAccounts();
+
+ std::deque<std::string> ordered_accts;
+ ordered_accts.push_back(primary_acct);
+
+ for (std::vector<std::string>::iterator it = ids.begin();
+ it != ids.end(); it++) {
+ if (*it != primary_acct) {
+ ordered_accts.push_back(*it);
+ }
+ }
+ token_service->FireRefreshTokenAvailable(ordered_accts);
+
+ } else {
+ // 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) {
« no previous file with comments | « no previous file | chrome/browser/signin/account_reconcilor.h » ('j') | chrome/browser/signin/account_reconcilor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698