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

Side by Side Diff: components/policy/core/common/policy_namespace.h

Issue 2357653002: Fix a comment in the PolicyDomain enum definition (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "components/policy/policy_export.h" 15 #include "components/policy/policy_export.h"
16 16
17 namespace policy { 17 namespace policy {
18 18
19 // Policies are namespaced by a (PolicyDomain, ID) pair. The meaning of the ID 19 // Policies are namespaced by a (PolicyDomain, ID) pair. The meaning of the ID
20 // string depends on the domain; for example, if the PolicyDomain is 20 // string depends on the domain; for example, if the PolicyDomain is
21 // "extensions" then the ID identifies the extension that the policies control. 21 // "extensions" then the ID identifies the extension that the policies control.
22 enum PolicyDomain { 22 enum PolicyDomain {
23 // The component ID for chrome policies is always the empty string. 23 // The component ID for chrome policies is always the empty string.
24 POLICY_DOMAIN_CHROME, 24 POLICY_DOMAIN_CHROME,
25 25
26 // The extensions policy domain is a work in progress. Included here for 26 // The component ID for the extension policies is equal to the extension ID.
27 // tests.
28 POLICY_DOMAIN_EXTENSIONS, 27 POLICY_DOMAIN_EXTENSIONS,
29 28
30 // Must be the last entry. 29 // Must be the last entry.
31 POLICY_DOMAIN_SIZE, 30 POLICY_DOMAIN_SIZE,
32 }; 31 };
33 32
34 // Groups a policy domain and a component ID in a single object representing 33 // Groups a policy domain and a component ID in a single object representing
35 // a policy namespace. Objects of this class can be used as keys in std::maps. 34 // a policy namespace. Objects of this class can be used as keys in std::maps.
36 struct POLICY_EXPORT PolicyNamespace { 35 struct POLICY_EXPORT PolicyNamespace {
37 public:
38 PolicyNamespace(); 36 PolicyNamespace();
39 PolicyNamespace(PolicyDomain domain, const std::string& component_id); 37 PolicyNamespace(PolicyDomain domain, const std::string& component_id);
40 PolicyNamespace(const PolicyNamespace& other); 38 PolicyNamespace(const PolicyNamespace& other);
41 ~PolicyNamespace(); 39 ~PolicyNamespace();
42 40
43 PolicyNamespace& operator=(const PolicyNamespace& other); 41 PolicyNamespace& operator=(const PolicyNamespace& other);
44 bool operator<(const PolicyNamespace& other) const; 42 bool operator<(const PolicyNamespace& other) const;
45 bool operator==(const PolicyNamespace& other) const; 43 bool operator==(const PolicyNamespace& other) const;
46 bool operator!=(const PolicyNamespace& other) const; 44 bool operator!=(const PolicyNamespace& other) const;
47 45
(...skipping 13 matching lines...) Expand all
61 template <> 59 template <>
62 struct hash<policy::PolicyNamespace> { 60 struct hash<policy::PolicyNamespace> {
63 std::size_t operator()(const policy::PolicyNamespace& ns) const { 61 std::size_t operator()(const policy::PolicyNamespace& ns) const {
64 return hash<std::string>()(ns.component_id) ^ (UINT64_C(1) << ns.domain); 62 return hash<std::string>()(ns.component_id) ^ (UINT64_C(1) << ns.domain);
65 } 63 }
66 }; 64 };
67 65
68 } // namespace BASE_HASH_NAMESPACE 66 } // namespace BASE_HASH_NAMESPACE
69 67
70 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_ 68 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698