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

Side by Side Diff: chrome/browser/policy/configuration_policy_provider.h

Issue 15061007: Added a PolicyDomainDescriptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | Annotate | Revision Log
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_CONFIGURATION_POLICY_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
7 7
8 #include <set>
9 #include <string>
10
11 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 11 #include "base/observer_list.h"
14 #include "chrome/browser/policy/policy_bundle.h" 12 #include "chrome/browser/policy/policy_bundle.h"
15 #include "chrome/browser/policy/policy_service.h" 13 #include "chrome/browser/policy/policy_service.h"
16 14
17 namespace policy { 15 namespace policy {
18 16
17 class PolicyDomainDescriptor;
18
19 // A mostly-abstract super class for platform-specific policy providers. 19 // A mostly-abstract super class for platform-specific policy providers.
20 // Platform-specific policy providers (Windows Group Policy, gconf, 20 // Platform-specific policy providers (Windows Group Policy, gconf,
21 // etc.) should implement a subclass of this class. 21 // etc.) should implement a subclass of this class.
22 class ConfigurationPolicyProvider { 22 class ConfigurationPolicyProvider {
23 public: 23 public:
24 class Observer { 24 class Observer {
25 public: 25 public:
26 virtual ~Observer(); 26 virtual ~Observer();
27 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) = 0; 27 virtual void OnUpdatePolicy(ConfigurationPolicyProvider* provider) = 0;
28 }; 28 };
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // which are guaranteed to happen even if the refresh fails. 61 // which are guaranteed to happen even if the refresh fails.
62 // It is possible that Shutdown() is called first though, and 62 // It is possible that Shutdown() is called first though, and
63 // OnUpdatePolicy won't be called if that happens. 63 // OnUpdatePolicy won't be called if that happens.
64 virtual void RefreshPolicies() = 0; 64 virtual void RefreshPolicies() = 0;
65 65
66 // Observers must detach themselves before the provider is deleted. 66 // Observers must detach themselves before the provider is deleted.
67 virtual void AddObserver(Observer* observer); 67 virtual void AddObserver(Observer* observer);
68 virtual void RemoveObserver(Observer* observer); 68 virtual void RemoveObserver(Observer* observer);
69 69
70 // Notifies the provider that there is interest in loading policy for the 70 // Notifies the provider that there is interest in loading policy for the
71 // listed components of the given |domain|. The list is complete; all the 71 // listed components in the given |descriptor|. The list is complete; all the
72 // components that matter for the domain are included, and components not 72 // components that matter for the domain are included, and components not
73 // included can be discarded. The provider can ignore this information or use 73 // included can be discarded. The provider can ignore this information or use
74 // it to selectively load the corresponding policy from its sources. 74 // it to selectively load the corresponding policy from its sources.
75 virtual void RegisterPolicyDomain( 75 virtual void RegisterPolicyDomain(
76 PolicyDomain domain, 76 scoped_refptr<const PolicyDomainDescriptor> descriptor);
77 const std::set<std::string>& component_ids);
78 77
79 protected: 78 protected:
80 // Subclasses must invoke this to update the policies currently served by 79 // Subclasses must invoke this to update the policies currently served by
81 // this provider. UpdatePolicy() takes ownership of |policies|. 80 // this provider. UpdatePolicy() takes ownership of |policies|.
82 // The observers are notified after the policies are updated. 81 // The observers are notified after the policies are updated.
83 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); 82 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle);
84 83
85 private: 84 private:
86 // The policies currently configured at this provider. 85 // The policies currently configured at this provider.
87 PolicyBundle policy_bundle_; 86 PolicyBundle policy_bundle_;
88 87
89 // Whether Shutdown() has been invoked. 88 // Whether Shutdown() has been invoked.
90 bool did_shutdown_; 89 bool did_shutdown_;
91 90
92 ObserverList<Observer, true> observer_list_; 91 ObserverList<Observer, true> observer_list_;
93 92
94 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); 93 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider);
95 }; 94 };
96 95
97 } // namespace policy 96 } // namespace policy
98 97
99 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ 98 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698