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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/containers/hash_tables.h"
11 #include "components/policy/policy_export.h" 12 #include "components/policy/policy_export.h"
12 13
13 namespace policy { 14 namespace policy {
14 15
15 // Policies are namespaced by a (PolicyDomain, ID) pair. The meaning of the ID 16 // Policies are namespaced by a (PolicyDomain, ID) pair. The meaning of the ID
16 // string depends on the domain; for example, if the PolicyDomain is 17 // string depends on the domain; for example, if the PolicyDomain is
17 // "extensions" then the ID identifies the extension that the policies control. 18 // "extensions" then the ID identifies the extension that the policies control.
18 enum POLICY_EXPORT PolicyDomain { 19 enum POLICY_EXPORT PolicyDomain {
19 // The component ID for chrome policies is always the empty string. 20 // The component ID for chrome policies is always the empty string.
20 POLICY_DOMAIN_CHROME, 21 POLICY_DOMAIN_CHROME,
(...skipping 21 matching lines...) Expand all
42 bool operator!=(const PolicyNamespace& other) const; 43 bool operator!=(const PolicyNamespace& other) const;
43 44
44 PolicyDomain domain; 45 PolicyDomain domain;
45 std::string component_id; 46 std::string component_id;
46 }; 47 };
47 48
48 typedef std::vector<PolicyNamespace> PolicyNamespaceList; 49 typedef std::vector<PolicyNamespace> PolicyNamespaceList;
49 50
50 } // namespace policy 51 } // namespace policy
51 52
53 // Define a custom std::hash for PolicyNamespace so that it can be used as
54 // a key in hash_maps, and in particular in ScopedPtrHashMaps (which use the
55 // default std::hash).
56 namespace BASE_HASH_NAMESPACE {
57
58 template <>
59 struct hash<policy::PolicyNamespace> {
60 std::size_t operator()(const policy::PolicyNamespace& ns) const {
61 return hash<std::string>()(ns.component_id) ^ (1 << ns.domain);
62 }
63 };
64
65 } // namespace BASE_HASH_NAMESPACE
66
52 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_ 67 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698