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