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 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 PluginThread::PluginThread() | 28 PluginThread::PluginThread() |
29 : preloaded_plugin_module_(NULL) { | 29 : preloaded_plugin_module_(NULL) { |
30 plugin_path_ = FilePath::FromWStringHack( | 30 plugin_path_ = FilePath::FromWStringHack( |
31 CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kPluginPath)); | 31 CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kPluginPath)); |
32 | 32 |
33 lazy_tls.Pointer()->Set(this); | 33 lazy_tls.Pointer()->Set(this); |
34 #if defined(OS_LINUX) | 34 #if defined(OS_LINUX) |
35 { | 35 { |
36 // XEmbed plugins assume they are hosted in a Gtk application, so we need | 36 // XEmbed plugins assume they are hosted in a Gtk application, so we need |
37 // to initialize Gtk in the plugin process. | 37 // to initialize Gtk in the plugin process. |
38 g_thread_init(NULL); | |
39 const std::vector<std::string>& args = | 38 const std::vector<std::string>& args = |
40 CommandLine::ForCurrentProcess()->argv(); | 39 CommandLine::ForCurrentProcess()->argv(); |
41 int argc = args.size(); | 40 int argc = args.size(); |
42 scoped_array<char *> argv(new char *[argc + 1]); | 41 scoped_array<char *> argv(new char *[argc + 1]); |
43 for (size_t i = 0; i < args.size(); ++i) { | 42 for (size_t i = 0; i < args.size(); ++i) { |
44 // TODO(piman@google.com): can gtk_init modify argv? Just being safe | 43 // TODO(piman@google.com): can gtk_init modify argv? Just being safe |
45 // here. | 44 // here. |
46 argv[i] = strdup(args[i].c_str()); | 45 argv[i] = strdup(args[i].c_str()); |
47 } | 46 } |
48 argv[argc] = NULL; | 47 argv[argc] = NULL; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 192 } |
194 | 193 |
195 if (!result || net_error != net::OK) | 194 if (!result || net_error != net::OK) |
196 return false; | 195 return false; |
197 | 196 |
198 *proxy_list = proxy_result; | 197 *proxy_list = proxy_result; |
199 return true; | 198 return true; |
200 } | 199 } |
201 | 200 |
202 } // namespace webkit_glue | 201 } // namespace webkit_glue |
OLD | NEW |