OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/plugin/plugin_thread.h" | 5 #include "chrome/plugin/plugin_thread.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <objbase.h> | 11 #include <objbase.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/thread_local.h" | 17 #include "base/thread_local.h" |
18 #include "chrome/common/child_process.h" | 18 #include "chrome/common/child_process.h" |
19 #include "chrome/common/chrome_plugin_lib.h" | 19 #include "chrome/common/chrome_plugin_lib.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/notification_service.h" | 21 #include "chrome/common/notification_service.h" |
22 #include "chrome/common/plugin_messages.h" | 22 #include "chrome/common/plugin_messages.h" |
23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
24 #include "chrome/plugin/chrome_plugin_host.h" | 24 #include "chrome/plugin/chrome_plugin_host.h" |
25 #include "chrome/plugin/npobject_util.h" | 25 #include "chrome/plugin/npobject_util.h" |
26 #include "chrome/renderer/render_thread.h" | 26 #include "chrome/renderer/render_thread.h" |
27 #include "net/base/net_errors.h" | 27 #include "net/base/net_errors.h" |
| 28 #if defined(OS_LINUX) |
| 29 #include "webkit/glue/plugins/flash_workarounds_linux.h" |
| 30 #endif |
28 #include "webkit/glue/plugins/plugin_lib.h" | 31 #include "webkit/glue/plugins/plugin_lib.h" |
29 #include "webkit/glue/webkit_glue.h" | 32 #include "webkit/glue/webkit_glue.h" |
30 | 33 |
31 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls( | 34 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls( |
32 base::LINKER_INITIALIZED); | 35 base::LINKER_INITIALIZED); |
33 | 36 |
34 PluginThread::PluginThread() | 37 PluginThread::PluginThread() |
35 : ChildThread(base::Thread::Options(MessageLoop::TYPE_UI, 0)), | 38 : ChildThread(base::Thread::Options(MessageLoop::TYPE_UI, 0)), |
36 preloaded_plugin_module_(NULL) { | 39 preloaded_plugin_module_(NULL) { |
37 plugin_path_ = FilePath::FromWStringHack( | 40 plugin_path_ = FilePath::FromWStringHack( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #endif | 80 #endif |
78 ChildThread::Init(); | 81 ChildThread::Init(); |
79 | 82 |
80 PatchNPNFunctions(); | 83 PatchNPNFunctions(); |
81 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
82 CoInitialize(NULL); | 85 CoInitialize(NULL); |
83 #endif | 86 #endif |
84 | 87 |
85 notification_service_.reset(new NotificationService); | 88 notification_service_.reset(new NotificationService); |
86 | 89 |
| 90 #if defined(OS_LINUX) |
| 91 if (plugin_path_.BaseName().value() == "libflashplayer.so") { |
| 92 // The flash workarounds need to be enabled before the library gets loaded. |
| 93 EnableFlashWorkarounds(plugin_path_); |
| 94 } |
| 95 #endif |
87 // Preload the library to avoid loading, unloading then reloading | 96 // Preload the library to avoid loading, unloading then reloading |
88 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); | 97 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); |
89 | 98 |
90 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); | 99 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); |
91 | 100 |
92 scoped_refptr<NPAPI::PluginLib> plugin = | 101 scoped_refptr<NPAPI::PluginLib> plugin = |
93 NPAPI::PluginLib::CreatePluginLib(plugin_path_); | 102 NPAPI::PluginLib::CreatePluginLib(plugin_path_); |
94 if (plugin.get()) { | 103 if (plugin.get()) { |
95 plugin->NP_Initialize(); | 104 plugin->NP_Initialize(); |
96 } | 105 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 227 } |
219 | 228 |
220 if (!result || net_error != net::OK) | 229 if (!result || net_error != net::OK) |
221 return false; | 230 return false; |
222 | 231 |
223 *proxy_list = proxy_result; | 232 *proxy_list = proxy_result; |
224 return true; | 233 return true; |
225 } | 234 } |
226 | 235 |
227 } // namespace webkit_glue | 236 } // namespace webkit_glue |
OLD | NEW |