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

Unified Diff: chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc

Issue 137553007: User cloud policy token forwarder: Replace PO2TS::GetPrimaryAccountId() with SMB::GetAuthenticatedAc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 6 years, 10 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/chromeos/policy/user_cloud_policy_token_forwarder.cc
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc
index d343c39a3f15ea49b59298fd809cbc23dbba66db..97a328ee8cb1ffab957a058429f7ba9100b67ec2 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
+#include "chrome/browser/signin/signin_manager.h"
#include "components/policy/core/common/cloud/cloud_policy_core.h"
#include "content/public/browser/notification_source.h"
#include "google_apis/gaia/gaia_constants.h"
@@ -16,10 +17,12 @@ namespace policy {
UserCloudPolicyTokenForwarder::UserCloudPolicyTokenForwarder(
UserCloudPolicyManagerChromeOS* manager,
- ProfileOAuth2TokenService* token_service)
+ ProfileOAuth2TokenService* token_service,
+ SigninManagerBase* signin_manager)
: OAuth2TokenService::Consumer("policy_token_forwarder"),
manager_(manager),
- token_service_(token_service) {
+ token_service_(token_service),
+ signin_manager_(signin_manager) {
// Start by waiting for the CloudPolicyService to be initialized, so that
// we can check if it already has a DMToken or not.
if (manager_->core()->service()->IsInitializationComplete()) {
@@ -79,7 +82,7 @@ void UserCloudPolicyTokenForwarder::Initialize() {
// here if the client is already registered, so check and bail out here.
if (token_service_->RefreshTokenIsAvailable(
- token_service_->GetPrimaryAccountId()))
+ signin_manager_->GetAuthenticatedAccountId()))
RequestAccessToken();
else
token_service_->AddObserver(this);
@@ -90,7 +93,7 @@ void UserCloudPolicyTokenForwarder::RequestAccessToken() {
scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth);
scopes.insert(GaiaUrls::GetInstance()->oauth_wrap_bridge_user_info_scope());
request_ = token_service_->StartRequest(
- token_service_->GetPrimaryAccountId(), scopes, this);
+ signin_manager_->GetAuthenticatedAccountId(), scopes, this);
}
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698