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

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

Issue 2440473004: Add policy domain for signin screen apps (Closed)
Patch Set: More comments according to feedback Created 4 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 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 <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 component ID for the extension policies is equal to the extension ID. 26 // The component ID for the extension policies is equal to the extension ID.
27 POLICY_DOMAIN_EXTENSIONS, 27 POLICY_DOMAIN_EXTENSIONS,
28 28
29 // The namespace that corresponds to the policies for extensions running
30 // under Chrome OS signin profile. The component ID is equal to the extension
31 // ID.
32 POLICY_DOMAIN_SIGNIN_EXTENSIONS,
33
29 // Must be the last entry. 34 // Must be the last entry.
30 POLICY_DOMAIN_SIZE, 35 POLICY_DOMAIN_SIZE,
31 }; 36 };
32 37
33 // Groups a policy domain and a component ID in a single object representing 38 // Groups a policy domain and a component ID in a single object representing
34 // a policy namespace. Objects of this class can be used as keys in std::maps. 39 // a policy namespace. Objects of this class can be used as keys in std::maps.
35 struct POLICY_EXPORT PolicyNamespace { 40 struct POLICY_EXPORT PolicyNamespace {
36 PolicyNamespace(); 41 PolicyNamespace();
37 PolicyNamespace(PolicyDomain domain, const std::string& component_id); 42 PolicyNamespace(PolicyDomain domain, const std::string& component_id);
38 PolicyNamespace(const PolicyNamespace& other); 43 PolicyNamespace(const PolicyNamespace& other);
(...skipping 20 matching lines...) Expand all
59 template <> 64 template <>
60 struct hash<policy::PolicyNamespace> { 65 struct hash<policy::PolicyNamespace> {
61 std::size_t operator()(const policy::PolicyNamespace& ns) const { 66 std::size_t operator()(const policy::PolicyNamespace& ns) const {
62 return hash<std::string>()(ns.component_id) ^ (UINT64_C(1) << ns.domain); 67 return hash<std::string>()(ns.component_id) ^ (UINT64_C(1) << ns.domain);
63 } 68 }
64 }; 69 };
65 70
66 } // namespace BASE_HASH_NAMESPACE 71 } // namespace BASE_HASH_NAMESPACE
67 72
68 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_ 73 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698