Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2139)

Unified Diff: chrome/browser/policy/policy_loader_win.h

Issue 10491013: Implement the windows policy provider based on the AsyncPolicyLoader. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed comment Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..7a5b7f884979993469f867dbd96686c913c8e272
--- /dev/null
+++ b/chrome/browser/policy/policy_loader_win.h
@@ -0,0 +1,51 @@
+// 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"
+
+namespace policy {
+
+struct PolicyDefinitionList;
+
+// Loads policies from the Windows registry, and watches for Group Policy
+// notifications to trigger reloads.
+class PolicyLoaderWin : public AsyncPolicyLoader,
+ public base::win::ObjectWatcher::Delegate {
+ public:
+ explicit PolicyLoaderWin(const PolicyDefinitionList* policy_list);
+ virtual ~PolicyLoaderWin();
+
+ // AsyncPolicyLoader implementation.
+ virtual void InitOnFile() OVERRIDE;
+ virtual scoped_ptr<PolicyBundle> Load() OVERRIDE;
+
+ private:
+ // Installs the watchers for the Group Policy update events.
+ 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(PolicyLoaderWin);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider_win.cc ('k') | chrome/browser/policy/policy_loader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698