| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "content/browser/ppapi_plugin_process_host.h" | 19 #include "content/browser/ppapi_plugin_process_host.h" |
| 20 #include "content/browser/renderer_host/render_process_host_impl.h" | 20 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 21 #include "content/browser/renderer_host/render_view_host_impl.h" | 21 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 22 #include "content/common/pepper_plugin_registry.h" | 22 #include "content/common/pepper_plugin_registry.h" |
| 23 #include "content/common/plugin_list.h" |
| 23 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
| 24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
| 26 #include "content/public/browser/plugin_service_filter.h" | 27 #include "content/public/browser/plugin_service_filter.h" |
| 27 #include "content/public/browser/resource_context.h" | 28 #include "content/public/browser/resource_context.h" |
| 28 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
| 29 #include "content/public/common/process_type.h" | 30 #include "content/public/common/process_type.h" |
| 30 #include "webkit/plugins/npapi/plugin_list.h" | |
| 31 #include "webkit/plugins/npapi/plugin_utils.h" | 31 #include "webkit/plugins/npapi/plugin_utils.h" |
| 32 #include "webkit/plugins/plugin_constants.h" | 32 #include "webkit/plugins/plugin_constants.h" |
| 33 #include "webkit/plugins/webplugininfo.h" | 33 #include "webkit/plugins/webplugininfo.h" |
| 34 | 34 |
| 35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
| 36 #include "webkit/plugins/npapi/plugin_constants_win.h" | 36 #include "content/common/plugin_constants_win.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #if defined(OS_POSIX) | 39 #if defined(OS_POSIX) |
| 40 #include "content/browser/plugin_loader_posix.h" | 40 #include "content/browser/plugin_loader_posix.h" |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) | 43 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) |
| 44 using ::base::FilePathWatcher; | 44 using ::base::FilePathWatcher; |
| 45 #endif | 45 #endif |
| 46 | 46 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) | 100 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) |
| 101 void NotifyPluginDirChanged(const base::FilePath& path, bool error) { | 101 void NotifyPluginDirChanged(const base::FilePath& path, bool error) { |
| 102 if (error) { | 102 if (error) { |
| 103 // TODO(pastarmovj): Add some sensible error handling. Maybe silently | 103 // TODO(pastarmovj): Add some sensible error handling. Maybe silently |
| 104 // stopping the watcher would be enough. Or possibly restart it. | 104 // stopping the watcher would be enough. Or possibly restart it. |
| 105 NOTREACHED(); | 105 NOTREACHED(); |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 VLOG(1) << "Watched path changed: " << path.value(); | 108 VLOG(1) << "Watched path changed: " << path.value(); |
| 109 // Make the plugin list update itself | 109 // Make the plugin list update itself |
| 110 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 110 PluginList::Singleton()->RefreshPlugins(); |
| 111 BrowserThread::PostTask( | 111 BrowserThread::PostTask( |
| 112 BrowserThread::UI, FROM_HERE, | 112 BrowserThread::UI, FROM_HERE, |
| 113 base::Bind(&PluginService::PurgePluginListCache, | 113 base::Bind(&PluginService::PurgePluginListCache, |
| 114 static_cast<BrowserContext*>(NULL), false)); | 114 static_cast<BrowserContext*>(NULL), false)); |
| 115 } | 115 } |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 } // namespace | 118 } // namespace |
| 119 | 119 |
| 120 // static | 120 // static |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 hkcu_event_->Release(); | 159 hkcu_event_->Release(); |
| 160 if (hklm_event_) | 160 if (hklm_event_) |
| 161 hklm_event_->Release(); | 161 hklm_event_->Release(); |
| 162 #endif | 162 #endif |
| 163 // Make sure no plugin channel requests have been leaked. | 163 // Make sure no plugin channel requests have been leaked. |
| 164 DCHECK(pending_plugin_clients_.empty()); | 164 DCHECK(pending_plugin_clients_.empty()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void PluginServiceImpl::Init() { | 167 void PluginServiceImpl::Init() { |
| 168 plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); | 168 plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); |
| 169 webkit::npapi::PluginList::Singleton()->set_will_load_plugins_callback( | 169 PluginList::Singleton()->set_will_load_plugins_callback( |
| 170 base::Bind(&WillLoadPluginsCallback, plugin_list_token_)); | 170 base::Bind(&WillLoadPluginsCallback, plugin_list_token_)); |
| 171 | 171 |
| 172 RegisterPepperPlugins(); | 172 RegisterPepperPlugins(); |
| 173 | 173 |
| 174 // The --site-per-process flag enables an out-of-process iframes | 174 // The --site-per-process flag enables an out-of-process iframes |
| 175 // prototype, which uses WebView for rendering. We need to register the MIME | 175 // prototype, which uses WebView for rendering. We need to register the MIME |
| 176 // type we use with the plugin, so the renderer can instantiate it. | 176 // type we use with the plugin, so the renderer can instantiate it. |
| 177 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 177 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 178 if (command_line->HasSwitch(switches::kSitePerProcess)) { | 178 if (command_line->HasSwitch(switches::kSitePerProcess)) { |
| 179 webkit::WebPluginInfo webview_plugin( | 179 webkit::WebPluginInfo webview_plugin( |
| 180 ASCIIToUTF16("WebView Tag"), | 180 ASCIIToUTF16("WebView Tag"), |
| 181 base::FilePath(), | 181 base::FilePath(), |
| 182 ASCIIToUTF16("1.2.3.4"), | 182 ASCIIToUTF16("1.2.3.4"), |
| 183 ASCIIToUTF16("Browser Plugin.")); | 183 ASCIIToUTF16("Browser Plugin.")); |
| 184 webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; | 184 webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; |
| 185 webkit::WebPluginMimeType webview_plugin_mime_type; | 185 webkit::WebPluginMimeType webview_plugin_mime_type; |
| 186 webview_plugin_mime_type.mime_type = "application/browser-plugin"; | 186 webview_plugin_mime_type.mime_type = "application/browser-plugin"; |
| 187 webview_plugin_mime_type.file_extensions.push_back("*"); | 187 webview_plugin_mime_type.file_extensions.push_back("*"); |
| 188 webview_plugin.mime_types.push_back(webview_plugin_mime_type); | 188 webview_plugin.mime_types.push_back(webview_plugin_mime_type); |
| 189 RegisterInternalPlugin(webview_plugin, true); | 189 RegisterInternalPlugin(webview_plugin, true); |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Load any specified on the command line as well. | 192 // Load any specified on the command line as well. |
| 193 base::FilePath path = | 193 base::FilePath path = |
| 194 command_line->GetSwitchValuePath(switches::kLoadPlugin); | 194 command_line->GetSwitchValuePath(switches::kLoadPlugin); |
| 195 if (!path.empty()) | 195 if (!path.empty()) |
| 196 AddExtraPluginPath(path); | 196 AddExtraPluginPath(path); |
| 197 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); | 197 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); |
| 198 if (!path.empty()) | 198 if (!path.empty()) |
| 199 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(path); | 199 PluginList::Singleton()->AddExtraPluginDir(path); |
| 200 | 200 |
| 201 if (command_line->HasSwitch(switches::kDisablePluginsDiscovery)) | 201 if (command_line->HasSwitch(switches::kDisablePluginsDiscovery)) |
| 202 webkit::npapi::PluginList::Singleton()->DisablePluginsDiscovery(); | 202 PluginList::Singleton()->DisablePluginsDiscovery(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void PluginServiceImpl::StartWatchingPlugins() { | 205 void PluginServiceImpl::StartWatchingPlugins() { |
| 206 // Start watching for changes in the plugin list. This means watching | 206 // Start watching for changes in the plugin list. This means watching |
| 207 // for changes in the Windows registry keys and on both Windows and POSIX | 207 // for changes in the Windows registry keys and on both Windows and POSIX |
| 208 // watch for changes in the paths that are expected to contain plugins. | 208 // watch for changes in the paths that are expected to contain plugins. |
| 209 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
| 210 if (hkcu_key_.Create(HKEY_CURRENT_USER, | 210 if (hkcu_key_.Create(HKEY_CURRENT_USER, |
| 211 webkit::npapi::kRegistryMozillaPlugins, | 211 kRegistryMozillaPlugins, |
| 212 KEY_NOTIFY) == ERROR_SUCCESS) { | 212 KEY_NOTIFY) == ERROR_SUCCESS) { |
| 213 if (hkcu_key_.StartWatching() == ERROR_SUCCESS) { | 213 if (hkcu_key_.StartWatching() == ERROR_SUCCESS) { |
| 214 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); | 214 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); |
| 215 base::WaitableEventWatcher::EventCallback callback = | 215 base::WaitableEventWatcher::EventCallback callback = |
| 216 base::Bind(&PluginServiceImpl::OnWaitableEventSignaled, | 216 base::Bind(&PluginServiceImpl::OnWaitableEventSignaled, |
| 217 base::Unretained(this)); | 217 base::Unretained(this)); |
| 218 hkcu_watcher_.StartWatching(hkcu_event_.get(), callback); | 218 hkcu_watcher_.StartWatching(hkcu_event_.get(), callback); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 if (hklm_key_.Create(HKEY_LOCAL_MACHINE, | 221 if (hklm_key_.Create(HKEY_LOCAL_MACHINE, |
| 222 webkit::npapi::kRegistryMozillaPlugins, | 222 kRegistryMozillaPlugins, |
| 223 KEY_NOTIFY) == ERROR_SUCCESS) { | 223 KEY_NOTIFY) == ERROR_SUCCESS) { |
| 224 if (hklm_key_.StartWatching() == ERROR_SUCCESS) { | 224 if (hklm_key_.StartWatching() == ERROR_SUCCESS) { |
| 225 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); | 225 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); |
| 226 base::WaitableEventWatcher::EventCallback callback = | 226 base::WaitableEventWatcher::EventCallback callback = |
| 227 base::Bind(&PluginServiceImpl::OnWaitableEventSignaled, | 227 base::Bind(&PluginServiceImpl::OnWaitableEventSignaled, |
| 228 base::Unretained(this)); | 228 base::Unretained(this)); |
| 229 hklm_watcher_.StartWatching(hklm_event_.get(), callback); | 229 hklm_watcher_.StartWatching(hklm_event_.get(), callback); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 #endif | 232 #endif |
| 233 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) | 233 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) |
| 234 // On ChromeOS the user can't install plugins anyway and on Windows all | 234 // On ChromeOS the user can't install plugins anyway and on Windows all |
| 235 // important plugins register themselves in the registry so no need to do that. | 235 // important plugins register themselves in the registry so no need to do that. |
| 236 | 236 |
| 237 // Get the list of all paths for registering the FilePathWatchers | 237 // Get the list of all paths for registering the FilePathWatchers |
| 238 // that will track and if needed reload the list of plugins on runtime. | 238 // that will track and if needed reload the list of plugins on runtime. |
| 239 std::vector<base::FilePath> plugin_dirs; | 239 std::vector<base::FilePath> plugin_dirs; |
| 240 webkit::npapi::PluginList::Singleton()->GetPluginDirectories(&plugin_dirs); | 240 PluginList::Singleton()->GetPluginDirectories(&plugin_dirs); |
| 241 | 241 |
| 242 for (size_t i = 0; i < plugin_dirs.size(); ++i) { | 242 for (size_t i = 0; i < plugin_dirs.size(); ++i) { |
| 243 // FilePathWatcher can not handle non-absolute paths under windows. | 243 // FilePathWatcher can not handle non-absolute paths under windows. |
| 244 // We don't watch for file changes in windows now but if this should ever | 244 // We don't watch for file changes in windows now but if this should ever |
| 245 // be extended to Windows these lines might save some time of debugging. | 245 // be extended to Windows these lines might save some time of debugging. |
| 246 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
| 247 if (!plugin_dirs[i].IsAbsolute()) | 247 if (!plugin_dirs[i].IsAbsolute()) |
| 248 continue; | 248 continue; |
| 249 #endif | 249 #endif |
| 250 FilePathWatcher* watcher = new FilePathWatcher(); | 250 FilePathWatcher* watcher = new FilePathWatcher(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 } | 503 } |
| 504 } | 504 } |
| 505 | 505 |
| 506 bool PluginServiceImpl::GetPluginInfoArray( | 506 bool PluginServiceImpl::GetPluginInfoArray( |
| 507 const GURL& url, | 507 const GURL& url, |
| 508 const std::string& mime_type, | 508 const std::string& mime_type, |
| 509 bool allow_wildcard, | 509 bool allow_wildcard, |
| 510 std::vector<webkit::WebPluginInfo>* plugins, | 510 std::vector<webkit::WebPluginInfo>* plugins, |
| 511 std::vector<std::string>* actual_mime_types) { | 511 std::vector<std::string>* actual_mime_types) { |
| 512 bool use_stale = false; | 512 bool use_stale = false; |
| 513 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( | 513 PluginList::Singleton()->GetPluginInfoArray( |
| 514 url, mime_type, allow_wildcard, &use_stale, plugins, actual_mime_types); | 514 url, mime_type, allow_wildcard, &use_stale, plugins, actual_mime_types); |
| 515 return use_stale; | 515 return use_stale; |
| 516 } | 516 } |
| 517 | 517 |
| 518 bool PluginServiceImpl::GetPluginInfo(int render_process_id, | 518 bool PluginServiceImpl::GetPluginInfo(int render_process_id, |
| 519 int render_view_id, | 519 int render_view_id, |
| 520 ResourceContext* context, | 520 ResourceContext* context, |
| 521 const GURL& url, | 521 const GURL& url, |
| 522 const GURL& page_url, | 522 const GURL& page_url, |
| 523 const std::string& mime_type, | 523 const std::string& mime_type, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 544 *actual_mime_type = mime_types[i]; | 544 *actual_mime_type = mime_types[i]; |
| 545 return true; | 545 return true; |
| 546 } | 546 } |
| 547 } | 547 } |
| 548 return false; | 548 return false; |
| 549 } | 549 } |
| 550 | 550 |
| 551 bool PluginServiceImpl::GetPluginInfoByPath(const base::FilePath& plugin_path, | 551 bool PluginServiceImpl::GetPluginInfoByPath(const base::FilePath& plugin_path, |
| 552 webkit::WebPluginInfo* info) { | 552 webkit::WebPluginInfo* info) { |
| 553 std::vector<webkit::WebPluginInfo> plugins; | 553 std::vector<webkit::WebPluginInfo> plugins; |
| 554 webkit::npapi::PluginList::Singleton()->GetPluginsNoRefresh(&plugins); | 554 PluginList::Singleton()->GetPluginsNoRefresh(&plugins); |
| 555 | 555 |
| 556 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); | 556 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); |
| 557 it != plugins.end(); | 557 it != plugins.end(); |
| 558 ++it) { | 558 ++it) { |
| 559 if (it->path == plugin_path) { | 559 if (it->path == plugin_path) { |
| 560 *info = *it; | 560 *info = *it; |
| 561 return true; | 561 return true; |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | 564 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 593 plugin_list_token_, | 593 plugin_list_token_, |
| 594 FROM_HERE, | 594 FROM_HERE, |
| 595 base::Bind(&PluginServiceImpl::GetPluginsInternal, | 595 base::Bind(&PluginServiceImpl::GetPluginsInternal, |
| 596 base::Unretained(this), | 596 base::Unretained(this), |
| 597 target_loop, callback), | 597 target_loop, callback), |
| 598 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 598 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 599 return; | 599 return; |
| 600 } | 600 } |
| 601 #if defined(OS_POSIX) | 601 #if defined(OS_POSIX) |
| 602 std::vector<webkit::WebPluginInfo> cached_plugins; | 602 std::vector<webkit::WebPluginInfo> cached_plugins; |
| 603 if (webkit::npapi::PluginList::Singleton()->GetPluginsNoRefresh( | 603 if (PluginList::Singleton()->GetPluginsNoRefresh(&cached_plugins)) { |
| 604 &cached_plugins)) { | |
| 605 // Can't assume the caller is reentrant. | 604 // Can't assume the caller is reentrant. |
| 606 target_loop->PostTask(FROM_HERE, | 605 target_loop->PostTask(FROM_HERE, |
| 607 base::Bind(callback, cached_plugins)); | 606 base::Bind(callback, cached_plugins)); |
| 608 } else { | 607 } else { |
| 609 // If we switch back to loading plugins in process, then we need to make | 608 // If we switch back to loading plugins in process, then we need to make |
| 610 // sure g_thread_init() gets called since plugins may call glib at load. | 609 // sure g_thread_init() gets called since plugins may call glib at load. |
| 611 if (!plugin_loader_.get()) | 610 if (!plugin_loader_.get()) |
| 612 plugin_loader_ = new PluginLoaderPosix; | 611 plugin_loader_ = new PluginLoaderPosix; |
| 613 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 612 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 614 base::Bind(&PluginLoaderPosix::LoadPlugins, plugin_loader_, | 613 base::Bind(&PluginLoaderPosix::LoadPlugins, plugin_loader_, |
| 615 target_loop, callback)); | 614 target_loop, callback)); |
| 616 } | 615 } |
| 617 #else | 616 #else |
| 618 NOTREACHED(); | 617 NOTREACHED(); |
| 619 #endif | 618 #endif |
| 620 } | 619 } |
| 621 | 620 |
| 622 void PluginServiceImpl::GetPluginsInternal( | 621 void PluginServiceImpl::GetPluginsInternal( |
| 623 base::MessageLoopProxy* target_loop, | 622 base::MessageLoopProxy* target_loop, |
| 624 const PluginService::GetPluginsCallback& callback) { | 623 const PluginService::GetPluginsCallback& callback) { |
| 625 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( | 624 DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( |
| 626 plugin_list_token_)); | 625 plugin_list_token_)); |
| 627 | 626 |
| 628 std::vector<webkit::WebPluginInfo> plugins; | 627 std::vector<webkit::WebPluginInfo> plugins; |
| 629 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins); | 628 PluginList::Singleton()->GetPlugins(&plugins); |
| 630 | 629 |
| 631 target_loop->PostTask(FROM_HERE, | 630 target_loop->PostTask(FROM_HERE, |
| 632 base::Bind(callback, plugins)); | 631 base::Bind(callback, plugins)); |
| 633 } | 632 } |
| 634 | 633 |
| 635 void PluginServiceImpl::OnWaitableEventSignaled( | 634 void PluginServiceImpl::OnWaitableEventSignaled( |
| 636 base::WaitableEvent* waitable_event) { | 635 base::WaitableEvent* waitable_event) { |
| 637 #if defined(OS_WIN) | 636 #if defined(OS_WIN) |
| 638 if (waitable_event == hkcu_event_) { | 637 if (waitable_event == hkcu_event_) { |
| 639 hkcu_key_.StartWatching(); | 638 hkcu_key_.StartWatching(); |
| 640 } else { | 639 } else { |
| 641 hklm_key_.StartWatching(); | 640 hklm_key_.StartWatching(); |
| 642 } | 641 } |
| 643 | 642 |
| 644 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 643 PluginList::Singleton()->RefreshPlugins(); |
| 645 PurgePluginListCache(NULL, false); | 644 PurgePluginListCache(NULL, false); |
| 646 #else | 645 #else |
| 647 // This event should only get signaled on a Windows machine. | 646 // This event should only get signaled on a Windows machine. |
| 648 NOTREACHED(); | 647 NOTREACHED(); |
| 649 #endif // defined(OS_WIN) | 648 #endif // defined(OS_WIN) |
| 650 } | 649 } |
| 651 | 650 |
| 652 void PluginServiceImpl::RegisterPepperPlugins() { | 651 void PluginServiceImpl::RegisterPepperPlugins() { |
| 653 // TODO(abarth): It seems like the PepperPluginRegistry should do this work. | 652 // TODO(abarth): It seems like the PepperPluginRegistry should do this work. |
| 654 PepperPluginRegistry::ComputeList(&ppapi_plugins_); | 653 PepperPluginRegistry::ComputeList(&ppapi_plugins_); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 return false; | 741 return false; |
| 743 } | 742 } |
| 744 if (i->second.size() != kMaxCrashesPerInterval) { | 743 if (i->second.size() != kMaxCrashesPerInterval) { |
| 745 return false; | 744 return false; |
| 746 } | 745 } |
| 747 base::TimeDelta delta = base::Time::Now() - i->second[0]; | 746 base::TimeDelta delta = base::Time::Now() - i->second[0]; |
| 748 return delta.InSeconds() <= kCrashesInterval; | 747 return delta.InSeconds() <= kCrashesInterval; |
| 749 } | 748 } |
| 750 | 749 |
| 751 void PluginServiceImpl::RefreshPlugins() { | 750 void PluginServiceImpl::RefreshPlugins() { |
| 752 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 751 PluginList::Singleton()->RefreshPlugins(); |
| 753 } | 752 } |
| 754 | 753 |
| 755 void PluginServiceImpl::AddExtraPluginPath(const base::FilePath& path) { | 754 void PluginServiceImpl::AddExtraPluginPath(const base::FilePath& path) { |
| 756 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); | 755 PluginList::Singleton()->AddExtraPluginPath(path); |
| 757 } | 756 } |
| 758 | 757 |
| 759 void PluginServiceImpl::RemoveExtraPluginPath(const base::FilePath& path) { | 758 void PluginServiceImpl::RemoveExtraPluginPath(const base::FilePath& path) { |
| 760 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath(path); | 759 PluginList::Singleton()->RemoveExtraPluginPath(path); |
| 761 } | 760 } |
| 762 | 761 |
| 763 void PluginServiceImpl::AddExtraPluginDir(const base::FilePath& path) { | 762 void PluginServiceImpl::AddExtraPluginDir(const base::FilePath& path) { |
| 764 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(path); | 763 PluginList::Singleton()->AddExtraPluginDir(path); |
| 765 } | 764 } |
| 766 | 765 |
| 767 void PluginServiceImpl::RegisterInternalPlugin( | 766 void PluginServiceImpl::RegisterInternalPlugin( |
| 768 const webkit::WebPluginInfo& info, | 767 const webkit::WebPluginInfo& info, |
| 769 bool add_at_beginning) { | 768 bool add_at_beginning) { |
| 770 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( | 769 PluginList::Singleton()->RegisterInternalPlugin(info, add_at_beginning); |
| 771 info, add_at_beginning); | |
| 772 } | 770 } |
| 773 | 771 |
| 774 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { | 772 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { |
| 775 webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(path); | 773 PluginList::Singleton()->UnregisterInternalPlugin(path); |
| 776 } | 774 } |
| 777 | 775 |
| 778 void PluginServiceImpl::GetInternalPlugins( | 776 void PluginServiceImpl::GetInternalPlugins( |
| 779 std::vector<webkit::WebPluginInfo>* plugins) { | 777 std::vector<webkit::WebPluginInfo>* plugins) { |
| 780 webkit::npapi::PluginList::Singleton()->GetInternalPlugins(plugins); | 778 PluginList::Singleton()->GetInternalPlugins(plugins); |
| 781 } | 779 } |
| 782 | 780 |
| 783 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { | 781 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { |
| 784 webkit::npapi::PluginList::Singleton()->DisablePluginsDiscovery(); | 782 PluginList::Singleton()->DisablePluginsDiscovery(); |
| 785 } | 783 } |
| 786 | 784 |
| 787 #if defined(OS_MACOSX) | 785 #if defined(OS_MACOSX) |
| 788 void PluginServiceImpl::AppActivated() { | 786 void PluginServiceImpl::AppActivated() { |
| 789 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 787 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 790 base::Bind(&NotifyPluginsOfActivation)); | 788 base::Bind(&NotifyPluginsOfActivation)); |
| 791 } | 789 } |
| 792 #endif | 790 #endif |
| 793 | 791 |
| 794 } // namespace content | 792 } // namespace content |
| OLD | NEW |