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

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

Issue 15061007: Added a PolicyDomainDescriptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 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 61529e71b6e7d287c2d7e642fd75e92e2bce1f47..f21b920caacb46e4af780e37370f1b10bbaf5dee 100644
--- a/chrome/browser/policy/async_policy_loader.h
+++ b/chrome/browser/policy/async_policy_loader.h
@@ -5,10 +5,14 @@
#ifndef CHROME_BROWSER_POLICY_ASYNC_POLICY_LOADER_H_
#define CHROME_BROWSER_POLICY_ASYNC_POLICY_LOADER_H_
+#include <map>
+
#include "base/callback.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time.h"
+#include "chrome/browser/policy/policy_domain_descriptor.h"
namespace policy {
@@ -52,6 +56,21 @@ 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 filter out
+ // policies that aren't registered, or whose type doesn't match the expected
+ // type.
+ 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_; }
+
private:
// Allow AsyncPolicyProvider to call Init().
friend class AsyncPolicyProvider;
@@ -90,6 +109,9 @@ class AsyncPolicyLoader {
// non-local filesystem involved.
base::Time last_modification_clock_;
+ // A map of the currently registered domains and their descriptors.
+ DescriptorMap descriptor_map_;
+
DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader);
};

Powered by Google App Engine
This is Rietveld 408576698