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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.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: Rebasing to include the update to ProfileSyncService: r224220 Created 7 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 8 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
9 #include "chrome/browser/policy/cloud/cloud_policy_core.h" 9 #include "chrome/browser/policy/cloud/cloud_policy_core.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service.h" 10 #include "chrome/browser/signin/profile_oauth2_token_service.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 void UserCloudPolicyTokenForwarder::Initialize() { 74 void UserCloudPolicyTokenForwarder::Initialize() {
75 if (manager_->IsClientRegistered()) { 75 if (manager_->IsClientRegistered()) {
76 // We already have a DMToken, so no need to ask for an access token. 76 // We already have a DMToken, so no need to ask for an access token.
77 // All done here. 77 // All done here.
78 Shutdown(); 78 Shutdown();
79 return; 79 return;
80 } 80 }
81 81
82 if (token_service_->RefreshTokenIsAvailable()) 82 if (token_service_->RefreshTokenIsAvailable(
83 token_service_->GetPrimaryAccountId()))
83 RequestAccessToken(); 84 RequestAccessToken();
84 else 85 else
85 token_service_->AddObserver(this); 86 token_service_->AddObserver(this);
86 } 87 }
87 88
88 void UserCloudPolicyTokenForwarder::RequestAccessToken() { 89 void UserCloudPolicyTokenForwarder::RequestAccessToken() {
89 OAuth2TokenService::ScopeSet scopes; 90 OAuth2TokenService::ScopeSet scopes;
90 scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth); 91 scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth);
91 request_ = token_service_->StartRequest(scopes, this); 92 request_ = token_service_->StartRequest(
93 token_service_->GetPrimaryAccountId(), scopes, this);
92 } 94 }
93 95
94 } // namespace policy 96 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698