diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 22:10:02 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 22:10:02 +0000 |
commit | e5e19c3476afa746b3baec8be9ea12532452afbb (patch) | |
tree | ba04ab540e44bd0eccb371c0cf053907c4363fd3 | |
parent | f730a913f16507bedeeca30827a66f07903fb42a (diff) | |
download | chromium_src-e5e19c3476afa746b3baec8be9ea12532452afbb.zip chromium_src-e5e19c3476afa746b3baec8be9ea12532452afbb.tar.gz chromium_src-e5e19c3476afa746b3baec8be9ea12532452afbb.tar.bz2 |
posix: port PrependCommand to Windows and use for the plugin launcher.
Review URL: http://codereview.chromium.org/88006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14065 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/command_line.cc | 9 | ||||
-rw-r--r-- | base/command_line.h | 2 | ||||
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 7 |
3 files changed, 12 insertions, 6 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index e49254f..8fb2dcc 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -306,6 +306,15 @@ void CommandLine::AppendArguments(const CommandLine& other, switches_[i->first] = i->second; } +void CommandLine::PrependWrapper(const std::wstring& wrapper) { + // The wrapper may have embedded arguments (like "gdb --args"). In this case, + // we don't pretend to do anything fancy, we just split on spaces. + std::vector<std::wstring> wrapper_and_args; + SplitString(wrapper, ' ', &wrapper_and_args); + program_ = wrapper_and_args[0]; + command_line_string_ = wrapper + L" " + command_line_string_; +} + #elif defined(OS_POSIX) void CommandLine::AppendSwitch(const std::wstring& switch_string) { std::string ascii_switch = WideToASCII(switch_string); diff --git a/base/command_line.h b/base/command_line.h index c727b8a..8271206 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -121,7 +121,7 @@ class CommandLine { bool include_program); // On POSIX systems it's common to run processes via a wrapper (like - // "valgrind" or "gdb --args"). *Note, only availible on POSIX* + // "valgrind" or "gdb --args"). void PrependWrapper(const std::wstring& wrapper); private: diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 2b62f6c..6cea0c7 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -439,11 +439,8 @@ bool PluginProcessHost::Init(const WebPluginInfo& info, // If specified, prepend a launcher program to the command line. std::wstring plugin_launcher = browser_command_line.GetSwitchValue(switches::kPluginLauncher); - if (!plugin_launcher.empty()) { - CommandLine new_cmd_line = CommandLine(plugin_launcher); - new_cmd_line.AppendArguments(cmd_line, true); - cmd_line = new_cmd_line; - } + if (!plugin_launcher.empty()) + cmd_line.PrependWrapper(plugin_launcher); if (!locale.empty()) { // Pass on the locale so the null plugin will use the right language in the |