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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc

Issue 617183003: Make sure GetAuthenticatedAccountId() returns a canonicalized id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Hui's comments, fix cvox tests Created 6 years, 2 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 "components/policy/core/common/cloud/cloud_policy_core.h" 9 #include "components/policy/core/common/cloud/cloud_policy_core.h"
10 #include "components/signin/core/browser/profile_oauth2_token_service.h" 10 #include "components/signin/core/browser/profile_oauth2_token_service.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void UserCloudPolicyTokenForwarder::OnInitializationCompleted( 73 void UserCloudPolicyTokenForwarder::OnInitializationCompleted(
74 CloudPolicyService* service) { 74 CloudPolicyService* service) {
75 Initialize(); 75 Initialize();
76 } 76 }
77 77
78 void UserCloudPolicyTokenForwarder::Initialize() { 78 void UserCloudPolicyTokenForwarder::Initialize() {
79 // TODO(mnissler): Once a better way to reconfirm whether a user is on the 79 // TODO(mnissler): Once a better way to reconfirm whether a user is on the
80 // login whitelist is available, there is no reason to fetch the OAuth2 token 80 // login whitelist is available, there is no reason to fetch the OAuth2 token
81 // here if the client is already registered, so check and bail out here. 81 // here if the client is already registered, so check and bail out here.
82 82
83 if (token_service_->RefreshTokenIsAvailable( 83 if (signin_manager_->IsAuthenticated() &&
Joao da Silva 2014/10/08 13:19:17 This is ChromeOS code, so AFAICT this is always tr
84 token_service_->RefreshTokenIsAvailable(
84 signin_manager_->GetAuthenticatedAccountId())) 85 signin_manager_->GetAuthenticatedAccountId()))
85 RequestAccessToken(); 86 RequestAccessToken();
86 else 87 else
87 token_service_->AddObserver(this); 88 token_service_->AddObserver(this);
88 } 89 }
89 90
90 void UserCloudPolicyTokenForwarder::RequestAccessToken() { 91 void UserCloudPolicyTokenForwarder::RequestAccessToken() {
91 OAuth2TokenService::ScopeSet scopes; 92 OAuth2TokenService::ScopeSet scopes;
92 scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth); 93 scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth);
93 scopes.insert(GaiaConstants::kOAuthWrapBridgeUserInfoScope); 94 scopes.insert(GaiaConstants::kOAuthWrapBridgeUserInfoScope);
94 request_ = token_service_->StartRequest( 95 request_ = token_service_->StartRequest(
95 signin_manager_->GetAuthenticatedAccountId(), scopes, this); 96 signin_manager_->GetAuthenticatedAccountId(), scopes, this);
96 } 97 }
97 98
98 } // namespace policy 99 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698