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 <set> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
11 #include "base/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
12 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
13 #include "base/values.h" | 15 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/login/helper.h" | 17 #include "chrome/browser/chromeos/login/helper.h" |
16 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 18 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 19 #include "chrome/browser/chromeos/login/users/affiliation.h" |
| 20 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
17 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" | 21 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" |
18 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 22 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
19 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" | 23 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" |
20 #include "chrome/browser/lifetime/application_lifetime.h" | 24 #include "chrome/browser/lifetime/application_lifetime.h" |
21 #include "chrome/common/chrome_content_client.h" | 25 #include "chrome/common/chrome_content_client.h" |
22 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 26 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
23 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" | 27 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" |
24 #include "components/policy/core/common/cloud/device_management_service.h" | 28 #include "components/policy/core/common/cloud/device_management_service.h" |
25 #include "components/policy/core/common/cloud/system_policy_request_context.h" | 29 #include "components/policy/core/common/cloud/system_policy_request_context.h" |
26 #include "components/policy/core/common/policy_map.h" | 30 #include "components/policy/core/common/policy_map.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 cloud_policy_client->status()); | 271 cloud_policy_client->status()); |
268 } | 272 } |
269 CancelWaitForPolicyFetch(); | 273 CancelWaitForPolicyFetch(); |
270 } | 274 } |
271 | 275 |
272 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { | 276 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { |
273 CloudPolicyManager::OnComponentCloudPolicyUpdated(); | 277 CloudPolicyManager::OnComponentCloudPolicyUpdated(); |
274 StartRefreshSchedulerIfReady(); | 278 StartRefreshSchedulerIfReady(); |
275 } | 279 } |
276 | 280 |
| 281 void UserCloudPolicyManagerChromeOS::OnStoreLoaded( |
| 282 CloudPolicyStore* cloud_policy_store) { |
| 283 CloudPolicyManager::OnStoreLoaded(cloud_policy_store); |
| 284 |
| 285 em::PolicyData const* const policy_data = cloud_policy_store->policy(); |
| 286 |
| 287 if (policy_data) { |
| 288 chromeos::AffiliationIDSet set_of_user_affiliation_ids( |
| 289 policy_data->user_affiliation_ids().begin(), |
| 290 policy_data->user_affiliation_ids().end()); |
| 291 |
| 292 chromeos::ChromeUserManager::Get()->SetUserAffiliation( |
| 293 policy_data->username(), set_of_user_affiliation_ids); |
| 294 } |
| 295 } |
| 296 |
277 void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { | 297 void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { |
278 CloudPolicyManager::GetChromePolicy(policy_map); | 298 CloudPolicyManager::GetChromePolicy(policy_map); |
279 | 299 |
280 // If the store has a verified policy blob received from the server then apply | 300 // If the store has a verified policy blob received from the server then apply |
281 // the defaults for policies that haven't been configured by the administrator | 301 // the defaults for policies that haven't been configured by the administrator |
282 // given that this is an enterprise user. | 302 // given that this is an enterprise user. |
283 if (!store()->has_policy()) | 303 if (!store()->has_policy()) |
284 return; | 304 return; |
285 SetEnterpriseUsersDefaults(policy_map); | 305 SetEnterpriseUsersDefaults(policy_map); |
286 } | 306 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // OnComponentCloudPolicyUpdated() once it's ready. | 416 // OnComponentCloudPolicyUpdated() once it's ready. |
397 return; | 417 return; |
398 } | 418 } |
399 | 419 |
400 core()->StartRefreshScheduler(); | 420 core()->StartRefreshScheduler(); |
401 core()->TrackRefreshDelayPref(local_state_, | 421 core()->TrackRefreshDelayPref(local_state_, |
402 policy_prefs::kUserPolicyRefreshRate); | 422 policy_prefs::kUserPolicyRefreshRate); |
403 } | 423 } |
404 | 424 |
405 } // namespace policy | 425 } // namespace policy |
OLD | NEW |