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

Unified Diff: components/offline_pages/client_policy_controller.cc

Issue 2415473003: Query API: Introduces an OfflinePageModelQuery object. (Closed)
Patch Set: Address comments, add more tests, rename enum. 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..3102f386535423cd920053e4d77c8764d380ef85 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>
fgorski 2016/10/26 18:05:41 remove?
dewittj 2016/10/27 22:49:17 Done.
#include <utility>
#include "base/memory/ptr_util.h"
@@ -84,6 +85,14 @@ const OfflinePageClientPolicy& ClientPolicyController::GetPolicy(
return policies_.at(kDefaultNamespace);
}
+std::vector<std::string> ClientPolicyController::GetAllNamespaces() const {
+ std::vector<std::string> result;
+ for (const auto& policy_item : policies_)
+ 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;
@@ -145,4 +154,10 @@ ClientPolicyController::GetNamespacesRestrictedToOriginalTab() const {
return *show_in_original_tab_cache_;
}
+void ClientPolicyController::AddPolicyForTest(
+ std::string name_space,
+ const OfflinePageClientPolicyBuilder& builder) {
+ policies_.insert(std::make_pair(name_space, builder.Build()));
+}
+
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698