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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { | 275 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { |
276 CloudPolicyManager::OnComponentCloudPolicyUpdated(); | 276 CloudPolicyManager::OnComponentCloudPolicyUpdated(); |
277 StartRefreshSchedulerIfReady(); | 277 StartRefreshSchedulerIfReady(); |
278 } | 278 } |
279 | 279 |
280 void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { | 280 void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { |
281 CloudPolicyManager::GetChromePolicy(policy_map); | 281 CloudPolicyManager::GetChromePolicy(policy_map); |
282 | 282 |
283 // Default multi-profile behavior for managed accounts to primary-only. | 283 // If the store has a verified policy blob received from the server then apply |
284 if (store()->has_policy() && | 284 // the defaults for policies that haven't been configured by the administrator |
285 !policy_map->Get(key::kChromeOsMultiProfileUserBehavior)) { | 285 // given that this is an enterprise user. |
286 policy_map->Set(key::kChromeOsMultiProfileUserBehavior, | 286 if (!store()->has_policy()) |
287 POLICY_LEVEL_MANDATORY, | 287 return; |
288 POLICY_SCOPE_USER, | 288 SetEnterpriseUsersDefaults(policy_map); |
289 new base::StringValue("primary-only"), | |
290 NULL); | |
291 } | |
292 | |
293 // Set EasyUnlockAllowed policy to false by default for managed accounts. | |
294 if (store()->has_policy() && | |
295 !policy_map->Get(key::kEasyUnlockAllowed)) { | |
296 policy_map->Set(key::kEasyUnlockAllowed, | |
297 POLICY_LEVEL_MANDATORY, | |
298 POLICY_SCOPE_USER, | |
299 new base::FundamentalValue(false), | |
300 NULL); | |
301 } | |
302 } | 289 } |
303 | 290 |
304 void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthTokenUsingSigninProfile() { | 291 void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthTokenUsingSigninProfile() { |
305 scoped_refptr<net::URLRequestContextGetter> signin_context; | 292 scoped_refptr<net::URLRequestContextGetter> signin_context; |
306 Profile* signin_profile = chromeos::ProfileHelper::GetSigninProfile(); | 293 Profile* signin_profile = chromeos::ProfileHelper::GetSigninProfile(); |
307 if (signin_profile) | 294 if (signin_profile) |
308 signin_context = signin_profile->GetRequestContext(); | 295 signin_context = signin_profile->GetRequestContext(); |
309 if (!signin_context.get()) { | 296 if (!signin_context.get()) { |
310 LOG(ERROR) << "No signin Profile for policy oauth token fetch!"; | 297 LOG(ERROR) << "No signin Profile for policy oauth token fetch!"; |
311 OnOAuth2PolicyTokenFetched( | 298 OnOAuth2PolicyTokenFetched( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // OnComponentCloudPolicyUpdated() once it's ready. | 386 // OnComponentCloudPolicyUpdated() once it's ready. |
400 return; | 387 return; |
401 } | 388 } |
402 | 389 |
403 core()->StartRefreshScheduler(); | 390 core()->StartRefreshScheduler(); |
404 core()->TrackRefreshDelayPref(local_state_, | 391 core()->TrackRefreshDelayPref(local_state_, |
405 policy_prefs::kUserPolicyRefreshRate); | 392 policy_prefs::kUserPolicyRefreshRate); |
406 } | 393 } |
407 | 394 |
408 } // namespace policy | 395 } // namespace policy |
OLD | NEW |