summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy/configuration_policy_provider_win.h
diff options
context:
space:
mode:
authordanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 09:34:35 +0000
committerdanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 09:34:35 +0000
commit88616f47602e8a2a16c65ca0a59444e0ce550772 (patch)
tree285cad010b0aee7f2001fe419191cd1ee41a00ee /chrome/browser/policy/configuration_policy_provider_win.h
parent5e0750503a3c9743e1245f1b4c540124a9722ea0 (diff)
downloadchromium_src-88616f47602e8a2a16c65ca0a59444e0ce550772.zip
chromium_src-88616f47602e8a2a16c65ca0a59444e0ce550772.tar.gz
chromium_src-88616f47602e8a2a16c65ca0a59444e0ce550772.tar.bz2
Refactor the windows policy provider to use AsynchronousPolicyProvider.
BUG=66453,65094 TEST=*Policy.* Review URL: http://codereview.chromium.org/6091002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy/configuration_policy_provider_win.h')
-rw-r--r--chrome/browser/policy/configuration_policy_provider_win.h95
1 files changed, 4 insertions, 91 deletions
diff --git a/chrome/browser/policy/configuration_policy_provider_win.h b/chrome/browser/policy/configuration_policy_provider_win.h
index c2d5509..31e4a2b 100644
--- a/chrome/browser/policy/configuration_policy_provider_win.h
+++ b/chrome/browser/policy/configuration_policy_provider_win.h
@@ -6,19 +6,7 @@
#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_WIN_H_
#pragma once
-#include "base/object_watcher.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "base/waitable_event.h"
-#include "base/weak_ptr.h"
-#include "chrome/browser/policy/configuration_policy_store_interface.h"
-#include "chrome/browser/policy/configuration_policy_provider.h"
-
-namespace base {
-namespace win {
-class RegKey;
-} // namespace win
-} // namespace base
+#include "chrome/browser/policy/asynchronous_policy_provider.h"
namespace policy {
@@ -28,89 +16,14 @@ namespace policy {
// On a managed machine in a domain, this portion of the registry is
// periodically updated by the Windows Group Policy machinery to contain
// the latest version of the policy set by administrators.
-class ConfigurationPolicyProviderWin
- : public ConfigurationPolicyProvider,
- public base::SupportsWeakPtr<ConfigurationPolicyProviderWin> {
+class ConfigurationPolicyProviderWin : public AsynchronousPolicyProvider {
public:
- // Keeps watch on Windows Group Policy notification event to trigger a policy
- // reload when Group Policy changes. This class is reference counted to
- // facilitate timer-based reloads through the message loop. It is not safe to
- // access GroupPolicyChangeWatcher concurrently from multiple threads.
- class GroupPolicyChangeWatcher
- : public base::ObjectWatcher::Delegate,
- public MessageLoop::DestructionObserver,
- public base::RefCountedThreadSafe<GroupPolicyChangeWatcher> {
- public:
- GroupPolicyChangeWatcher(
- base::WeakPtr<ConfigurationPolicyProviderWin> provider,
- int reload_interval_minutes);
- virtual ~GroupPolicyChangeWatcher();
-
- // Start watching.
- void Start();
-
- // Stop any pending watch activity in order to allow for timely shutdown.
- void Stop();
-
- private:
- // Updates the watchers and schedules the reload task if appropriate.
- void SetupWatches();
-
- // Post a reload notification and update the watch machinery.
- void Reload();
-
- // Called for timer-based refresh from the message loop.
- void ReloadFromTask();
-
- // ObjectWatcher::Delegate implementation:
- virtual void OnObjectSignaled(HANDLE object);
-
- // MessageLoop::DestructionObserver implementation:
- virtual void WillDestroyCurrentMessageLoop();
-
- base::WeakPtr<ConfigurationPolicyProviderWin> provider_;
- base::WaitableEvent user_policy_changed_event_;
- base::WaitableEvent machine_policy_changed_event_;
- base::ObjectWatcher user_policy_watcher_;
- base::ObjectWatcher machine_policy_watcher_;
- bool user_policy_watcher_failed_;
- bool machine_policy_watcher_failed_;
-
- // Period to schedule the reload task at.
- int reload_interval_minutes_;
-
- // A reference to a delayed task for timer-based reloading.
- CancelableTask* reload_task_;
- };
-
explicit ConfigurationPolicyProviderWin(
const PolicyDefinitionList* policy_list);
- virtual ~ConfigurationPolicyProviderWin();
-
- // ConfigurationPolicyProvider method overrides:
- virtual bool Provide(ConfigurationPolicyStoreInterface* store);
-
- protected:
- // The sub key path for Chromium's Group Policy information in the
- // Windows registry.
- static const wchar_t kPolicyRegistrySubKey[];
+ virtual ~ConfigurationPolicyProviderWin() {}
private:
- scoped_refptr<GroupPolicyChangeWatcher> watcher_;
-
- // Methods to perform type-specific policy lookups in the registry.
- // HKLM is checked first, then HKCU.
-
- // Reads a string registry value |name| at the specified |key| and puts the
- // resulting string in |result|.
- bool GetRegistryPolicyString(const string16& name, string16* result) const;
- // Gets a list value contained under |key| one level below the policy root.
- bool GetRegistryPolicyStringList(const string16& key,
- ListValue* result) const;
- bool GetRegistryPolicyBoolean(const string16& value_name,
- bool* result) const;
- bool GetRegistryPolicyInteger(const string16& value_name,
- uint32* result) const;
+ DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderWin);
};
} // namespace policy