Index: chrome/browser/policy/cloud/user_policy_signin_service.cc |
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service.cc b/chrome/browser/policy/cloud/user_policy_signin_service.cc |
index 3ab2fba4ef761318f0e77f898f6babd532fbec75..7075d1444a0705556892651f2481dc497ff4f81e 100644 |
--- a/chrome/browser/policy/cloud/user_policy_signin_service.cc |
+++ b/chrome/browser/policy/cloud/user_policy_signin_service.cc |
@@ -42,7 +42,8 @@ UserPolicySigninService::UserPolicySigninService( |
// ProfileOAuth2TokenService should not yet have loaded its tokens since this |
// happens in the background after PKS initialization - so this service |
// should always be created before the oauth token is available. |
- DCHECK(!oauth2_token_service_->RefreshTokenIsAvailable()); |
+ DCHECK(!oauth2_token_service_->RefreshTokenIsAvailable( |
+ oauth2_token_service_->GetPrimaryAccountId())); |
// Listen for an OAuth token to become available so we can register a client |
// if for some reason the client is not already registered (for example, if |
@@ -148,7 +149,8 @@ void UserPolicySigninService::OnInitializationCompleted( |
DVLOG_IF(1, manager->IsClientRegistered()) |
<< "Client already registered - not fetching DMToken"; |
if (!manager->IsClientRegistered()) { |
- if (!oauth2_token_service_->RefreshTokenIsAvailable()) { |
+ if (!oauth2_token_service_->RefreshTokenIsAvailable( |
+ oauth2_token_service_->GetPrimaryAccountId())) { |
// No token yet - this class listens for OnRefreshTokenAvailable() |
// and will re-attempt registration once the token is available. |
DLOG(WARNING) << "No OAuth Refresh Token - delaying policy download"; |
@@ -176,7 +178,7 @@ void UserPolicySigninService::RegisterCloudPolicyService() { |
enterprise_management::DeviceRegisterRequest::BROWSER)); |
registration_helper_->StartRegistration( |
oauth2_token_service_, |
- GetSigninManager()->GetAuthenticatedUsername(), |
+ oauth2_token_service_->GetPrimaryAccountId(), |
base::Bind(&UserPolicySigninService::OnRegistrationComplete, |
base::Unretained(this))); |
} |