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

Unified Diff: chrome/browser/signin/android_profile_oauth2_token_service.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding the AndroidPO2TS update Created 7 years, 4 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
Index: chrome/browser/signin/android_profile_oauth2_token_service.cc
diff --git a/chrome/browser/signin/android_profile_oauth2_token_service.cc b/chrome/browser/signin/android_profile_oauth2_token_service.cc
index 42a6516214644c8ef7ad350e8ea526da60a7d465..cb96cbd6348ae308b9f488c2ac55e7f46a9fae1f 100644
--- a/chrome/browser/signin/android_profile_oauth2_token_service.cc
+++ b/chrome/browser/signin/android_profile_oauth2_token_service.cc
@@ -15,7 +15,6 @@
#include "jni/AndroidProfileOAuth2TokenServiceHelper_jni.h"
using base::android::AttachCurrentThread;
-using base::android::CheckException;
using base::android::ConvertJavaStringToUTF8;
using base::android::ConvertUTF8ToJavaString;
using base::android::ScopedJavaLocalRef;
@@ -54,22 +53,14 @@ AndroidProfileOAuth2TokenService::AndroidProfileOAuth2TokenService() {
AndroidProfileOAuth2TokenService::~AndroidProfileOAuth2TokenService() {
}
-scoped_ptr<OAuth2TokenService::Request>
- AndroidProfileOAuth2TokenService::StartRequestForUsername(
- const std::string& username,
- const OAuth2TokenService::ScopeSet& scopes,
- OAuth2TokenService::Consumer* consumer) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
-
- scoped_ptr<RequestImpl> request(new RequestImpl(consumer));
- FetchOAuth2TokenWithUsername(request.get(), username, scopes);
- return request.PassAs<Request>();
-}
-
-bool AndroidProfileOAuth2TokenService::RefreshTokenIsAvailable() {
+bool AndroidProfileOAuth2TokenService::RefreshTokenIsAvailable(
+ const std::string& account_id) {
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile());
- return !signin_manager->GetAuthenticatedUsername().empty();
+ const std::string& authenticated_username =
+ signin_manager->GetAuthenticatedUsername();
+ return !authenticated_username.empty()
+ && authenticated_username == account_id;
Roger Tawa OOO till Jul 10th 2013/08/29 15:41:40 Shouldn't this check the underlying android accoun
fgorski 2013/08/29 23:04:14 You are correct, however there are 2 ways to go ab
Roger Tawa OOO till Jul 10th 2013/08/30 00:40:08 The goal is to expose all the android accounts her
}
void AndroidProfileOAuth2TokenService::InvalidateToken(
@@ -87,26 +78,18 @@ void AndroidProfileOAuth2TokenService::InvalidateToken(
void AndroidProfileOAuth2TokenService::FetchOAuth2Token(
RequestImpl* request,
+ const std::string& account_id,
net::URLRequestContextGetter* getter,
const std::string& client_id,
const std::string& client_secret,
const OAuth2TokenService::ScopeSet& scopes) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- std::string username = SigninManagerFactory::GetForProfile(profile())->
- GetAuthenticatedUsername();
- DCHECK(!username.empty());
- // Just ignore client_id, getter, etc since we don't use them on Android.
- FetchOAuth2TokenWithUsername(request, username, scopes);
-}
+ DCHECK(!account_id.empty());
-void AndroidProfileOAuth2TokenService::FetchOAuth2TokenWithUsername(
- RequestImpl* request,
- const std::string& username,
- const OAuth2TokenService::ScopeSet& scopes) {
JNIEnv* env = AttachCurrentThread();
std::string scope = CombineScopes(scopes);
ScopedJavaLocalRef<jstring> j_username =
- ConvertUTF8ToJavaString(env, username);
+ ConvertUTF8ToJavaString(env, account_id);
ScopedJavaLocalRef<jstring> j_scope =
ConvertUTF8ToJavaString(env, scope);

Powered by Google App Engine
This is Rietveld 408576698