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 if (policy_data) { | |
286 std::set<std::string> set_of_user_affiliation_ids( | |
287 policy_data->user_affiliation_ids().begin(), | |
288 policy_data->user_affiliation_ids().end()); | |
289 | |
290 chromeos::ChromeUserManager::Get()->SetUserAffiliation( | |
291 policy_data->username(), set_of_user_affiliation_ids); | |
Mattias Nissler (ping if slow)
2015/07/30 12:10:57
Do we need to canonicalize the user name here? We'
peletskyi
2015/07/30 14:10:57
Done.
| |
292 } | |
293 } | |
294 | |
277 void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { | 295 void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { |
278 CloudPolicyManager::GetChromePolicy(policy_map); | 296 CloudPolicyManager::GetChromePolicy(policy_map); |
279 | 297 |
280 // If the store has a verified policy blob received from the server then apply | 298 // 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 | 299 // the defaults for policies that haven't been configured by the administrator |
282 // given that this is an enterprise user. | 300 // given that this is an enterprise user. |
283 if (!store()->has_policy()) | 301 if (!store()->has_policy()) |
284 return; | 302 return; |
285 SetEnterpriseUsersDefaults(policy_map); | 303 SetEnterpriseUsersDefaults(policy_map); |
286 } | 304 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 // OnComponentCloudPolicyUpdated() once it's ready. | 414 // OnComponentCloudPolicyUpdated() once it's ready. |
397 return; | 415 return; |
398 } | 416 } |
399 | 417 |
400 core()->StartRefreshScheduler(); | 418 core()->StartRefreshScheduler(); |
401 core()->TrackRefreshDelayPref(local_state_, | 419 core()->TrackRefreshDelayPref(local_state_, |
402 policy_prefs::kUserPolicyRefreshRate); | 420 policy_prefs::kUserPolicyRefreshRate); |
403 } | 421 } |
404 | 422 |
405 } // namespace policy | 423 } // namespace policy |
OLD | NEW |