| 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> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 void PluginThread::OnControlMessageReceived(const IPC::Message& msg) { | 48 void PluginThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 49 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) | 49 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) |
| 50 IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) | 50 IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) |
| 51 IPC_MESSAGE_HANDLER(PluginProcessMsg_PluginMessage, OnPluginMessage) | 51 IPC_MESSAGE_HANDLER(PluginProcessMsg_PluginMessage, OnPluginMessage) |
| 52 IPC_END_MESSAGE_MAP() | 52 IPC_END_MESSAGE_MAP() |
| 53 } | 53 } |
| 54 | 54 |
| 55 void PluginThread::Init() { | 55 void PluginThread::Init() { |
| 56 lazy_tls.Pointer()->Set(this); | 56 lazy_tls.Pointer()->Set(this); |
| 57 #if defined(OS_LINUX) |
| 58 { |
| 59 // XEmbed plugins assume they are hosted in a Gtk application, so we need |
| 60 // to initialize Gtk in the plugin process. |
| 61 const std::vector<std::string>& args = |
| 62 CommandLine::ForCurrentProcess()->argv(); |
| 63 int argc = args.size(); |
| 64 scoped_array<char *> argv(new char *[argc + 1]); |
| 65 for (size_t i = 0; i < args.size(); ++i) { |
| 66 // TODO(piman@google.com): can gtk_init modify argv? Just being safe |
| 67 // here. |
| 68 argv[i] = strdup(args[i].c_str()); |
| 69 } |
| 70 argv[argc] = NULL; |
| 71 char **argv_pointer = argv.get(); |
| 72 gtk_init(&argc, &argv_pointer); |
| 73 for (size_t i = 0; i < args.size(); ++i) { |
| 74 free(argv[i]); |
| 75 } |
| 76 } |
| 77 #endif |
| 57 ChildThread::Init(); | 78 ChildThread::Init(); |
| 58 | 79 |
| 59 PatchNPNFunctions(); | 80 PatchNPNFunctions(); |
| 60 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
| 61 CoInitialize(NULL); | 82 CoInitialize(NULL); |
| 62 #endif | 83 #endif |
| 63 | 84 |
| 64 notification_service_.reset(new NotificationService); | 85 notification_service_.reset(new NotificationService); |
| 65 | 86 |
| 66 // Preload the library to avoid loading, unloading then reloading | 87 // Preload the library to avoid loading, unloading then reloading |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 218 } |
| 198 | 219 |
| 199 if (!result || net_error != net::OK) | 220 if (!result || net_error != net::OK) |
| 200 return false; | 221 return false; |
| 201 | 222 |
| 202 *proxy_list = proxy_result; | 223 *proxy_list = proxy_result; |
| 203 return true; | 224 return true; |
| 204 } | 225 } |
| 205 | 226 |
| 206 } // namespace webkit_glue | 227 } // namespace webkit_glue |
| OLD | NEW |