Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/plugin/plugin_thread.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/plugin/plugin_thread.h" 5 #include "content/plugin/plugin_thread.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(TOOLKIT_GTK) 9 #if defined(OS_MACOSX)
10 #include <gtk/gtk.h>
11 #elif defined(OS_MACOSX)
12 #include <CoreFoundation/CoreFoundation.h> 10 #include <CoreFoundation/CoreFoundation.h>
13 #endif 11 #endif
14 12
15 #include <string> 13 #include <string>
16 #include <vector> 14 #include <vector>
17 15
18 #include "base/bind.h" 16 #include "base/bind.h"
19 #include "base/command_line.h" 17 #include "base/command_line.h"
20 #include "base/lazy_instance.h" 18 #include "base/lazy_instance.h"
21 #include "base/process/kill.h" 19 #include "base/process/kill.h"
22 #include "base/process/process_handle.h" 20 #include "base/process/process_handle.h"
23 #include "base/threading/thread_local.h" 21 #include "base/threading/thread_local.h"
24 #include "content/child/blink_platform_impl.h" 22 #include "content/child/blink_platform_impl.h"
25 #include "content/child/child_process.h" 23 #include "content/child/child_process.h"
26 #include "content/child/npapi/npobject_util.h" 24 #include "content/child/npapi/npobject_util.h"
27 #include "content/child/npapi/plugin_lib.h" 25 #include "content/child/npapi/plugin_lib.h"
28 #include "content/common/plugin_process_messages.h" 26 #include "content/common/plugin_process_messages.h"
29 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
30 #include "content/public/plugin/content_plugin_client.h" 28 #include "content/public/plugin/content_plugin_client.h"
31 #include "third_party/WebKit/public/web/WebKit.h" 29 #include "third_party/WebKit/public/web/WebKit.h"
32 #include "ipc/ipc_channel_handle.h" 30 #include "ipc/ipc_channel_handle.h"
33 31
34 #if defined(TOOLKIT_GTK)
35 #include "ui/gfx/gtk_util.h"
36 #endif
37
38 #if defined(USE_X11) 32 #if defined(USE_X11)
39 #include "ui/base/x/x11_util.h" 33 #include "ui/base/x/x11_util.h"
40 #endif 34 #endif
41 35
42 namespace content { 36 namespace content {
43 37
44 namespace { 38 namespace {
45 39
46 class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter { 40 class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter {
47 public: 41 public:
(...skipping 28 matching lines...) Expand all
76 LAZY_INSTANCE_INITIALIZER; 70 LAZY_INSTANCE_INITIALIZER;
77 71
78 PluginThread::PluginThread() 72 PluginThread::PluginThread()
79 : preloaded_plugin_module_(NULL), 73 : preloaded_plugin_module_(NULL),
80 forcefully_terminate_plugin_process_(false) { 74 forcefully_terminate_plugin_process_(false) {
81 base::FilePath plugin_path = 75 base::FilePath plugin_path =
82 CommandLine::ForCurrentProcess()->GetSwitchValuePath( 76 CommandLine::ForCurrentProcess()->GetSwitchValuePath(
83 switches::kPluginPath); 77 switches::kPluginPath);
84 78
85 lazy_tls.Pointer()->Set(this); 79 lazy_tls.Pointer()->Set(this);
86 #if defined(TOOLKIT_GTK)
87 {
88 // XEmbed plugins assume they are hosted in a Gtk application, so we need
89 // to initialize Gtk in the plugin process.
90 // g_thread_init API is deprecated since glib 2.31.0, see release note:
91 // http://mail.gnome.org/archives/gnome-announce-list/2011-October/msg00041. html
92 #if !(GLIB_CHECK_VERSION(2, 31, 0))
93 g_thread_init(NULL);
94 #endif
95
96 // Flash has problems receiving clicks with newer GTKs due to the
97 // client-side windows change. To be safe, we just always set the
98 // backwards-compat environment variable.
99 setenv("GDK_NATIVE_WINDOWS", "1", 1);
100
101 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess());
102
103 // GTK after 2.18 resets the environment variable. But if we're using
104 // nspluginwrapper, that means it'll spawn its subprocess without the
105 // environment variable! So set it again.
106 setenv("GDK_NATIVE_WINDOWS", "1", 1);
107 }
108
109 ui::SetDefaultX11ErrorHandlers();
110 #endif
111 80
112 PatchNPNFunctions(); 81 PatchNPNFunctions();
113 82
114 // Preload the library to avoid loading, unloading then reloading 83 // Preload the library to avoid loading, unloading then reloading
115 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL); 84 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL);
116 85
117 scoped_refptr<PluginLib> plugin(PluginLib::CreatePluginLib(plugin_path)); 86 scoped_refptr<PluginLib> plugin(PluginLib::CreatePluginLib(plugin_path));
118 if (plugin.get()) { 87 if (plugin.get()) {
119 plugin->NP_Initialize(); 88 plugin->NP_Initialize();
120 // For OOP plugins the plugin dll will be unloaded during process shutdown 89 // For OOP plugins the plugin dll will be unloaded during process shutdown
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 155 }
187 156
188 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); 157 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle));
189 } 158 }
190 159
191 void PluginThread::OnNotifyRenderersOfPendingShutdown() { 160 void PluginThread::OnNotifyRenderersOfPendingShutdown() {
192 PluginChannel::NotifyRenderersOfPendingShutdown(); 161 PluginChannel::NotifyRenderersOfPendingShutdown();
193 } 162 }
194 163
195 } // namespace content 164 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698