OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { | 189 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { |
190 CheckAndPublishPolicy(); | 190 CheckAndPublishPolicy(); |
191 StartRefreshScheduler(); | 191 StartRefreshScheduler(); |
192 } | 192 } |
193 | 193 |
194 void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthTokenUsingSigninProfile() { | 194 void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthTokenUsingSigninProfile() { |
195 scoped_refptr<net::URLRequestContextGetter> signin_context; | 195 scoped_refptr<net::URLRequestContextGetter> signin_context; |
196 Profile* signin_profile = chromeos::ProfileHelper::GetSigninProfile(); | 196 Profile* signin_profile = chromeos::ProfileHelper::GetSigninProfile(); |
197 if (signin_profile) | 197 if (signin_profile) |
198 signin_context = signin_profile->GetRequestContext(); | 198 signin_context = signin_profile->GetRequestContext(); |
199 if (!signin_context) { | 199 if (!signin_context.get()) { |
200 LOG(ERROR) << "No signin Profile for policy oauth token fetch!"; | 200 LOG(ERROR) << "No signin Profile for policy oauth token fetch!"; |
201 OnOAuth2PolicyTokenFetched(std::string()); | 201 OnOAuth2PolicyTokenFetched(std::string()); |
202 return; | 202 return; |
203 } | 203 } |
204 | 204 |
205 token_fetcher_.reset(new PolicyOAuth2TokenFetcher( | 205 token_fetcher_.reset(new PolicyOAuth2TokenFetcher( |
206 signin_context, | 206 signin_context.get(), |
207 g_browser_process->system_request_context(), | 207 g_browser_process->system_request_context(), |
208 base::Bind(&UserCloudPolicyManagerChromeOS::OnOAuth2PolicyTokenFetched, | 208 base::Bind(&UserCloudPolicyManagerChromeOS::OnOAuth2PolicyTokenFetched, |
209 base::Unretained(this)))); | 209 base::Unretained(this)))); |
210 token_fetcher_->Start(); | 210 token_fetcher_->Start(); |
211 } | 211 } |
212 | 212 |
213 void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthTokenUsingRefreshToken() { | 213 void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthTokenUsingRefreshToken() { |
214 token_fetcher_.reset(new PolicyOAuth2TokenFetcher( | 214 token_fetcher_.reset(new PolicyOAuth2TokenFetcher( |
215 g_browser_process->system_request_context(), | 215 g_browser_process->system_request_context(), |
216 oauth2_login_tokens_.refresh_token, | 216 oauth2_login_tokens_.refresh_token, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // start the scheduler. The |component_policy_service_| will call back into | 269 // start the scheduler. The |component_policy_service_| will call back into |
270 // OnComponentCloudPolicyUpdated() once it's ready. | 270 // OnComponentCloudPolicyUpdated() once it's ready. |
271 return; | 271 return; |
272 } | 272 } |
273 | 273 |
274 core()->StartRefreshScheduler(); | 274 core()->StartRefreshScheduler(); |
275 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate); | 275 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate); |
276 } | 276 } |
277 | 277 |
278 } // namespace policy | 278 } // namespace policy |
OLD | NEW |