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