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

Unified Diff: components/offline_pages/client_policy_controller.cc

Issue 2415473003: Query API: Introduces an OfflinePageModelQuery object. (Closed)
Patch Set: Stop making a new client policy controller, have a dangling pointer. Created 4 years, 2 months 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: components/offline_pages/client_policy_controller.cc
diff --git a/components/offline_pages/client_policy_controller.cc b/components/offline_pages/client_policy_controller.cc
index 23772308ec9f5490ddc75e9ed79469a727f75a0c..81ef09e32e59322cf5c0d1acad4f2a269328625c 100644
--- a/components/offline_pages/client_policy_controller.cc
+++ b/components/offline_pages/client_policy_controller.cc
@@ -4,6 +4,7 @@
#include "components/offline_pages/client_policy_controller.h"
+#include <set>
#include <utility>
#include "base/memory/ptr_util.h"
@@ -84,6 +85,18 @@ const OfflinePageClientPolicy& ClientPolicyController::GetPolicy(
return policies_.at(kDefaultNamespace);
}
+std::vector<std::string> ClientPolicyController::GetAllNamespacesExcept(
+ const std::vector<std::string>& exceptions) const {
+ std::set<std::string> exception_set(exceptions.begin(), exceptions.end());
+ std::vector<std::string> result;
+ for (const auto& policy_item : policies_) {
+ if (exception_set.count(policy_item.first) == 0)
+ result.emplace_back(policy_item.first);
+ }
+
+ return result;
+}
+
bool ClientPolicyController::IsRemovedOnCacheReset(
const std::string& name_space) const {
return GetPolicy(name_space).feature_policy.is_removed_on_cache_reset;

Powered by Google App Engine
This is Rietveld 408576698