OLD | NEW |
---|---|
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 Loading... | |
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(token_service_->GetPrimaryAccountId(), |
Andrew T Wilson (Slow)
2013/08/30 10:47:00
I think the wrapping is wrong here - either you sh
fgorski
2013/08/30 20:10:16
Done.
| |
93 scopes, this); | |
92 } | 94 } |
93 | 95 |
94 } // namespace policy | 96 } // namespace policy |
OLD | NEW |