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

Unified Diff: chrome/plugin/plugin_thread.cc

Issue 4508004: gtk: refactor copy-pasted code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/gpu/gpu_thread.cc ('k') | gfx/gtk_util.h » ('j') | gfx/gtk_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/plugin_thread.cc
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index 0e169e41ac8f3063da08ca0993bfa97cd7639f8e..588c53213f8ba1f7a7c6d6975c59bda55907449e 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -27,6 +27,7 @@
#include "chrome/plugin/chrome_plugin_host.h"
#include "chrome/plugin/npobject_util.h"
#include "chrome/renderer/render_thread.h"
+#include "gfx/gtk_util.h"
#include "ipc/ipc_channel_handle.h"
#include "net/base/net_errors.h"
#include "webkit/glue/plugins/plugin_lib.h"
@@ -58,33 +59,18 @@ PluginThread::PluginThread()
// XEmbed plugins assume they are hosted in a Gtk application, so we need
// to initialize Gtk in the plugin process.
g_thread_init(NULL);
- const std::vector<std::string>& args =
- CommandLine::ForCurrentProcess()->argv();
- int argc = args.size();
- scoped_array<char *> argv(new char *[argc + 1]);
- for (size_t i = 0; i < args.size(); ++i) {
- // TODO(piman@google.com): can gtk_init modify argv? Just being safe
- // here.
- argv[i] = strdup(args[i].c_str());
- }
- argv[argc] = NULL;
- char **argv_pointer = argv.get();
// Flash has problems receiving clicks with newer GTKs due to the
// client-side windows change. To be safe, we just always set the
// backwards-compat environment variable.
setenv("GDK_NATIVE_WINDOWS", "1", 1);
- gtk_init(&argc, &argv_pointer);
+ gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess());
// GTK after 2.18 resets the environment variable. But if we're using
// nspluginwrapper, that means it'll spawn its subprocess without the
// environment variable! So set it again.
setenv("GDK_NATIVE_WINDOWS", "1", 1);
-
- for (size_t i = 0; i < args.size(); ++i) {
- free(argv[i]);
- }
}
x11_util::SetDefaultX11ErrorHandlers();
« no previous file with comments | « chrome/gpu/gpu_thread.cc ('k') | gfx/gtk_util.h » ('j') | gfx/gtk_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698