| Index: chrome/browser/configuration_policy_provider_win.cc
|
| diff --git a/chrome/browser/configuration_policy_provider_win.cc b/chrome/browser/configuration_policy_provider_win.cc
|
| index 61d264ce7abbb29db46e9bacd4fca2c28b52e435..b70f01dd9a855ce64cadaf943dd4474112c5057e 100644
|
| --- a/chrome/browser/configuration_policy_provider_win.cc
|
| +++ b/chrome/browser/configuration_policy_provider_win.cc
|
| @@ -4,18 +4,56 @@
|
|
|
| #include "chrome/browser/configuration_policy_provider_win.h"
|
|
|
| +#include <userenv.h>
|
| +
|
| #include <algorithm>
|
|
|
| #include "base/logging.h"
|
| +#include "base/object_watcher.h"
|
| #include "base/registry.h"
|
| #include "base/scoped_ptr.h"
|
| #include "base/string_piece.h"
|
| #include "base/sys_string_conversions.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| +#include "base/waitable_event.h"
|
| #include "chrome/common/policy_constants.h"
|
|
|
| +ConfigurationPolicyProviderWin::GroupPolicyChangeWatcher::
|
| + GroupPolicyChangeWatcher(ConfigurationPolicyProvider* provider)
|
| + : provider_(provider),
|
| + user_policy_changed_event_(false, false),
|
| + machine_policy_changed_event_(false, false) {
|
| + CHECK(RegisterGPNotification(user_policy_changed_event_.handle(), false));
|
| + CHECK(RegisterGPNotification(machine_policy_changed_event_.handle(), true));
|
| + user_policy_watcher_.StartWatching(
|
| + user_policy_changed_event_.handle(),
|
| + this);
|
| + machine_policy_watcher_.StartWatching(
|
| + machine_policy_changed_event_.handle(),
|
| + this);
|
| +}
|
| +
|
| +void ConfigurationPolicyProviderWin::GroupPolicyChangeWatcher::
|
| + OnObjectSignaled(HANDLE object) {
|
| + provider_->NotifyStoreOfPolicyChange();
|
| + if (object == user_policy_changed_event_.handle()) {
|
| + user_policy_watcher_.StartWatching(
|
| + user_policy_changed_event_.handle(),
|
| + this);
|
| + } else if (object == machine_policy_changed_event_.handle()) {
|
| + machine_policy_watcher_.StartWatching(
|
| + machine_policy_changed_event_.handle(),
|
| + this);
|
| + } else {
|
| + // This method should only be called as a result of signals
|
| + // to the user- and machine-policy handle watchers.
|
| + NOTREACHED();
|
| + }
|
| +}
|
| +
|
| ConfigurationPolicyProviderWin::ConfigurationPolicyProviderWin() {
|
| + watcher_.reset(new GroupPolicyChangeWatcher(this));
|
| }
|
|
|
| bool ConfigurationPolicyProviderWin::GetRegistryPolicyString(
|
|
|