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

Unified Diff: components/policy/core/common/policy_namespace.h

Issue 756133002: Purge cache when the server removes the policy for an extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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: components/policy/core/common/policy_namespace.h
diff --git a/components/policy/core/common/policy_namespace.h b/components/policy/core/common/policy_namespace.h
index 86dc5866afc5f7b207080626ebd3c636fc401175..838fcb8a3cf745fd3d667b6133dd337e927e51e9 100644
--- a/components/policy/core/common/policy_namespace.h
+++ b/components/policy/core/common/policy_namespace.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/containers/hash_tables.h"
#include "components/policy/policy_export.h"
namespace policy {
@@ -49,4 +50,18 @@ typedef std::vector<PolicyNamespace> PolicyNamespaceList;
} // namespace policy
+// Define a custom std::hash for PolicyNamespace so that it can be used as
+// a key in hash_maps, and in particular in ScopedPtrHashMaps (which use the
+// default std::hash).
+namespace BASE_HASH_NAMESPACE {
+
+template <>
+struct hash<policy::PolicyNamespace> {
+ std::size_t operator()(const policy::PolicyNamespace& ns) const {
+ return hash<std::string>()(ns.component_id) ^ (1 << ns.domain);
+ }
+};
+
+} // namespace BASE_HASH_NAMESPACE
+
#endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_

Powered by Google App Engine
This is Rietveld 408576698