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

Side by Side Diff: chrome/browser/signin/oauth2_token_service_delegate_android.cc

Issue 1380103004: Delay fetching account info until OnRefreshTokensLoaded(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unregister Invalidation service correctly. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" 5 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 std::vector<std::string> empty; 522 std::vector<std::string> empty;
523 JNIEnv* env = AttachCurrentThread(); 523 JNIEnv* env = AttachCurrentThread();
524 ScopedJavaLocalRef<jobjectArray> java_accounts( 524 ScopedJavaLocalRef<jobjectArray> java_accounts(
525 base::android::ToJavaArrayOfStrings(env, empty)); 525 base::android::ToJavaArrayOfStrings(env, empty));
526 Java_OAuth2TokenService_saveStoredAccounts( 526 Java_OAuth2TokenService_saveStoredAccounts(
527 env, base::android::GetApplicationContext(), java_accounts.obj()); 527 env, base::android::GetApplicationContext(), java_accounts.obj());
528 } 528 }
529 529
530 void OAuth2TokenServiceDelegateAndroid::LoadCredentials( 530 void OAuth2TokenServiceDelegateAndroid::LoadCredentials(
531 const std::string& primary_account_id) { 531 const std::string& primary_account_id) {
532 if (primary_account_id.empty()) {
533 FireRefreshTokensLoaded();
534 return;
535 }
532 if (fire_refresh_token_loaded_ == RT_HAS_BEEN_VALIDATED) { 536 if (fire_refresh_token_loaded_ == RT_HAS_BEEN_VALIDATED) {
533 fire_refresh_token_loaded_ = RT_LOADED; 537 fire_refresh_token_loaded_ = RT_LOADED;
534 FireRefreshTokensLoaded(); 538 FireRefreshTokensLoaded();
535 } else if (fire_refresh_token_loaded_ == RT_LOAD_NOT_START) { 539 } else if (fire_refresh_token_loaded_ == RT_LOAD_NOT_START) {
536 fire_refresh_token_loaded_ = RT_WAIT_FOR_VALIDATION; 540 fire_refresh_token_loaded_ = RT_WAIT_FOR_VALIDATION;
537 } 541 }
538 } 542 }
539 543
540 std::string OAuth2TokenServiceDelegateAndroid::MapAccountIdToAccountName( 544 std::string OAuth2TokenServiceDelegateAndroid::MapAccountIdToAccountName(
541 const std::string& account_id) const { 545 const std::string& account_id) const {
(...skipping 29 matching lines...) Expand all
571 : isTransientError 575 : isTransientError
572 ? GoogleServiceAuthError::CONNECTION_FAILED 576 ? GoogleServiceAuthError::CONNECTION_FAILED
573 : GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 577 : GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
574 heap_callback->Run(err, token, base::Time()); 578 heap_callback->Run(err, token, base::Time());
575 } 579 }
576 580
577 // static 581 // static
578 bool OAuth2TokenServiceDelegateAndroid::Register(JNIEnv* env) { 582 bool OAuth2TokenServiceDelegateAndroid::Register(JNIEnv* env) {
579 return RegisterNativesImpl(env); 583 return RegisterNativesImpl(env);
580 } 584 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698