diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-29 23:02:34 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-29 23:02:34 +0000 |
commit | 4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf (patch) | |
tree | 41963c12afc6c484be43d69d1c31c242ed5b7488 /chrome/browser/plugin_process_host.cc | |
parent | d7ab056d66464c89ba336c4b466a8ad45f2afb6e (diff) | |
download | chromium_src-4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf.zip chromium_src-4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf.tar.gz chromium_src-4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf.tar.bz2 |
CommandLine: add a CopySwitchesFrom() and AppendSwitchPath()
These are two common patterns in Chrome code: copying a
subset of switches from one CommandLine to another, and
appending a FilePath to a CommandLine. This sets me up
to do a lot more deprecation in a follow-up change.
Review URL: http://codereview.chromium.org/3012021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_process_host.cc')
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 7c2aeb0..d6380cc 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -363,15 +363,14 @@ bool PluginProcessHost::Init(const WebPluginInfo& info, // in process listings using native process management tools. cmd_line->AppendSwitchWithValue(switches::kProcessType, switches::kPluginProcess); - cmd_line->AppendSwitchWithValue(switches::kPluginPath, - info.path.ToWStringHack()); + cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); if (logging::DialogsAreSuppressed()) cmd_line->AppendSwitch(switches::kNoErrorDialogs); // Propagate the following switches to the plugin command line (along with // any associated values) if present in the browser command line - static const char* const switch_names[] = { + static const char* const kSwitchNames[] = { switches::kPluginStartupDialog, switches::kNoSandbox, switches::kSafePlugins, @@ -396,13 +395,8 @@ bool PluginProcessHost::Init(const WebPluginInfo& info, #endif }; - for (size_t i = 0; i < arraysize(switch_names); ++i) { - if (browser_command_line.HasSwitch(switch_names[i])) { - cmd_line->AppendSwitchWithValue( - switch_names[i], - browser_command_line.GetSwitchValueASCII(switch_names[i])); - } - } + cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, + arraysize(kSwitchNames)); // If specified, prepend a launcher program to the command line. if (!plugin_launcher.empty()) @@ -415,13 +409,12 @@ bool PluginProcessHost::Init(const WebPluginInfo& info, } // Gears requires the data dir to be available on startup. - std::wstring data_dir = - PluginService::GetInstance()->GetChromePluginDataDir().ToWStringHack(); + FilePath data_dir = + PluginService::GetInstance()->GetChromePluginDataDir(); DCHECK(!data_dir.empty()); - cmd_line->AppendSwitchWithValue(switches::kPluginDataDir, data_dir); + cmd_line->AppendSwitchPath(switches::kPluginDataDir, data_dir); - cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, - ASCIIToWide(channel_id())); + cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); SetCrashReporterCommandLine(cmd_line); |