Chromium Code Reviews| Index: chrome/browser/policy/policy_loader_win.h |
| diff --git a/chrome/browser/policy/policy_loader_win.h b/chrome/browser/policy/policy_loader_win.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7b250f792fdc10e91e1d7e1e53c28e8d86e1fe8e |
| --- /dev/null |
| +++ b/chrome/browser/policy/policy_loader_win.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ |
| +#define CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ |
| +#pragma once |
| + |
| +#include "base/synchronization/waitable_event.h" |
| +#include "base/win/object_watcher.h" |
| +#include "chrome/browser/policy/async_policy_loader.h" |
| +#include "chrome/browser/policy/async_policy_provider.h" |
| + |
| +namespace policy { |
| + |
| +struct PolicyDefinitionList; |
| + |
| +// Loads policies from the Windows registry, and watches for Group Policy |
| +// notifications to trigger reloads. |
| +class WinPolicyLoader : public AsyncPolicyLoader, |
| + public base::win::ObjectWatcher::Delegate { |
| + public: |
| + explicit WinPolicyLoader( |
| + 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.
|
| + virtual ~WinPolicyLoader(); |
| + |
| + static AsyncPolicyProvider* CreateProvider( |
| + const PolicyDefinitionList* policy_list); |
| + |
| + // AsyncPolicyLoader implementation. |
| + virtual void InitOnFile() OVERRIDE; |
| + virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; |
| + |
| + private: |
| + // 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.
|
| + void SetupWatches(); |
| + |
| + // ObjectWatcher::Delegate overrides: |
| + virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
| + |
| + bool is_initialized_; |
| + const PolicyDefinitionList* policy_list_; |
| + |
| + base::WaitableEvent user_policy_changed_event_; |
| + base::WaitableEvent machine_policy_changed_event_; |
| + base::win::ObjectWatcher user_policy_watcher_; |
| + base::win::ObjectWatcher machine_policy_watcher_; |
| + bool user_policy_watcher_failed_; |
| + bool machine_policy_watcher_failed_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WinPolicyLoader); |
| +}; |
| + |
| +} // namespace policy |
| + |
| +#endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ |