OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/policy/cloud/component_cloud_policy_store.h" | 5 #include "chrome/browser/policy/cloud/component_cloud_policy_store.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 cached_hashes_.erase(prev); | 224 cached_hashes_.erase(prev); |
225 } else { | 225 } else { |
226 ++it; | 226 ++it; |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 if (purged_current_policies) | 230 if (purged_current_policies) |
231 delegate_->OnComponentCloudPolicyStoreUpdated(); | 231 delegate_->OnComponentCloudPolicyStoreUpdated(); |
232 } | 232 } |
233 | 233 |
234 void ComponentCloudPolicyStore::Clear() { | |
235 const std::set<std::string> empty; | |
bartfab (slow)
2013/11/18 13:15:39
Nit: Not used.
Joao da Silva
2013/11/18 14:54:18
Eh, what is this doing here :-) Done
| |
236 for (size_t i = 0; i < arraysize(kDomains); ++i) { | |
237 cache_->Clear(kDomains[i].proto_cache_key); | |
238 cache_->Clear(kDomains[i].data_cache_key); | |
239 } | |
240 cached_hashes_.clear(); | |
241 const PolicyBundle empty_bundle; | |
242 if (!policy_bundle_.Equals(empty_bundle)) { | |
243 policy_bundle_.Clear(); | |
244 delegate_->OnComponentCloudPolicyStoreUpdated(); | |
245 } | |
246 } | |
247 | |
234 bool ComponentCloudPolicyStore::ValidatePolicy( | 248 bool ComponentCloudPolicyStore::ValidatePolicy( |
235 scoped_ptr<em::PolicyFetchResponse> proto, | 249 scoped_ptr<em::PolicyFetchResponse> proto, |
236 PolicyNamespace* ns, | 250 PolicyNamespace* ns, |
237 em::ExternalPolicyData* payload) { | 251 em::ExternalPolicyData* payload) { |
238 em::PolicyData policy_data; | 252 em::PolicyData policy_data; |
239 if (!ValidateProto( | 253 if (!ValidateProto( |
240 proto.Pass(), std::string(), std::string(), payload, &policy_data)) { | 254 proto.Pass(), std::string(), std::string(), payload, &policy_data)) { |
241 return false; | 255 return false; |
242 } | 256 } |
243 | 257 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 // If policy for components is ever used for device-level settings then | 353 // If policy for components is ever used for device-level settings then |
340 // this must support a configurable scope; assuming POLICY_SCOPE_USER is | 354 // this must support a configurable scope; assuming POLICY_SCOPE_USER is |
341 // fine for now. | 355 // fine for now. |
342 policy->Set(it.key(), level, POLICY_SCOPE_USER, value.release(), NULL); | 356 policy->Set(it.key(), level, POLICY_SCOPE_USER, value.release(), NULL); |
343 } | 357 } |
344 | 358 |
345 return true; | 359 return true; |
346 } | 360 } |
347 | 361 |
348 } // namespace policy | 362 } // namespace policy |
OLD | NEW |