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

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

Issue 5562002: Refactor FileBasedPolicyProvider, introduce AsynchronousPolicyProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge with TOT Created 10 years 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/asynchronous_policy_provider.h
diff --git a/chrome/browser/policy/asynchronous_policy_provider.h b/chrome/browser/policy/asynchronous_policy_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f6b649cf3c7f08a5ccec6f7f00a65e670d2b085
--- /dev/null
+++ b/chrome/browser/policy/asynchronous_policy_provider.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
+#define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
+#pragma once
+
+#include "base/non_thread_safe.h"
+#include "base/ref_counted.h"
+#include "base/weak_ptr.h"
+#include "chrome/browser/policy/configuration_policy_provider.h"
+
+namespace policy {
+
+class AsynchronousPolicyLoader;
+
+// Policy provider that loads policy asynchronously. Providers should subclass
+// from this class if loading the policy requires disk access or must for some
+// other reason be performed on the file thread. The actual logic for loading
+// policy is handled by a delegate passed at construction time.
+class AsynchronousPolicyProvider
+ : public ConfigurationPolicyProvider,
+ public base::SupportsWeakPtr<AsynchronousPolicyProvider>,
+ public NonThreadSafe {
+ public:
+ // Must be implemented by subclasses of the asynchronous policy provider to
+ // provide the implementation details of how policy is loaded.
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ virtual DictionaryValue* Load() = 0;
+ };
+
+ // Assumes ownership of |loader|.
+ AsynchronousPolicyProvider(
+ const PolicyDefinitionList* policy_list,
+ scoped_refptr<AsynchronousPolicyLoader> loader);
+ virtual ~AsynchronousPolicyProvider();
+
+ // ConfigurationPolicyProvider implementation.
+ virtual bool Provide(ConfigurationPolicyStoreInterface* store);
+
+ // For tests to trigger reloads.
+ scoped_refptr<AsynchronousPolicyLoader> loader();
+
+ protected:
+ // The loader object used internally.
+ scoped_refptr<AsynchronousPolicyLoader> loader_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
« no previous file with comments | « chrome/browser/policy/asynchronous_policy_loader_unittest.cc ('k') | chrome/browser/policy/asynchronous_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698