Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2609)

Unified Diff: chrome/browser/policy/cloud/component_cloud_policy_store.cc

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/cloud/component_cloud_policy_store.cc
diff --git a/chrome/browser/policy/cloud/component_cloud_policy_store.cc b/chrome/browser/policy/cloud/component_cloud_policy_store.cc
index e049c3b011d4c68452f0e61f3cc54f8ca2b13918..879fd4b62dc0d0830116c47daf99eda043432010 100644
--- a/chrome/browser/policy/cloud/component_cloud_policy_store.cc
+++ b/chrome/browser/policy/cloud/component_cloud_policy_store.cc
@@ -12,7 +12,6 @@
#include "base/values.h"
#include "chrome/browser/policy/cloud/cloud_policy_constants.h"
#include "chrome/browser/policy/cloud/cloud_policy_validator.h"
-#include "chrome/browser/policy/cloud/resource_cache.h"
#include "chrome/browser/policy/external_data_fetcher.h"
#include "chrome/browser/policy/policy_map.h"
#include "chrome/browser/policy/proto/cloud/chrome_extension_policy.pb.h"
@@ -188,22 +187,23 @@ void ComponentCloudPolicyStore::Delete(const PolicyNamespace& ns) {
}
}
-void ComponentCloudPolicyStore::Purge(PolicyDomain domain,
- const std::set<std::string>& keep) {
+void ComponentCloudPolicyStore::Purge(
+ PolicyDomain domain,
+ const ResourceCache::SubkeyFilter& filter) {
DCHECK(CalledOnValidThread());
const DomainConstants* constants = GetDomainConstants(domain);
if (!constants)
return;
- cache_->PurgeOtherSubkeys(constants->proto_cache_key, keep);
- cache_->PurgeOtherSubkeys(constants->data_cache_key, keep);
+ cache_->FilterSubkeys(constants->proto_cache_key, filter);
+ cache_->FilterSubkeys(constants->data_cache_key, filter);
// Stop serving policies for purged namespaces.
bool purged_current_policies = false;
for (PolicyBundle::const_iterator it = policy_bundle_.begin();
it != policy_bundle_.end(); ++it) {
if (it->first.domain == domain &&
- keep.find(it->first.component_id) == keep.end() &&
+ filter.Run(it->first.component_id) &&
!policy_bundle_.Get(it->first).empty()) {
policy_bundle_.Get(it->first).Clear();
purged_current_policies = true;
@@ -214,8 +214,7 @@ void ComponentCloudPolicyStore::Purge(PolicyDomain domain,
// policy state changes.
std::map<PolicyNamespace, std::string>::iterator it = cached_hashes_.begin();
while (it != cached_hashes_.end()) {
- if (it->first.domain == domain &&
- keep.find(it->first.component_id) == keep.end()) {
+ if (it->first.domain == domain && filter.Run(it->first.component_id)) {
std::map<PolicyNamespace, std::string>::iterator prev = it;
++it;
cached_hashes_.erase(prev);

Powered by Google App Engine
This is Rietveld 408576698