| 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/device_local_account_policy_provider.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana
ger.h" |
| 8 #include "chrome/browser/policy/cloud/cloud_policy_core.h" | 9 #include "chrome/browser/policy/cloud/cloud_policy_core.h" |
| 9 #include "chrome/browser/policy/cloud/cloud_policy_service.h" | 10 #include "chrome/browser/policy/cloud/cloud_policy_service.h" |
| 10 #include "chrome/browser/policy/policy_bundle.h" | 11 #include "chrome/browser/policy/policy_bundle.h" |
| 11 #include "components/policy/core/common/policy_namespace.h" | 12 #include "components/policy/core/common/policy_namespace.h" |
| 12 | 13 |
| 13 namespace policy { | 14 namespace policy { |
| 14 | 15 |
| 15 DeviceLocalAccountPolicyProvider::DeviceLocalAccountPolicyProvider( | 16 DeviceLocalAccountPolicyProvider::DeviceLocalAccountPolicyProvider( |
| 16 const std::string& user_id, | 17 const std::string& user_id, |
| 17 DeviceLocalAccountPolicyService* service) | 18 DeviceLocalAccountPolicyService* service) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 69 |
| 69 void DeviceLocalAccountPolicyProvider::UpdateFromBroker() { | 70 void DeviceLocalAccountPolicyProvider::UpdateFromBroker() { |
| 70 DeviceLocalAccountPolicyBroker* broker = GetBroker(); | 71 DeviceLocalAccountPolicyBroker* broker = GetBroker(); |
| 71 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 72 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |
| 72 if (broker) { | 73 if (broker) { |
| 73 store_initialized_ |= broker->core()->store()->is_initialized(); | 74 store_initialized_ |= broker->core()->store()->is_initialized(); |
| 74 if (!waiting_for_policy_refresh_) { | 75 if (!waiting_for_policy_refresh_) { |
| 75 // Copy policy from the broker. | 76 // Copy policy from the broker. |
| 76 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 77 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
| 77 .CopyFrom(broker->core()->store()->policy_map()); | 78 .CopyFrom(broker->core()->store()->policy_map()); |
| 79 external_data_manager_ = broker->external_data_manager(); |
| 78 } else { | 80 } else { |
| 79 // Wait for the refresh to finish. | 81 // Wait for the refresh to finish. |
| 80 return; | 82 return; |
| 81 } | 83 } |
| 82 } else { | 84 } else { |
| 83 // Keep existing policy, but do send an update. | 85 // Keep existing policy, but do send an update. |
| 84 waiting_for_policy_refresh_ = false; | 86 waiting_for_policy_refresh_ = false; |
| 85 weak_factory_.InvalidateWeakPtrs(); | 87 weak_factory_.InvalidateWeakPtrs(); |
| 86 bundle->CopyFrom(policies()); | 88 bundle->CopyFrom(policies()); |
| 87 } | 89 } |
| 88 UpdatePolicy(bundle.Pass()); | 90 UpdatePolicy(bundle.Pass()); |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace policy | 93 } // namespace policy |
| OLD | NEW |