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

Unified Diff: chrome/browser/policy/configuration_policy_loader_win.cc

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/configuration_policy_loader_win.cc
diff --git a/chrome/browser/policy/configuration_policy_loader_win.cc b/chrome/browser/policy/configuration_policy_loader_win.cc
deleted file mode 100644
index 03d12d18a096a202fedb7b73d94c9cbfc0f9d5cf..0000000000000000000000000000000000000000
--- a/chrome/browser/policy/configuration_policy_loader_win.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "chrome/browser/policy/configuration_policy_loader_win.h"
-
-#include <userenv.h>
-
-#include "content/public/browser/browser_thread.h"
-
-// userenv.dll is required for RegisterGPNotification().
-#pragma comment(lib, "userenv.lib")
-
-using content::BrowserThread;
-
-namespace policy {
-
-ConfigurationPolicyLoaderWin::ConfigurationPolicyLoaderWin(
- AsynchronousPolicyProvider::Delegate* delegate,
- int reload_interval_minutes)
- : AsynchronousPolicyLoader(delegate, reload_interval_minutes),
- user_policy_changed_event_(false, false),
- machine_policy_changed_event_(false, false),
- user_policy_watcher_failed_(false),
- machine_policy_watcher_failed_(false) {
- if (!RegisterGPNotification(user_policy_changed_event_.handle(), false)) {
- PLOG(WARNING) << "Failed to register user group policy notification";
- user_policy_watcher_failed_ = true;
- }
- if (!RegisterGPNotification(machine_policy_changed_event_.handle(), true)) {
- PLOG(WARNING) << "Failed to register machine group policy notification.";
- machine_policy_watcher_failed_ = true;
- }
-}
-
-void ConfigurationPolicyLoaderWin::Reload(bool force) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- // Reset the watches BEFORE reading the individual policies to avoid
- // missing a change notification.
- SetupWatches();
- AsynchronousPolicyLoader::Reload(force);
-}
-
-void ConfigurationPolicyLoaderWin::InitOnFileThread() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- AsynchronousPolicyLoader::InitOnFileThread();
- SetupWatches();
-}
-
-void ConfigurationPolicyLoaderWin::StopOnFileThread() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- user_policy_watcher_.StopWatching();
- machine_policy_watcher_.StopWatching();
- AsynchronousPolicyLoader::StopOnFileThread();
-}
-
-void ConfigurationPolicyLoaderWin::SetupWatches() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- CancelReloadTask();
-
- if (!user_policy_watcher_failed_ &&
- !user_policy_watcher_.GetWatchedObject() &&
- !user_policy_watcher_.StartWatching(
- user_policy_changed_event_.handle(), this)) {
- LOG(WARNING) << "Failed to start watch for user policy change event";
- user_policy_watcher_failed_ = true;
- }
- if (!machine_policy_watcher_failed_ &&
- !machine_policy_watcher_.GetWatchedObject() &&
- !machine_policy_watcher_.StartWatching(
- machine_policy_changed_event_.handle(), this)) {
- LOG(WARNING) << "Failed to start watch for machine policy change event";
- machine_policy_watcher_failed_ = true;
- }
-
- if (user_policy_watcher_failed_ || machine_policy_watcher_failed_)
- ScheduleFallbackReloadTask();
-}
-
-void ConfigurationPolicyLoaderWin::OnObjectSignaled(HANDLE object) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- DCHECK(object == user_policy_changed_event_.handle() ||
- object == machine_policy_changed_event_.handle())
- << "unexpected object signaled policy reload, obj = "
- << std::showbase << std::hex << object;
- Reload(false);
-}
-
-} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698