Index: chrome/browser/chromeos/settings/device_oauth2_token_service.cc |
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service.cc b/chrome/browser/chromeos/settings/device_oauth2_token_service.cc |
index dbcf249e6bfabd215da76c1820a98f90a623d62f..4cb22218f7e3cde6a214db3fbdfb232307a02bf2 100644 |
--- a/chrome/browser/chromeos/settings/device_oauth2_token_service.cc |
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service.cc |
@@ -23,7 +23,7 @@ |
namespace { |
const char kServiceScopeGetUserInfo[] = |
"https://www.googleapis.com/auth/userinfo.email"; |
-} // namespace |
+} |
namespace chromeos { |
@@ -115,7 +115,7 @@ void DeviceOAuth2TokenService::ValidatingConsumer::StartValidation( |
gaia_oauth_client_->RefreshToken( |
client_info, |
- token_service_->GetRefreshToken(), |
+ token_service_->GetRefreshToken(token_service_->GetRobotAccountId()), |
std::vector<std::string>(1, kServiceScopeGetUserInfo), |
token_service_->max_refresh_token_validation_retries_, |
this); |
@@ -221,18 +221,21 @@ DeviceOAuth2TokenService::~DeviceOAuth2TokenService() { |
} |
scoped_ptr<OAuth2TokenService::Request> DeviceOAuth2TokenService::StartRequest( |
+ const std::string& account_id, |
const OAuth2TokenService::ScopeSet& scopes, |
OAuth2TokenService::Consumer* consumer) { |
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ DCHECK_EQ(account_id, GetRobotAccountId()); |
if (refresh_token_is_valid_) { |
- return OAuth2TokenService::StartRequest(scopes, consumer).Pass(); |
+ return OAuth2TokenService::StartRequest( |
+ account_id, scopes, consumer).Pass(); |
} else { |
scoped_ptr<ValidatingConsumer> validating_consumer( |
new ValidatingConsumer(this, consumer)); |
scoped_ptr<Request> request = OAuth2TokenService::StartRequest( |
- scopes, validating_consumer.get()); |
+ account_id, scopes, validating_consumer.get()); |
validating_consumer->StartValidation(request.Pass()); |
return validating_consumer.PassAs<Request>(); |
} |
@@ -260,7 +263,9 @@ void DeviceOAuth2TokenService::SetAndSaveRefreshToken( |
encrypted_refresh_token); |
} |
-std::string DeviceOAuth2TokenService::GetRefreshToken() { |
+std::string DeviceOAuth2TokenService::GetRefreshToken( |
+ const std::string& account_id) { |
+ DCHECK_EQ(account_id, GetRobotAccountId()); |
if (refresh_token_.empty()) { |
std::string encrypted_refresh_token = |
local_state_->GetString(prefs::kDeviceRobotAnyApiRefreshToken); |