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