| 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 #include "chrome/browser/policy/configuration_policy_loader_win.h" | 5 #include "chrome/browser/policy/configuration_policy_loader_win.h" |
| 6 | 6 |
| 7 #include <userenv.h> | 7 #include <userenv.h> |
| 8 | 8 |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 if (!RegisterGPNotification(user_policy_changed_event_.handle(), false)) { | 26 if (!RegisterGPNotification(user_policy_changed_event_.handle(), false)) { |
| 27 PLOG(WARNING) << "Failed to register user group policy notification"; | 27 PLOG(WARNING) << "Failed to register user group policy notification"; |
| 28 user_policy_watcher_failed_ = true; | 28 user_policy_watcher_failed_ = true; |
| 29 } | 29 } |
| 30 if (!RegisterGPNotification(machine_policy_changed_event_.handle(), true)) { | 30 if (!RegisterGPNotification(machine_policy_changed_event_.handle(), true)) { |
| 31 PLOG(WARNING) << "Failed to register machine group policy notification."; | 31 PLOG(WARNING) << "Failed to register machine group policy notification."; |
| 32 machine_policy_watcher_failed_ = true; | 32 machine_policy_watcher_failed_ = true; |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 void ConfigurationPolicyLoaderWin::Reload(bool force) { | 36 void ConfigurationPolicyLoaderWin::Reload(const base::Closure& callback, |
| 37 bool force) { |
| 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 38 // Reset the watches BEFORE reading the individual policies to avoid | 39 // Reset the watches BEFORE reading the individual policies to avoid |
| 39 // missing a change notification. | 40 // missing a change notification. |
| 40 SetupWatches(); | 41 SetupWatches(); |
| 41 AsynchronousPolicyLoader::Reload(force); | 42 AsynchronousPolicyLoader::Reload(callback, force); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void ConfigurationPolicyLoaderWin::InitOnFileThread() { | 45 void ConfigurationPolicyLoaderWin::InitOnFileThread() { |
| 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 46 AsynchronousPolicyLoader::InitOnFileThread(); | 47 AsynchronousPolicyLoader::InitOnFileThread(); |
| 47 SetupWatches(); | 48 SetupWatches(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void ConfigurationPolicyLoaderWin::StopOnFileThread() { | 51 void ConfigurationPolicyLoaderWin::StopOnFileThread() { |
| 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 76 if (user_policy_watcher_failed_ || machine_policy_watcher_failed_) | 77 if (user_policy_watcher_failed_ || machine_policy_watcher_failed_) |
| 77 ScheduleFallbackReloadTask(); | 78 ScheduleFallbackReloadTask(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 void ConfigurationPolicyLoaderWin::OnObjectSignaled(HANDLE object) { | 81 void ConfigurationPolicyLoaderWin::OnObjectSignaled(HANDLE object) { |
| 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 82 DCHECK(object == user_policy_changed_event_.handle() || | 83 DCHECK(object == user_policy_changed_event_.handle() || |
| 83 object == machine_policy_changed_event_.handle()) | 84 object == machine_policy_changed_event_.handle()) |
| 84 << "unexpected object signaled policy reload, obj = " | 85 << "unexpected object signaled policy reload, obj = " |
| 85 << std::showbase << std::hex << object; | 86 << std::showbase << std::hex << object; |
| 86 Reload(false); | 87 Reload(default_callback(), false); |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace policy | 90 } // namespace policy |
| OLD | NEW |