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

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: 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 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..6ffd8bd5efa9ee41f0d00b06e345ecf5a8f0e6aa 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"
bartfab (slow) 2013/05/21 12:10:56 Nit: Would a forward-declaration of PolicyDomainDe
Joao da Silva 2013/05/21 17:50:14 Done.
namespace policy {
@@ -52,6 +56,20 @@ 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_; }
+
private:
// Allow AsyncPolicyProvider to call Init().
friend class AsyncPolicyProvider;
@@ -90,6 +108,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