| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_LOADER_WIN_H_ | |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_LOADER_WIN_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/synchronization/waitable_event.h" | |
| 10 #include "base/win/object_watcher.h" | |
| 11 #include "chrome/browser/policy/asynchronous_policy_loader.h" | |
| 12 | |
| 13 namespace policy { | |
| 14 | |
| 15 // Keeps watch on Windows Group Policy notification event to trigger a policy | |
| 16 // reload when Group Policy changes. | |
| 17 class ConfigurationPolicyLoaderWin | |
| 18 : public AsynchronousPolicyLoader, | |
| 19 public base::win::ObjectWatcher::Delegate { | |
| 20 public: | |
| 21 ConfigurationPolicyLoaderWin( | |
| 22 AsynchronousPolicyProvider::Delegate* delegate, | |
| 23 int reload_interval_minutes); | |
| 24 virtual ~ConfigurationPolicyLoaderWin() {} | |
| 25 | |
| 26 // AsynchronousPolicyLoader overrides: | |
| 27 virtual void Reload(bool force) OVERRIDE; | |
| 28 | |
| 29 protected: | |
| 30 // AsynchronousPolicyLoader overrides: | |
| 31 virtual void InitOnFileThread() OVERRIDE; | |
| 32 virtual void StopOnFileThread() OVERRIDE; | |
| 33 | |
| 34 private: | |
| 35 // Updates the watchers and schedules the reload task if appropriate. | |
| 36 void SetupWatches(); | |
| 37 | |
| 38 // ObjectWatcher::Delegate overrides: | |
| 39 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | |
| 40 | |
| 41 base::WaitableEvent user_policy_changed_event_; | |
| 42 base::WaitableEvent machine_policy_changed_event_; | |
| 43 base::win::ObjectWatcher user_policy_watcher_; | |
| 44 base::win::ObjectWatcher machine_policy_watcher_; | |
| 45 bool user_policy_watcher_failed_; | |
| 46 bool machine_policy_watcher_failed_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyLoaderWin); | |
| 49 }; | |
| 50 | |
| 51 } // namespace policy | |
| 52 | |
| 53 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_LOADER_WIN_H_ | |
| OLD | NEW |