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

Unified Diff: chrome/browser/policy/async_policy_loader.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/async_policy_loader.h
diff --git a/chrome/browser/policy/async_policy_loader.h b/chrome/browser/policy/async_policy_loader.h
index 57f346ce3fa4ce01c999a846f1304f034e309770..8448b4ec979a43a70725b4bc02ba2e709a691a57 100644
--- a/chrome/browser/policy/async_policy_loader.h
+++ b/chrome/browser/policy/async_policy_loader.h
@@ -12,6 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
+#include "chrome/browser/policy/schema_map.h"
#include "components/policy/core/common/policy_namespace.h"
bartfab (slow) 2013/11/05 15:53:04 Nit: No longer used.
Joao da Silva 2013/11/07 13:15:00 Done.
namespace base {
@@ -21,7 +22,6 @@ class SequencedTaskRunner;
namespace policy {
class PolicyBundle;
-class PolicyDomainDescriptor;
// Base implementation for platform-specific policy loaders. Together with the
// AsyncPolicyProvider, this base implementation takes care of the initial load,
@@ -55,6 +55,11 @@ class AsyncPolicyLoader {
// or base::Time() if it doesn't apply, which is the default.
virtual base::Time LastModificationTime();
+ // Used by the AsyncPolicyProvider to do the initial Load(). The first load
+ // is also used to initialize |last_modification_time_| and
+ // |schema_map_|.
+ scoped_ptr<PolicyBundle> InitialLoad(const scoped_refptr<SchemaMap>& schemas);
+
// Implementations should invoke Reload() when a change is detected. This
// must be invoked from the background thread and will trigger a Load(),
// and pass the returned bundle to the provider.
@@ -66,19 +71,7 @@ class AsyncPolicyLoader {
// makes sure the policies are reloaded if the update events aren't triggered.
void Reload(bool force);
- // Passes the current |descriptor| for a domain, which is used to determine
- // which policy names are supported for each component.
- void RegisterPolicyDomain(
- scoped_refptr<const PolicyDomainDescriptor> descriptor);
-
- protected:
- typedef std::map<PolicyDomain, scoped_refptr<const PolicyDomainDescriptor> >
- DescriptorMap;
-
- // Returns the current DescriptorMap. This can be used by implementations to
- // determine the components registered for each domain, and to filter out
- // unknonwn policies.
- const DescriptorMap& descriptor_map() const { return descriptor_map_; }
+ const scoped_refptr<SchemaMap>& schema_map() const { return schema_map_; }
private:
// Allow AsyncPolicyProvider to call Init().
@@ -86,14 +79,13 @@ class AsyncPolicyLoader {
typedef base::Callback<void(scoped_ptr<PolicyBundle>)> UpdateCallback;
- // Used by the AsyncPolicyProvider to do the initial Load(). The first load
- // is also used to initialize |last_modification_time_|.
- scoped_ptr<PolicyBundle> InitialLoad();
-
// Used by the AsyncPolicyProvider to install the |update_callback_|.
// Invoked on the background thread.
void Init(const UpdateCallback& update_callback);
+ // Used by the AsyncPolicyProvider to reload with an updated SchemaMap.
+ void RefreshPolicies(scoped_refptr<SchemaMap> schema_map);
+
// Cancels any pending periodic reload and posts one |delay| time units from
// now.
void ScheduleNextReload(base::TimeDelta delay);
@@ -121,8 +113,8 @@ class AsyncPolicyLoader {
// non-local filesystem involved.
base::Time last_modification_clock_;
- // A map of the currently registered domains and their descriptors.
- DescriptorMap descriptor_map_;
+ // The current policy schemas that this provider should load.
+ scoped_refptr<SchemaMap> schema_map_;
DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader);
};

Powered by Google App Engine
This is Rietveld 408576698