policy_namespace.h revision 1e9bf3e0803691d0a228da41fc608347b6db4340
11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
21e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
31e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// found in the LICENSE file.
41e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
51e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
61e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#define COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
71e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
81e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include <string>
91e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "components/policy/policy_export.h"
111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace policy {
131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Policies are namespaced by a (PolicyDomain, ID) pair. The meaning of the ID
151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// string depends on the domain; for example, if the PolicyDomain is
161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// "extensions" then the ID identifies the extension that the policies control.
171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)enum POLICY_EXPORT PolicyDomain {
181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // The component ID for chrome policies is always the empty string.
191e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  POLICY_DOMAIN_CHROME,
201e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
211e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // The extensions policy domain is a work in progress. Included here for
221e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // tests.
231e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  POLICY_DOMAIN_EXTENSIONS,
241e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
251e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Must be the last entry.
261e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  POLICY_DOMAIN_SIZE,
271e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)};
281e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Groups a policy domain and a component ID in a single object representing
301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// a policy namespace. Objects of this class can be used as keys in std::maps.
311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)struct POLICY_EXPORT PolicyNamespace {
321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) public:
331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  PolicyNamespace();
341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  PolicyNamespace(PolicyDomain domain, const std::string& component_id);
351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  PolicyNamespace(const PolicyNamespace& other);
361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  ~PolicyNamespace();
371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  PolicyNamespace& operator=(const PolicyNamespace& other);
391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool operator<(const PolicyNamespace& other) const;
401e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool operator==(const PolicyNamespace& other) const;
411e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool operator!=(const PolicyNamespace& other) const;
421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  PolicyDomain domain;
441e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  std::string component_id;
451e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)};
461e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)}  // namespace policy
481e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
491e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#endif  // COMPONENTS_POLICY_CORE_COMMON_POLICY_NAMESPACE_H_
50