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: chrome/browser/policy/policy_service.h

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: Fixed mac tests Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ 5 #ifndef CHROME_BROWSER_POLICY_POLICY_SERVICE_H_
6 #define CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ 6 #define CHROME_BROWSER_POLICY_POLICY_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
bartfab (slow) 2013/11/05 15:53:04 Nit: No longer used.
Joao da Silva 2013/11/07 13:15:00 Done.
14 #include "chrome/browser/policy/policy_map.h" 14 #include "chrome/browser/policy/policy_map.h"
15 #include "components/policy/core/common/policy_namespace.h" 15 #include "components/policy/core/common/policy_namespace.h"
16 16
17 namespace policy { 17 namespace policy {
18 18
19 class PolicyDomainDescriptor;
20
21 // The PolicyService merges policies from all available sources, taking into 19 // The PolicyService merges policies from all available sources, taking into
22 // account their priorities. Policy clients can retrieve policy for their domain 20 // account their priorities. Policy clients can retrieve policy for their domain
23 // and register for notifications on policy updates. 21 // and register for notifications on policy updates.
24 // 22 //
25 // The PolicyService is available from BrowserProcess as a global singleton. 23 // The PolicyService is available from BrowserProcess as a global singleton.
26 // There is also a PolicyService for browser-wide policies available from 24 // There is also a PolicyService for browser-wide policies available from
27 // BrowserProcess as a global singleton. 25 // BrowserProcess as a global singleton.
28 class PolicyService { 26 class PolicyService {
29 public: 27 public:
30 class Observer { 28 class Observer {
(...skipping 16 matching lines...) Expand all
47 virtual ~Observer() {} 45 virtual ~Observer() {}
48 }; 46 };
49 47
50 virtual ~PolicyService() {} 48 virtual ~PolicyService() {}
51 49
52 // Observes changes to all components of the given |domain|. 50 // Observes changes to all components of the given |domain|.
53 virtual void AddObserver(PolicyDomain domain, Observer* observer) = 0; 51 virtual void AddObserver(PolicyDomain domain, Observer* observer) = 0;
54 52
55 virtual void RemoveObserver(PolicyDomain domain, Observer* observer) = 0; 53 virtual void RemoveObserver(PolicyDomain domain, Observer* observer) = 0;
56 54
57 // Registers the |descriptor| of a policy domain, indicated by
58 // |descriptor->domain()|. This overrides the descriptor previously set, if
59 // there was one.
60 // This registration signals that there is interest in receiving policy for
61 // the components listed in the descriptor. The policy providers will try to
62 // load policy for these components, and validate it against the descriptor.
63 // Cached data for components that aren't registered anymore may be dropped.
64 virtual void RegisterPolicyDomain(
65 scoped_refptr<const PolicyDomainDescriptor> descriptor) = 0;
66
67 virtual const PolicyMap& GetPolicies(const PolicyNamespace& ns) const = 0; 55 virtual const PolicyMap& GetPolicies(const PolicyNamespace& ns) const = 0;
68 56
69 virtual scoped_refptr<const PolicyDomainDescriptor> GetPolicyDomainDescriptor(
70 PolicyDomain domain) const = 0;
71
72 // The PolicyService loads policy from several sources, and some require 57 // The PolicyService loads policy from several sources, and some require
73 // asynchronous loads. IsInitializationComplete() returns true once all 58 // asynchronous loads. IsInitializationComplete() returns true once all
74 // sources have loaded their policies for the given |domain|. 59 // sources have loaded their policies for the given |domain|.
75 // It is safe to read policy from the PolicyService even if 60 // It is safe to read policy from the PolicyService even if
76 // IsInitializationComplete() is false; there will be an OnPolicyUpdated() 61 // IsInitializationComplete() is false; there will be an OnPolicyUpdated()
77 // notification once new policies become available. 62 // notification once new policies become available.
78 // 63 //
79 // OnPolicyServiceInitialized() is called when IsInitializationComplete() 64 // OnPolicyServiceInitialized() is called when IsInitializationComplete()
80 // becomes true, which happens at most once for each domain. 65 // becomes true, which happens at most once for each domain.
81 // If IsInitializationComplete() is already true for |domain| when an Observer 66 // If IsInitializationComplete() is already true for |domain| when an Observer
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 PolicyService* policy_service_; 106 PolicyService* policy_service_;
122 PolicyNamespace ns_; 107 PolicyNamespace ns_;
123 CallbackMap callback_map_; 108 CallbackMap callback_map_;
124 109
125 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); 110 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar);
126 }; 111 };
127 112
128 } // namespace policy 113 } // namespace policy
129 114
130 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ 115 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698