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

Unified Diff: chrome/browser/policy/cloud/cloud_policy_client_registration_helper.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: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId 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/policy/cloud/cloud_policy_client_registration_helper.cc
diff --git a/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.cc b/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.cc
index 104ee852b50a7c34508a3214952a96febc17c4c7..1c46ddb0ceac90bf68859ca8025dcac53e1460d9 100644
--- a/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.cc
+++ b/chrome/browser/policy/cloud/cloud_policy_client_registration_helper.cc
@@ -45,13 +45,7 @@ class CloudPolicyClientRegistrationHelper::TokenServiceHelper
TokenServiceHelper();
void FetchAccessToken(
-#if defined(OS_ANDROID)
- // TODO(atwilson): Remove this when StartRequestForUsername() is merged
- // into the base OAuth2TokenService class.
- AndroidProfileOAuth2TokenService* token_service,
-#else
OAuth2TokenService* token_service,
-#endif
const std::string& username,
const StringCallback& callback);
@@ -70,29 +64,20 @@ class CloudPolicyClientRegistrationHelper::TokenServiceHelper
CloudPolicyClientRegistrationHelper::TokenServiceHelper::TokenServiceHelper() {}
void CloudPolicyClientRegistrationHelper::TokenServiceHelper::FetchAccessToken(
-#if defined(OS_ANDROID)
- AndroidProfileOAuth2TokenService* token_service,
-#else
OAuth2TokenService* token_service,
-#endif
- const std::string& username,
+ const std::string& account_id,
const StringCallback& callback) {
DCHECK(!token_request_);
// Either the caller must supply a username, or the user must be signed in
// already.
- DCHECK(!username.empty() || token_service->RefreshTokenIsAvailable());
+ DCHECK(!account_id.empty() ||
+ token_service->RefreshTokenIsAvailable(account_id));
Andrew T Wilson (Slow) 2013/09/03 14:04:24 I think it's more correct to align with the open p
fgorski 2013/09/03 20:50:40 Done.
callback_ = callback;
OAuth2TokenService::ScopeSet scopes;
scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth);
scopes.insert(kServiceScopeGetUserInfo);
-
-#if defined(OS_ANDROID)
- token_request_ =
- token_service->StartRequestForUsername(username, scopes, this);
-#else
- token_request_ = token_service->StartRequest(scopes, this);
-#endif
+ token_request_ = token_service->StartRequest(account_id, scopes, this);
}
void CloudPolicyClientRegistrationHelper::TokenServiceHelper::OnGetTokenSuccess(
@@ -195,12 +180,8 @@ CloudPolicyClientRegistrationHelper::~CloudPolicyClientRegistrationHelper() {
void CloudPolicyClientRegistrationHelper::StartRegistration(
-#if defined(OS_ANDROID)
- AndroidProfileOAuth2TokenService* token_service,
-#else
OAuth2TokenService* token_service,
-#endif
- const std::string& username,
+ const std::string& account_id,
const base::Closure& callback) {
DVLOG(1) << "Starting registration process with username";
DCHECK(!client_->is_registered());
@@ -210,7 +191,7 @@ void CloudPolicyClientRegistrationHelper::StartRegistration(
token_service_helper_.reset(new TokenServiceHelper());
token_service_helper_->FetchAccessToken(
token_service,
- username,
+ account_id,
base::Bind(&CloudPolicyClientRegistrationHelper::OnTokenFetched,
base::Unretained(this)));
}

Powered by Google App Engine
This is Rietveld 408576698