OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_LINUX) | 9 #if defined(USE_X11) |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| 11 #elif defined(OS_MACOSX) |
| 12 #include <CoreFoundation/CoreFoundation.h> |
11 #endif | 13 #endif |
12 | 14 |
| 15 #include <string> |
| 16 #include <vector> |
| 17 |
13 #include "base/command_line.h" | 18 #include "base/command_line.h" |
14 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
15 #include "base/process_util.h" | 20 #include "base/process_util.h" |
16 #include "base/thread_local.h" | 21 #include "base/thread_local.h" |
17 #include "chrome/common/child_process.h" | 22 #include "chrome/common/child_process.h" |
18 #include "chrome/common/chrome_plugin_lib.h" | 23 #include "chrome/common/chrome_plugin_lib.h" |
19 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/plugin_messages.h" | 25 #include "chrome/common/plugin_messages.h" |
21 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
22 #include "chrome/plugin/chrome_plugin_host.h" | 27 #include "chrome/plugin/chrome_plugin_host.h" |
23 #include "chrome/plugin/npobject_util.h" | 28 #include "chrome/plugin/npobject_util.h" |
24 #include "chrome/renderer/render_thread.h" | 29 #include "chrome/renderer/render_thread.h" |
25 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
26 #include "webkit/glue/plugins/plugin_lib.h" | 31 #include "webkit/glue/plugins/plugin_lib.h" |
27 #include "webkit/glue/webkit_glue.h" | 32 #include "webkit/glue/webkit_glue.h" |
28 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 33 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
29 | 34 |
30 #if defined(OS_MACOSX) | 35 #if defined(USE_X11) |
31 #include <CoreFoundation/CoreFoundation.h> | 36 #include "app/x11_util.h" |
| 37 #elif defined(OS_MACOSX) |
32 #include "app/l10n_util.h" | 38 #include "app/l10n_util.h" |
33 #include "base/mac_util.h" | 39 #include "base/mac_util.h" |
34 #include "base/scoped_cftyperef.h" | 40 #include "base/scoped_cftyperef.h" |
35 #include "base/sys_string_conversions.h" | 41 #include "base/sys_string_conversions.h" |
36 #include "grit/chromium_strings.h" | 42 #include "grit/chromium_strings.h" |
37 #endif | 43 #endif |
38 | 44 |
39 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls( | 45 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls( |
40 base::LINKER_INITIALIZED); | 46 base::LINKER_INITIALIZED); |
41 | 47 |
(...skipping 30 matching lines...) Expand all Loading... |
72 | 78 |
73 // GTK after 2.18 resets the environment variable. But if we're using | 79 // GTK after 2.18 resets the environment variable. But if we're using |
74 // nspluginwrapper, that means it'll spawn its subprocess without the | 80 // nspluginwrapper, that means it'll spawn its subprocess without the |
75 // environment variable! So set it again. | 81 // environment variable! So set it again. |
76 setenv("GDK_NATIVE_WINDOWS", "1", 1); | 82 setenv("GDK_NATIVE_WINDOWS", "1", 1); |
77 | 83 |
78 for (size_t i = 0; i < args.size(); ++i) { | 84 for (size_t i = 0; i < args.size(); ++i) { |
79 free(argv[i]); | 85 free(argv[i]); |
80 } | 86 } |
81 } | 87 } |
| 88 |
| 89 x11_util::SetX11ErrorHandlers(); |
82 #endif | 90 #endif |
83 | 91 |
84 PatchNPNFunctions(); | 92 PatchNPNFunctions(); |
85 | 93 |
86 // Preload the library to avoid loading, unloading then reloading | 94 // Preload the library to avoid loading, unloading then reloading |
87 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); | 95 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); |
88 | 96 |
89 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); | 97 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); |
90 | 98 |
91 scoped_refptr<NPAPI::PluginLib> plugin = | 99 scoped_refptr<NPAPI::PluginLib> plugin = |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 new ViewHostMsg_ResolveProxy(url, &net_error, &proxy_result)); | 233 new ViewHostMsg_ResolveProxy(url, &net_error, &proxy_result)); |
226 } | 234 } |
227 | 235 |
228 if (!result || net_error != net::OK) | 236 if (!result || net_error != net::OK) |
229 return false; | 237 return false; |
230 | 238 |
231 *proxy_list = proxy_result; | 239 *proxy_list = proxy_result; |
232 return true; | 240 return true; |
233 } | 241 } |
234 | 242 |
235 } // namespace webkit_glue | 243 } // namespace webkit_glue |
OLD | NEW |