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

Unified Diff: chrome/browser/policy/configuration_policy_provider.h

Issue 10386097: Refactored ConfigurationPolicyProvider to provide PolicyBundles instead of PolicyMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/configuration_policy_provider.h
diff --git a/chrome/browser/policy/configuration_policy_provider.h b/chrome/browser/policy/configuration_policy_provider.h
index 9ed150c2edcea4db27a7506dc6dec680188f4919..f12b285fafd47b112ae2c2d2320bdfab54c9fd5e 100644
--- a/chrome/browser/policy/configuration_policy_provider.h
+++ b/chrome/browser/policy/configuration_policy_provider.h
@@ -6,12 +6,10 @@
#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_
#pragma once
-#include <map>
-#include <string>
-
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
+#include "chrome/browser/policy/policy_bundle.h"
namespace policy {
@@ -37,8 +35,13 @@ class ConfigurationPolicyProvider {
// Fills the given |result| with the current policy values. Returns true if
// the policies were provided. This is used mainly by the
// ConfigurationPolicyPrefStore, which retrieves policy values from here.
+ // DEPRECATED: this call is going away, use policies() instead.
+ // http://crbug.com/108993
bool Provide(PolicyMap* result);
+ // Returns the current PolicyBundle.
+ const PolicyBundle& policies() const { return policy_bundle_; }
+
// Check whether this provider has completed initialization. This is used to
// detect whether initialization is done in case providers implementations
// need to do asynchronous operations for initialization.
@@ -57,11 +60,10 @@ class ConfigurationPolicyProvider {
static void FixDeprecatedPolicies(PolicyMap* policies);
protected:
- // Sends a policy update notification to observers.
- void NotifyPolicyUpdated();
-
- // Must be implemented by subclasses to provide their policy values.
- virtual bool ProvideInternal(PolicyMap* result) = 0;
+ // Subclasses must invoke this to update the policies currently served by
+ // this provider. UpdatePolicy() takes ownership of |policies|.
+ // The observers are notified after the policies are updated.
+ void UpdatePolicy(scoped_ptr<PolicyBundle> bundle);
const PolicyDefinitionList* policy_definition_list() const {
return policy_definition_list_;
@@ -73,6 +75,9 @@ class ConfigurationPolicyProvider {
virtual void AddObserver(Observer* observer);
virtual void RemoveObserver(Observer* observer);
+ // The policies currently configured at this provider.
+ PolicyBundle policy_bundle_;
+
// Contains the default mapping from policy values to the actual names.
const PolicyDefinitionList* policy_definition_list_;

Powered by Google App Engine
This is Rietveld 408576698