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..3064ea3f979d65708dd07a295904d3890c67dc8e 100644 |
--- a/chrome/browser/chromeos/settings/device_oauth2_token_service.cc |
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service.cc |
@@ -23,6 +23,8 @@ |
namespace { |
const char kServiceScopeGetUserInfo[] = |
"https://www.googleapis.com/auth/userinfo.email"; |
+const char kDeviceAccountId[] = |
+ "device_account_id"; |
} // namespace |
namespace chromeos { |
@@ -115,7 +117,7 @@ void DeviceOAuth2TokenService::ValidatingConsumer::StartValidation( |
gaia_oauth_client_->RefreshToken( |
client_info, |
- token_service_->GetRefreshToken(), |
+ token_service_->GetRefreshToken(std::string()), |
Andrew T Wilson (Slow)
2013/09/03 14:04:24
Should this really be an empty string?
fgorski
2013/09/03 20:50:40
Done.
|
std::vector<std::string>(1, kServiceScopeGetUserInfo), |
token_service_->max_refresh_token_validation_retries_, |
this); |
@@ -214,25 +216,29 @@ DeviceOAuth2TokenService::DeviceOAuth2TokenService( |
: refresh_token_is_valid_(false), |
max_refresh_token_validation_retries_(3), |
url_request_context_getter_(getter), |
- local_state_(local_state) { |
+ local_state_(local_state), |
+ device_account_id_(kDeviceAccountId) { |
} |
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, device_account_id_); |
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 +266,9 @@ void DeviceOAuth2TokenService::SetAndSaveRefreshToken( |
encrypted_refresh_token); |
} |
-std::string DeviceOAuth2TokenService::GetRefreshToken() { |
+std::string DeviceOAuth2TokenService::GetRefreshToken( |
+ const std::string& account_id) { |
+ DCHECK_EQ(account_id, device_account_id_); |
if (refresh_token_.empty()) { |
std::string encrypted_refresh_token = |
local_state_->GetString(prefs::kDeviceRobotAnyApiRefreshToken); |
@@ -271,6 +279,10 @@ std::string DeviceOAuth2TokenService::GetRefreshToken() { |
return refresh_token_; |
} |
+const std::string& DeviceOAuth2TokenService::GetDeviceAccountId() const { |
+ return device_account_id_; |
+} |
+ |
std::string DeviceOAuth2TokenService::GetRobotAccountId() { |
policy::BrowserPolicyConnector* connector = |
g_browser_process->browser_policy_connector(); |