| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Wait for the refresh to finish. | 152 // Wait for the refresh to finish. |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 } else { | 155 } else { |
| 156 // Keep existing policy, but do send an update. | 156 // Keep existing policy, but do send an update. |
| 157 waiting_for_policy_refresh_ = false; | 157 waiting_for_policy_refresh_ = false; |
| 158 weak_factory_.InvalidateWeakPtrs(); | 158 weak_factory_.InvalidateWeakPtrs(); |
| 159 bundle->CopyFrom(policies()); | 159 bundle->CopyFrom(policies()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 PolicyMap& chrome_policy = |
| 163 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
| 164 // Apply the defaults for policies that haven't been configured by the |
| 165 // administrator given that this is an enterprise user. |
| 166 SetEnterpriseUsersDefaults(&chrome_policy); |
| 167 |
| 162 // Apply overrides. | 168 // Apply overrides. |
| 163 if (chrome_policy_overrides_) { | 169 if (chrome_policy_overrides_) { |
| 164 PolicyMap& chrome_policy = | |
| 165 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | |
| 166 for (const auto& policy_override : *chrome_policy_overrides_) { | 170 for (const auto& policy_override : *chrome_policy_overrides_) { |
| 167 const PolicyMap::Entry& entry = policy_override.second; | 171 const PolicyMap::Entry& entry = policy_override.second; |
| 168 chrome_policy.Set(policy_override.first, entry.level, entry.scope, | 172 chrome_policy.Set(policy_override.first, entry.level, entry.scope, |
| 169 entry.source, entry.value->CreateDeepCopy(), nullptr); | 173 entry.source, entry.value->CreateDeepCopy(), nullptr); |
| 170 } | 174 } |
| 171 } | 175 } |
| 172 | 176 |
| 173 UpdatePolicy(std::move(bundle)); | 177 UpdatePolicy(std::move(bundle)); |
| 174 } | 178 } |
| 175 | 179 |
| 176 } // namespace policy | 180 } // namespace policy |
| OLD | NEW |