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

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

Powered by Google App Engine
This is Rietveld 408576698