| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/plugin_service_impl.h" | 5 #include "content/browser/plugin_service_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 void PluginServiceImpl::StartWatchingPlugins() { | 179 void PluginServiceImpl::StartWatchingPlugins() { |
| 180 // Start watching for changes in the plugin list. This means watching | 180 // Start watching for changes in the plugin list. This means watching |
| 181 // for changes in the Windows registry keys and on both Windows and POSIX | 181 // for changes in the Windows registry keys and on both Windows and POSIX |
| 182 // watch for changes in the paths that are expected to contain plugins. | 182 // watch for changes in the paths that are expected to contain plugins. |
| 183 #if defined(OS_WIN) | 183 #if defined(OS_WIN) |
| 184 if (hkcu_key_.Create(HKEY_CURRENT_USER, | 184 if (hkcu_key_.Create(HKEY_CURRENT_USER, |
| 185 webkit::npapi::kRegistryMozillaPlugins, | 185 webkit::npapi::kRegistryMozillaPlugins, |
| 186 KEY_NOTIFY) == ERROR_SUCCESS) { | 186 KEY_NOTIFY) == ERROR_SUCCESS) { |
| 187 if (hkcu_key_.StartWatching() == ERROR_SUCCESS) { | 187 if (hkcu_key_.StartWatching() == ERROR_SUCCESS) { |
| 188 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); | 188 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); |
| 189 base::WaitableEventWatcher::EventCallback callback = | 189 hkcu_watcher_.StartWatching(hkcu_event_.get(), this); |
| 190 base::Bind(&PluginServiceImpl::OnWaitableEventSignaled, | |
| 191 base::Unretained(this)); | |
| 192 hkcu_watcher_.StartWatching(hkcu_event_.get(), callback); | |
| 193 } | 190 } |
| 194 } | 191 } |
| 195 if (hklm_key_.Create(HKEY_LOCAL_MACHINE, | 192 if (hklm_key_.Create(HKEY_LOCAL_MACHINE, |
| 196 webkit::npapi::kRegistryMozillaPlugins, | 193 webkit::npapi::kRegistryMozillaPlugins, |
| 197 KEY_NOTIFY) == ERROR_SUCCESS) { | 194 KEY_NOTIFY) == ERROR_SUCCESS) { |
| 198 if (hklm_key_.StartWatching() == ERROR_SUCCESS) { | 195 if (hklm_key_.StartWatching() == ERROR_SUCCESS) { |
| 199 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); | 196 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); |
| 200 base::WaitableEventWatcher::EventCallback callback = | 197 hklm_watcher_.StartWatching(hklm_event_.get(), this); |
| 201 base::Bind(&PluginServiceImpl::OnWaitableEventSignaled, | |
| 202 base::Unretained(this)); | |
| 203 hklm_watcher_.StartWatching(hklm_event_.get(), callback); | |
| 204 } | 198 } |
| 205 } | 199 } |
| 206 #endif | 200 #endif |
| 207 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) | 201 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) |
| 208 // On ChromeOS the user can't install plugins anyway and on Windows all | 202 // On ChromeOS the user can't install plugins anyway and on Windows all |
| 209 // important plugins register themselves in the registry so no need to do that. | 203 // important plugins register themselves in the registry so no need to do that. |
| 210 | 204 |
| 211 // Get the list of all paths for registering the FilePathWatchers | 205 // Get the list of all paths for registering the FilePathWatchers |
| 212 // that will track and if needed reload the list of plugins on runtime. | 206 // that will track and if needed reload the list of plugins on runtime. |
| 213 std::vector<FilePath> plugin_dirs; | 207 std::vector<FilePath> plugin_dirs; |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 void PluginServiceImpl::GetInternalPlugins( | 720 void PluginServiceImpl::GetInternalPlugins( |
| 727 std::vector<webkit::WebPluginInfo>* plugins) { | 721 std::vector<webkit::WebPluginInfo>* plugins) { |
| 728 plugin_list_->GetInternalPlugins(plugins); | 722 plugin_list_->GetInternalPlugins(plugins); |
| 729 } | 723 } |
| 730 | 724 |
| 731 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { | 725 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { |
| 732 return plugin_list_; | 726 return plugin_list_; |
| 733 } | 727 } |
| 734 | 728 |
| 735 } // namespace content | 729 } // namespace content |
| OLD | NEW |