summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_main.cc4
-rw-r--r--chrome/browser/browser_uitest.cc3
-rw-r--r--chrome/browser/configuration_policy_pref_store_unittest.cc12
-rw-r--r--chrome/browser/extensions/extension_startup_browsertest.cc5
-rw-r--r--chrome/browser/extensions/extension_uitest.cc6
-rw-r--r--chrome/browser/first_run_win.cc22
-rw-r--r--chrome/browser/gpu_process_host.cc38
-rw-r--r--chrome/browser/gpu_process_host.h6
-rw-r--r--chrome/browser/jumplist_win.cc6
-rw-r--r--chrome/browser/nacl_host/nacl_broker_host_win.cc3
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.cc3
-rw-r--r--chrome/browser/net/chrome_url_request_context_unittest.cc14
-rw-r--r--chrome/browser/plugin_process_host.cc23
-rw-r--r--chrome/browser/pref_service_uitest.cc3
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc6
-rw-r--r--chrome/browser/process_singleton_uitest.cc3
-rw-r--r--chrome/browser/profile_import_process_host.cc3
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc20
-rw-r--r--chrome/browser/utility_process_host.cc6
-rw-r--r--chrome/browser/worker_host/worker_process_host.cc6
-rw-r--r--chrome/browser/zygote_host_linux.cc11
21 files changed, 64 insertions, 139 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 2a2bc93..82bc172 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -572,8 +572,8 @@ Profile* CreateProfile(const MainFunctionParams& parameters,
// TODO(tc): It would be nice to remove the flag we don't want, but that
// sounds risky if we parse differently than CommandLineToArgvW.
CommandLine new_command_line = parameters.command_line_;
- new_command_line.AppendSwitchWithValue(switches::kUserDataDir,
- new_user_data_dir.ToWStringHack());
+ new_command_line.AppendSwitchPath(switches::kUserDataDir,
+ new_user_data_dir);
base::LaunchApp(new_command_line, false, false, NULL);
}
#else
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index 404edd8..dce449d 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -278,8 +278,7 @@ public:
file_util::Delete(tmp_profile_, true);
file_util::CreateDirectory(tmp_profile_);
- launch_arguments_.AppendSwitchWithValue(switches::kUserDataDir,
- tmp_profile_.ToWStringHack());
+ launch_arguments_.AppendSwitchPath(switches::kUserDataDir, tmp_profile_);
}
bool LaunchAppWithProfile() {
diff --git a/chrome/browser/configuration_policy_pref_store_unittest.cc b/chrome/browser/configuration_policy_pref_store_unittest.cc
index 0762a6f..0cac13f 100644
--- a/chrome/browser/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/configuration_policy_pref_store_unittest.cc
@@ -198,11 +198,11 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestSettingsProxyConfig) {
command_line.AppendSwitch(switches::kNoProxyServer);
command_line.AppendSwitch(switches::kProxyAutoDetect);
command_line.AppendSwitchWithValue(switches::kProxyPacUrl,
- L"http://chromium.org/test.pac");
+ "http://chromium.org/test.pac");
command_line.AppendSwitchWithValue(switches::kProxyServer,
- L"http://chromium2.org");
+ "http://chromium2.org");
command_line.AppendSwitchWithValue(switches::kProxyBypassList,
- L"http://chromium3.org");
+ "http://chromium3.org");
ConfigurationPolicyPrefStore store(&command_line, NULL);
EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE);
@@ -232,11 +232,11 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfigManualOverride) {
command_line.AppendSwitch(switches::kNoProxyServer);
command_line.AppendSwitch(switches::kProxyAutoDetect);
command_line.AppendSwitchWithValue(switches::kProxyPacUrl,
- L"http://chromium.org/test.pac");
+ "http://chromium.org/test.pac");
command_line.AppendSwitchWithValue(switches::kProxyServer,
- L"http://chromium.org");
+ "http://chromium.org");
command_line.AppendSwitchWithValue(switches::kProxyBypassList,
- L"http://chromium.org");
+ "http://chromium.org");
scoped_ptr<MockConfigurationPolicyProvider> provider(
new MockConfigurationPolicyProvider());
diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc
index 0d056d0..165054d 100644
--- a/chrome/browser/extensions/extension_startup_browsertest.cc
+++ b/chrome/browser/extensions/extension_startup_browsertest.cc
@@ -60,9 +60,8 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
command_line->AppendSwitch(switches::kDisableExtensions);
}
- if (!load_extension_.value().empty()) {
- command_line->AppendSwitchWithValue(switches::kLoadExtension,
- load_extension_.ToWStringHack());
+ if (!load_extension_.empty()) {
+ command_line->AppendSwitchPath(switches::kLoadExtension, load_extension_);
command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck);
}
}
diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc
index 8344d5d..2076949 100644
--- a/chrome/browser/extensions/extension_uitest.cc
+++ b/chrome/browser/extensions/extension_uitest.cc
@@ -57,10 +57,8 @@ class ExtensionUITest : public ExternalTabUITest {
public:
explicit ExtensionUITest(const std::string& extension_path)
: loop_(MessageLoop::current()) {
- FilePath filename(test_data_directory_);
- filename = filename.AppendASCII(extension_path);
- launch_arguments_.AppendSwitchWithValue(switches::kLoadExtension,
- filename.value());
+ FilePath filename = test_data_directory_.AppendASCII(extension_path);
+ launch_arguments_.AppendSwitchPath(switches::kLoadExtension, filename);
functions_enabled_.push_back("*");
}
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 32866ff..38b5b66 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -682,12 +682,13 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
HWND parent_window) {
const CommandLine& cmdline = *CommandLine::ForCurrentProcess();
CommandLine import_cmd(cmdline.GetProgram());
- // Propagate user data directory switch.
- if (cmdline.HasSwitch(switches::kUserDataDir)) {
- import_cmd.AppendSwitchWithValue(
- switches::kUserDataDir,
- cmdline.GetSwitchValueASCII(switches::kUserDataDir));
- }
+
+ const char* kSwitchNames[] = {
+ switches::kUserDataDir,
+ switches::kChromeFrame,
+ switches::kCountry,
+ };
+ import_cmd.CopySwitchesFrom(cmdline, kSwitchNames, arraysize(kSwitchNames));
// Since ImportSettings is called before the local state is stored on disk
// we pass the language as an argument. GetApplicationLocale checks the
@@ -706,15 +707,6 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
switches::kImportFromFile, import_bookmarks_path.c_str());
}
- if (cmdline.HasSwitch(switches::kChromeFrame)) {
- import_cmd.AppendSwitch(switches::kChromeFrame);
- }
-
- if (cmdline.HasSwitch(switches::kCountry)) {
- import_cmd.AppendSwitchWithValue(switches::kCountry,
- cmdline.GetSwitchValueASCII(switches::kCountry));
- }
-
// Time to launch the process that is going to do the import.
base::ProcessHandle import_process;
if (!base::LaunchApp(import_cmd, false, false, &import_process))
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index cdf1102..03222fd 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -90,19 +90,15 @@ bool GpuProcessHost::Init() {
ASCIIToWide(channel_id()));
// Propagate relevant command line switches.
- static const char* const switch_names[] = {
+ static const char* const kSwitchNames[] = {
switches::kUseGL,
+ switches::kDisableLogging,
+ switches::kEnableLogging,
+ switches::kGpuStartupDialog,
+ switches::kLoggingLevel,
};
-
- 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]));
- }
- }
-
- const CommandLine& browser_cmd_line = *CommandLine::ForCurrentProcess();
- PropagateBrowserCommandLineToGpu(browser_cmd_line, cmd_line);
+ cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
+ arraysize(kSwitchNames));
// If specified, prepend a launcher program to the command line.
if (!gpu_launcher.empty())
@@ -215,26 +211,6 @@ void GpuProcessHost::ReplyToRenderer(
filter->Send(message);
}
-void GpuProcessHost::PropagateBrowserCommandLineToGpu(
- const CommandLine& browser_cmd,
- CommandLine* gpu_cmd) const {
- // Propagate the following switches to the GPU process command line (along
- // with any associated values) if present in the browser command line.
- static const char* const switch_names[] = {
- switches::kDisableLogging,
- switches::kEnableLogging,
- switches::kGpuStartupDialog,
- switches::kLoggingLevel,
- };
-
- for (size_t i = 0; i < arraysize(switch_names); ++i) {
- if (browser_cmd.HasSwitch(switch_names[i])) {
- gpu_cmd->AppendSwitchWithValue(switch_names[i],
- browser_cmd.GetSwitchValueASCII(switch_names[i]));
- }
- }
-}
-
URLRequestContext* GpuProcessHost::GetRequestContext(
uint32 request_id,
const ViewHostMsg_Resource_Request& request_data) {
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 662bae8..c81b565 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -92,12 +92,6 @@ class GpuProcessHost : public BrowserChildProcessHost {
void ReplyToRenderer(const IPC::ChannelHandle& channel,
ResourceMessageFilter* filter);
- // Copies applicable command line switches from the given |browser_cmd| line
- // flags to the output |gpu_cmd| line flags. Not all switches will be
- // copied over.
- void PropagateBrowserCommandLineToGpu(const CommandLine& browser_cmd,
- CommandLine* gpu_cmd) const;
-
// ResourceDispatcherHost::Receiver implementation:
virtual URLRequestContext* GetRequestContext(
uint32 request_id,
diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc
index e77b55c..1f434f6 100644
--- a/chrome/browser/jumplist_win.cc
+++ b/chrome/browser/jumplist_win.cc
@@ -422,10 +422,10 @@ bool UpdateJumpList(const wchar_t* app_id,
// Retrieve the command-line switches of this process.
CommandLine command_line(CommandLine::ARGUMENTS_ONLY);
- std::wstring user_data_dir = CommandLine::ForCurrentProcess()->
- GetSwitchValue(switches::kUserDataDir);
+ FilePath user_data_dir = CommandLine::ForCurrentProcess()->
+ GetSwitchValuePath(switches::kUserDataDir);
if (!user_data_dir.empty())
- command_line.AppendSwitchWithValue(switches::kUserDataDir, user_data_dir);
+ command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir);
std::wstring chrome_switches = command_line.command_line_string();
diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.cc b/chrome/browser/nacl_host/nacl_broker_host_win.cc
index f479030..2847e85 100644
--- a/chrome/browser/nacl_host/nacl_broker_host_win.cc
+++ b/chrome/browser/nacl_host/nacl_broker_host_win.cc
@@ -47,8 +47,7 @@ bool NaClBrokerHost::Init() {
cmd_line->AppendSwitchWithValue(switches::kProcessType,
switches::kNaClBrokerProcess);
- cmd_line->AppendSwitchWithValue(switches::kProcessChannelID,
- ASCIIToWide(channel_id()));
+ cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
BrowserChildProcessHost::Launch(FilePath(), cmd_line);
return true;
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index 5c9d9da..dde5cb1 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -134,8 +134,7 @@ bool NaClProcessHost::LaunchSelLdr() {
cmd_line->AppendSwitchWithValue(switches::kProcessType,
switches::kNaClLoaderProcess);
- cmd_line->AppendSwitchWithValue(switches::kProcessChannelID,
- ASCIIToWide(channel_id()));
+ cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
// On Windows we might need to start the broker process to launch a new loader
#if defined(OS_WIN)
diff --git a/chrome/browser/net/chrome_url_request_context_unittest.cc b/chrome/browser/net/chrome_url_request_context_unittest.cc
index 7ba2dff..9f42e7b 100644
--- a/chrome/browser/net/chrome_url_request_context_unittest.cc
+++ b/chrome/browser/net/chrome_url_request_context_unittest.cc
@@ -25,25 +25,25 @@ TEST(ChromeURLRequestContextTest, CreateProxyConfigTest) {
CommandLine no_proxy_extra_params(unused_path);
no_proxy_extra_params.AppendSwitch(switches::kNoProxyServer);
no_proxy_extra_params.AppendSwitchWithValue(switches::kProxyServer,
- L"http://proxy:8888");
+ "http://proxy:8888");
CommandLine single_proxy(unused_path);
single_proxy.AppendSwitchWithValue(switches::kProxyServer,
- L"http://proxy:8888");
+ "http://proxy:8888");
CommandLine per_scheme_proxy(unused_path);
per_scheme_proxy.AppendSwitchWithValue(switches::kProxyServer,
- L"http=httpproxy:8888;ftp=ftpproxy:8889");
+ "http=httpproxy:8888;ftp=ftpproxy:8889");
CommandLine per_scheme_proxy_bypass(unused_path);
per_scheme_proxy_bypass.AppendSwitchWithValue(switches::kProxyServer,
- L"http=httpproxy:8888;ftp=ftpproxy:8889");
+ "http=httpproxy:8888;ftp=ftpproxy:8889");
per_scheme_proxy_bypass.AppendSwitchWithValue(
switches::kProxyBypassList,
- L".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8");
+ ".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8");
CommandLine with_pac_url(unused_path);
with_pac_url.AppendSwitchWithValue(switches::kProxyPacUrl,
- L"http://wpad/wpad.dat");
+ "http://wpad/wpad.dat");
with_pac_url.AppendSwitchWithValue(
switches::kProxyBypassList,
- L".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8");
+ ".google.com, foo.com:99, 1.2.3.4:22, 127.0.0.1/8");
CommandLine with_auto_detect(unused_path);
with_auto_detect.AppendSwitch(switches::kProxyAutoDetect);
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);
diff --git a/chrome/browser/pref_service_uitest.cc b/chrome/browser/pref_service_uitest.cc
index 87dcb2c..2f8f4e0 100644
--- a/chrome/browser/pref_service_uitest.cc
+++ b/chrome/browser/pref_service_uitest.cc
@@ -49,8 +49,7 @@ class PreferenceServiceTest : public UITest {
FILE_ATTRIBUTE_NORMAL));
#endif
- launch_arguments_.AppendSwitchWithValue(switches::kUserDataDir,
- tmp_profile_.ToWStringHack());
+ launch_arguments_.AppendSwitchPath(switches::kUserDataDir, tmp_profile_);
}
bool LaunchAppWithProfile() {
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index db20963..4d35c75 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -28,10 +28,8 @@ const wchar_t kDocRoot[] = L"chrome/test/data";
class PrintingLayoutTest : public PrintingTest<UITest> {
public:
PrintingLayoutTest() {
- emf_path_ = browser_directory_;
- emf_path_ = emf_path_.AppendASCII("metafile_dumps");
- launch_arguments_.AppendSwitchWithValue("debug-print",
- L'"' + emf_path_.value() + L'"');
+ emf_path_ = browser_directory_.AppendASCII("metafile_dumps");
+ launch_arguments_.AppendSwitchPath("debug-print", emf_path_);
show_window_ = true;
}
diff --git a/chrome/browser/process_singleton_uitest.cc b/chrome/browser/process_singleton_uitest.cc
index ee8756a..8b7da6b 100644
--- a/chrome/browser/process_singleton_uitest.cc
+++ b/chrome/browser/process_singleton_uitest.cc
@@ -62,8 +62,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> {
FilePath user_data_directory;
PathService::Get(chrome::DIR_USER_DATA, &user_data_directory);
- command_line.AppendSwitchWithValue(switches::kUserDataDir,
- user_data_directory.ToWStringHack());
+ command_line.AppendSwitchPath(switches::kUserDataDir, user_data_directory);
if (first_run)
command_line.AppendSwitch(switches::kFirstRun);
diff --git a/chrome/browser/profile_import_process_host.cc b/chrome/browser/profile_import_process_host.cc
index 84a2684..eaeb6dc 100644
--- a/chrome/browser/profile_import_process_host.cc
+++ b/chrome/browser/profile_import_process_host.cc
@@ -87,8 +87,7 @@ bool ProfileImportProcessHost::StartProcess() {
CommandLine* cmd_line = new CommandLine(exe_path);
cmd_line->AppendSwitchWithValue(switches::kProcessType,
switches::kProfileImportProcess);
- cmd_line->AppendSwitchWithValue(switches::kProcessChannelID,
- ASCIIToWide(channel_id()));
+ cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
SetCrashReporterCommandLine(cmd_line);
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 1f87fca..2506617 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -331,8 +331,7 @@ bool BrowserRenderProcessHost::Init(bool is_extensions_process,
if (!renderer_prefix.empty())
cmd_line->PrependWrapper(renderer_prefix);
AppendRendererCommandLine(cmd_line);
- cmd_line->AppendSwitchWithValue(switches::kProcessChannelID,
- ASCIIToWide(channel_id));
+ cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id);
// Spawn the child process asynchronously to avoid blocking the UI thread.
// As long as there's no renderer prefix, we can use the zygote process
@@ -459,7 +458,7 @@ void BrowserRenderProcessHost::AppendRendererCommandLine(
// Pass on the browser locale.
const std::string locale = g_browser_process->GetApplicationLocale();
- command_line->AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale));
+ command_line->AppendSwitchWithValue(switches::kLang, locale);
// If we run FieldTrials, we want to pass to their state to the renderer so
// that it can act in accordance with each state, or record histograms
@@ -475,10 +474,8 @@ void BrowserRenderProcessHost::AppendRendererCommandLine(
FilePath user_data_dir =
browser_command_line.GetSwitchValuePath(switches::kUserDataDir);
-
if (!user_data_dir.empty())
- command_line->AppendSwitchWithValue(switches::kUserDataDir,
- user_data_dir.value());
+ command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
#if defined(OS_CHROMEOS)
const std::string& profile =
browser_command_line.GetSwitchValueASCII(switches::kProfile);
@@ -492,7 +489,7 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
CommandLine* renderer_cmd) const {
// Propagate the following switches to the renderer 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::kRendererAssertTest,
#if !defined(OFFICIAL_BUILD)
switches::kRendererCheckFalseTest,
@@ -580,13 +577,8 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
switches::kEnableClickToPlay,
switches::kPrelaunchGpuProcess,
};
-
- for (size_t i = 0; i < arraysize(switch_names); ++i) {
- if (browser_cmd.HasSwitch(switch_names[i])) {
- renderer_cmd->AppendSwitchWithValue(switch_names[i],
- browser_cmd.GetSwitchValueASCII(switch_names[i]));
- }
- }
+ renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
+ arraysize(kSwitchNames));
// Disable databases in incognito mode.
if (profile()->IsOffTheRecord() &&
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc
index 857c38d..dbcf94b 100644
--- a/chrome/browser/utility_process_host.cc
+++ b/chrome/browser/utility_process_host.cc
@@ -80,8 +80,7 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) {
CommandLine* cmd_line = new CommandLine(exe_path);
cmd_line->AppendSwitchWithValue(switches::kProcessType,
switches::kUtilityProcess);
- cmd_line->AppendSwitchWithValue(switches::kProcessChannelID,
- ASCIIToWide(channel_id()));
+ cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
std::string locale = g_browser_process->GetApplicationLocale();
cmd_line->AppendSwitchWithValue(switches::kLang, locale);
@@ -114,8 +113,7 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) {
switches::kUtilityCmdPrefix));
}
- cmd_line->AppendSwitchWithValue(switches::kUtilityProcessAllowedDir,
- exposed_dir.value().c_str());
+ cmd_line->AppendSwitchPath(switches::kUtilityProcessAllowedDir, exposed_dir);
#endif
Launch(
diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc
index 762a0c5..f995cbd 100644
--- a/chrome/browser/worker_host/worker_process_host.cc
+++ b/chrome/browser/worker_host/worker_process_host.cc
@@ -107,8 +107,7 @@ bool WorkerProcessHost::Init() {
CommandLine* cmd_line = new CommandLine(exe_path);
cmd_line->AppendSwitchWithValue(switches::kProcessType,
switches::kWorkerProcess);
- cmd_line->AppendSwitchWithValue(switches::kProcessChannelID,
- ASCIIToWide(channel_id()));
+ cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
SetCrashReporterCommandLine(cmd_line);
if (CommandLine::ForCurrentProcess()->HasSwitch(
@@ -140,8 +139,7 @@ bool WorkerProcessHost::Init() {
const std::wstring level =
CommandLine::ForCurrentProcess()->GetSwitchValue(
switches::kLoggingLevel);
- cmd_line->AppendSwitchWithValue(
- switches::kLoggingLevel, level);
+ cmd_line->AppendSwitchWithValue(switches::kLoggingLevel, level);
}
if (CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc
index 49c93c2..983e2ce 100644
--- a/chrome/browser/zygote_host_linux.cc
+++ b/chrome/browser/zygote_host_linux.cc
@@ -96,16 +96,9 @@ void ZygoteHost::Init(const std::string& sandbox_cmd) {
#else
switches::kEnableSeccompSandbox,
#endif
- NULL
};
- for (const char** sw = kForwardSwitches; *sw; sw++) {
- if (browser_command_line.HasSwitch(*sw)) {
- // Always append with value for those switches which need it; it does no
- // harm for those which don't.
- cmd_line.AppendSwitchWithValue(*sw,
- browser_command_line.GetSwitchValueASCII(*sw));
- }
- }
+ cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches,
+ arraysize(kForwardSwitches));
sandbox_binary_ = sandbox_cmd.c_str();
struct stat st;