Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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_POLICY_LOADER_WIN_H_ | |
| 6 #define CHROME_BROWSER_POLICY_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/async_policy_loader.h" | |
| 12 #include "chrome/browser/policy/async_policy_provider.h" | |
| 13 | |
| 14 namespace policy { | |
| 15 | |
| 16 struct PolicyDefinitionList; | |
| 17 | |
| 18 // Loads policies from the Windows registry, and watches for Group Policy | |
| 19 // notifications to trigger reloads. | |
| 20 class WinPolicyLoader : public AsyncPolicyLoader, | |
| 21 public base::win::ObjectWatcher::Delegate { | |
| 22 public: | |
| 23 explicit WinPolicyLoader( | |
| 24 const PolicyDefinitionList* policy_list); | |
|
Mattias Nissler (ping if slow)
2012/06/04 09:29:41
fits previous line.
Joao da Silva
2012/06/06 13:05:24
Done.
| |
| 25 virtual ~WinPolicyLoader(); | |
| 26 | |
| 27 static AsyncPolicyProvider* CreateProvider( | |
| 28 const PolicyDefinitionList* policy_list); | |
| 29 | |
| 30 // AsyncPolicyLoader implementation. | |
| 31 virtual void InitOnFile() OVERRIDE; | |
| 32 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; | |
| 33 | |
| 34 private: | |
| 35 // Updates the watchers and schedules the reload task if appropriate. | |
|
Mattias Nissler (ping if slow)
2012/06/04 09:29:41
No longer schedules a task.
Joao da Silva
2012/06/06 13:05:24
Done.
| |
| 36 void SetupWatches(); | |
| 37 | |
| 38 // ObjectWatcher::Delegate overrides: | |
| 39 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | |
| 40 | |
| 41 bool is_initialized_; | |
| 42 const PolicyDefinitionList* policy_list_; | |
| 43 | |
| 44 base::WaitableEvent user_policy_changed_event_; | |
| 45 base::WaitableEvent machine_policy_changed_event_; | |
| 46 base::win::ObjectWatcher user_policy_watcher_; | |
| 47 base::win::ObjectWatcher machine_policy_watcher_; | |
| 48 bool user_policy_watcher_failed_; | |
| 49 bool machine_policy_watcher_failed_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(WinPolicyLoader); | |
| 52 }; | |
| 53 | |
| 54 } // namespace policy | |
| 55 | |
| 56 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ | |
| OLD | NEW |