summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/command_line.cc19
-rw-r--r--base/command_line.h12
-rw-r--r--base/command_line_unittest.cc14
-rw-r--r--base/process_util_unittest.cc8
-rw-r--r--chrome/app/chrome_main_uitest.cc6
-rw-r--r--chrome/browser/app_controller_mac.mm2
-rw-r--r--chrome/browser/browser_init_browsertest.cc2
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc4
-rw-r--r--chrome/browser/first_run_win.cc4
-rw-r--r--chrome/browser/images_uitest.cc2
-rw-r--r--chrome/browser/net/chrome_url_request_context_unittest.cc17
-rw-r--r--chrome/browser/process_singleton_win.cc3
-rw-r--r--chrome/browser/shell_integration_win.cc3
-rw-r--r--chrome/browser/user_data_manager.cc4
-rw-r--r--chrome/installer/setup/setup_util_unittest.cc3
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc2
-rw-r--r--chrome/installer/util/shell_util.cc3
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc4
-rw-r--r--chrome/test/reliability/page_load_test.cc2
-rw-r--r--chrome/test/render_view_test.cc6
-rw-r--r--chrome/test/ui/ui_test.cc13
-rw-r--r--chrome/tools/crash_service/crash_service.cc3
-rw-r--r--chrome_frame/chrome_launcher.cc3
-rw-r--r--chrome_frame/test/chrome_frame_test_utils.cc3
-rw-r--r--chrome_frame/test/net/process_singleton_subclass.cc3
-rw-r--r--net/disk_cache/stress_cache.cc2
-rw-r--r--net/socket/ssl_test_util.cc7
-rw-r--r--net/tools/crash_cache/crash_cache.cc2
-rw-r--r--net/tools/dump_cache/dump_cache.cc3
29 files changed, 71 insertions, 88 deletions
diff --git a/base/command_line.cc b/base/command_line.cc
index 1e52004..4e3bb3a 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -52,6 +52,9 @@ static void Lowercase(std::string* parameter) {
#endif
#if defined(OS_WIN)
+CommandLine::CommandLine(ArgumentsOnly args_only) {
+}
+
void CommandLine::ParseFromString(const std::wstring& command_line) {
TrimWhitespace(command_line, TRIM_ALL, &command_line_string_);
@@ -101,14 +104,12 @@ CommandLine::CommandLine(const FilePath& program) {
}
}
-// Deprecated version
-CommandLine::CommandLine(const std::wstring& program) {
- if (!program.empty()) {
- program_ = program;
- command_line_string_ = L'"' + program + L'"';
- }
-}
#elif defined(OS_POSIX)
+CommandLine::CommandLine(ArgumentsOnly args_only) {
+ // Push an empty argument, because we always assume argv_[0] is a program.
+ argv_.push_back("");
+}
+
void CommandLine::InitFromArgv(int argc, const char* const* argv) {
for (int i = 0; i < argc; ++i)
argv_.push_back(argv[i]);
@@ -145,10 +146,6 @@ CommandLine::CommandLine(const FilePath& program) {
argv_.push_back(program.value());
}
-// Deprecated version
-CommandLine::CommandLine(const std::wstring& program) {
- argv_.push_back(base::SysWideToNativeMB(program));
-}
#endif
// static
diff --git a/base/command_line.h b/base/command_line.h
index 91eb892..37a6a4e 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -32,10 +32,19 @@ class InProcessBrowserTest;
class CommandLine {
public:
+ // A constructor for CommandLines that are used only to carry arguments.
+ enum ArgumentsOnly { ARGUMENTS_ONLY };
+ explicit CommandLine(ArgumentsOnly args_only);
+
#if defined(OS_WIN)
// Initialize by parsing the given command-line string.
// The program name is assumed to be the first item in the string.
void ParseFromString(const std::wstring& command_line);
+ static CommandLine FromString(const std::wstring& command_line) {
+ CommandLine cmd;
+ cmd.ParseFromString(command_line);
+ return cmd;
+ }
#elif defined(OS_POSIX)
// Initialize from an argv vector.
void InitFromArgv(int argc, const char* const* argv);
@@ -53,9 +62,6 @@ class CommandLine {
// |program| is the name of the program to run (aka argv[0]).
explicit CommandLine(const FilePath& program);
- // Deprecated in favor of FilePath version.
- explicit CommandLine(const std::wstring& program);
-
// Initialize the current process CommandLine singleton. On Windows,
// ignores its arguments (we instead parse GetCommandLineW()
// directly) because we don't trust the CRT's parsing of the command
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index bfd0a56..7ab8f79 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -12,8 +12,8 @@
TEST(CommandLineTest, CommandLineConstructor) {
#if defined(OS_WIN)
- CommandLine cl(L"");
- cl.ParseFromString(L"program --foo= -bAr /Spaetzel=pierogi /Baz flim "
+ CommandLine cl = CommandLine::FromString(
+ L"program --foo= -bAr /Spaetzel=pierogi /Baz flim "
L"--other-switches=\"--dog=canine --cat=feline\" "
L"-spaetzle=Crepe -=loosevalue flan "
L"--input-translation=\"45\"--output-rotation "
@@ -85,7 +85,7 @@ TEST(CommandLineTest, CommandLineConstructor) {
// Tests behavior with an empty input string.
TEST(CommandLineTest, EmptyString) {
#if defined(OS_WIN)
- CommandLine cl(L"");
+ CommandLine cl = CommandLine::FromString(L"");
EXPECT_TRUE(cl.command_line_string().empty());
EXPECT_TRUE(cl.program().empty());
#elif defined(OS_POSIX)
@@ -105,13 +105,7 @@ TEST(CommandLineTest, AppendSwitches) {
std::string switch4 = "switch4";
std::wstring value4 = L"\"a value with quotes\"";
-#if defined(OS_WIN)
- CommandLine cl(L"Program");
-#elif defined(OS_POSIX)
- std::vector<std::string> argv;
- argv.push_back(std::string("Program"));
- CommandLine cl(argv);
-#endif
+ CommandLine cl(FilePath(FILE_PATH_LITERAL("Program")));
cl.AppendSwitch(switch1);
cl.AppendSwitchWithValue(switch2, value);
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 0dfcd2b..eff8fae 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -151,7 +151,7 @@ TEST_F(ProcessUtilTest, GetAppOutput) {
.Append(FILE_PATH_LITERAL("python_24"))
.Append(FILE_PATH_LITERAL("python.exe"));
- CommandLine cmd_line(python_runtime.value());
+ CommandLine cmd_line(python_runtime);
cmd_line.AppendLooseValue(L"-c");
cmd_line.AppendLooseValue(L"\"import sys; sys.stdout.write('" +
ASCIIToWide(message) + L"');\"");
@@ -160,7 +160,7 @@ TEST_F(ProcessUtilTest, GetAppOutput) {
EXPECT_EQ(message, output);
// Let's make sure stderr is ignored.
- CommandLine other_cmd_line(python_runtime.value());
+ CommandLine other_cmd_line(python_runtime);
other_cmd_line.AppendLooseValue(L"-c");
other_cmd_line.AppendLooseValue(
L"\"import sys; sys.stderr.write('Hello!');\"");
@@ -260,10 +260,10 @@ TEST_F(ProcessUtilTest, FDRemapping) {
TEST_F(ProcessUtilTest, GetAppOutput) {
std::string output;
- EXPECT_TRUE(GetAppOutput(CommandLine(L"true"), &output));
+ EXPECT_TRUE(GetAppOutput(CommandLine(FilePath("true")), &output));
EXPECT_STREQ("", output.c_str());
- EXPECT_FALSE(GetAppOutput(CommandLine(L"false"), &output));
+ EXPECT_FALSE(GetAppOutput(CommandLine(FilePath("false")), &output));
std::vector<std::string> argv;
argv.push_back("/bin/echo");
diff --git a/chrome/app/chrome_main_uitest.cc b/chrome/app/chrome_main_uitest.cc
index 48ef39e..ab79407f 100644
--- a/chrome/app/chrome_main_uitest.cc
+++ b/chrome/app/chrome_main_uitest.cc
@@ -44,7 +44,8 @@ TEST_F(ChromeMainTest, SecondLaunch) {
include_testing_id_ = false;
use_existing_browser_ = true;
- ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(CommandLine(L"")));
+ ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(
+ CommandLine(CommandLine::ARGUMENTS_ONLY)));
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, action_timeout_ms()));
}
@@ -55,9 +56,8 @@ TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) {
FilePath test_file = test_data_directory_.AppendASCII("empty.html");
- CommandLine command_line(L"");
+ CommandLine command_line(CommandLine::ARGUMENTS_ONLY);
command_line.AppendLooseValue(test_file.ToWStringHack());
-
ASSERT_TRUE(LaunchAnotherBrowserBlockUntilClosed(command_line));
ASSERT_TRUE(automation()->IsURLDisplayed(net::FilePathToFileURL(test_file)));
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index db96e05..fcbdb23 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -573,7 +573,7 @@
browser->window()->Show();
}
- CommandLine dummy((std::wstring()));
+ CommandLine dummy(CommandLine::ARGUMENTS_ONLY);
BrowserInit::LaunchWithProfile launch(std::wstring(), dummy);
launch.OpenURLsInBrowser(browser, false, urls);
}
diff --git a/chrome/browser/browser_init_browsertest.cc b/chrome/browser/browser_init_browsertest.cc
index f5337f4..5c6d60a 100644
--- a/chrome/browser/browser_init_browsertest.cc
+++ b/chrome/browser/browser_init_browsertest.cc
@@ -46,7 +46,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) {
ASSERT_EQ(popup->type(), Browser::TYPE_POPUP);
ASSERT_EQ(popup, observer.added_browser_);
- CommandLine dummy((std::wstring()));
+ CommandLine dummy(CommandLine::ARGUMENTS_ONLY);
BrowserInit::LaunchWithProfile launch(std::wstring(), dummy);
// This should create a new window, but re-use the profile from |popup|. If
// it used a NULL or invalid profile, it would crash.
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index 44c35c4..45cad68 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -1533,7 +1533,7 @@ TEST(ExtensionsServiceTestSimple, Enabledness) {
.AppendASCII(ExtensionsService::kInstallDirectoryName);
// By default, we are enabled.
- command_line.reset(new CommandLine(L""));
+ command_line.reset(new CommandLine(CommandLine::ARGUMENTS_ONLY));
service = new ExtensionsService(&profile, command_line.get(),
profile.GetPrefs(), install_dir, &loop, &loop, false);
EXPECT_TRUE(service->extensions_enabled());
@@ -1561,7 +1561,7 @@ TEST(ExtensionsServiceTestSimple, Enabledness) {
EXPECT_TRUE(recorder.ready());
recorder.set_ready(false);
- command_line.reset(new CommandLine(L""));
+ command_line.reset(new CommandLine(CommandLine::ARGUMENTS_ONLY));
service = new ExtensionsService(&profile, command_line.get(),
profile.GetPrefs(), install_dir, &loop, &loop, false);
EXPECT_FALSE(service->extensions_enabled());
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 2f608b0..6514d872 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -118,7 +118,7 @@ bool LaunchSetupWithParam(const std::string& param, const std::wstring& value,
exe_path = exe_path.Append(installer_util::kInstallerDir);
exe_path = exe_path.Append(installer_util::kSetupExe);
base::ProcessHandle ph;
- CommandLine cl(exe_path.ToWStringHack());
+ CommandLine cl(exe_path);
cl.AppendSwitchWithValue(param, value);
if (!base::LaunchApp(cl, false, false, &ph))
return false;
@@ -563,7 +563,7 @@ bool DecodeImportParams(const std::wstring& encoded,
bool FirstRun::ImportSettings(Profile* profile, int browser_type,
int items_to_import, HWND parent_window) {
const CommandLine& cmdline = *CommandLine::ForCurrentProcess();
- CommandLine import_cmd(cmdline.program());
+ CommandLine import_cmd(cmdline.GetProgram());
// Propagate user data directory switch.
if (cmdline.HasSwitch(switches::kUserDataDir)) {
import_cmd.AppendSwitchWithValue(
diff --git a/chrome/browser/images_uitest.cc b/chrome/browser/images_uitest.cc
index a9f7605..054ca6e 100644
--- a/chrome/browser/images_uitest.cc
+++ b/chrome/browser/images_uitest.cc
@@ -12,7 +12,7 @@ class ImagesTest : public UITest {
ImagesTest() : UITest() {
FilePath path(test_data_directory_);
path = path.AppendASCII("animated-gifs.html");
- launch_arguments_ = CommandLine(L"");
+ launch_arguments_ = CommandLine(CommandLine::ARGUMENTS_ONLY);
launch_arguments_.AppendLooseValue(path.ToWStringHack());
}
};
diff --git a/chrome/browser/net/chrome_url_request_context_unittest.cc b/chrome/browser/net/chrome_url_request_context_unittest.cc
index e756d79..4b70ca9 100644
--- a/chrome/browser/net/chrome_url_request_context_unittest.cc
+++ b/chrome/browser/net/chrome_url_request_context_unittest.cc
@@ -14,33 +14,34 @@
#define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc)
TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) {
+ FilePath unused_path(FILE_PATH_LITERAL("foo.exe"));
// Build the input command lines here.
- CommandLine empty(L"foo.exe");
- CommandLine no_proxy(L"foo.exe");
+ CommandLine empty(unused_path);
+ CommandLine no_proxy(unused_path);
no_proxy.AppendSwitch(switches::kNoProxyServer);
- CommandLine no_proxy_extra_params(L"foo.exe");
+ 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");
- CommandLine single_proxy(L"foo.exe");
+ CommandLine single_proxy(unused_path);
single_proxy.AppendSwitchWithValue(switches::kProxyServer,
L"http://proxy:8888");
- CommandLine per_scheme_proxy(L"foo.exe");
+ CommandLine per_scheme_proxy(unused_path);
per_scheme_proxy.AppendSwitchWithValue(switches::kProxyServer,
L"http=httpproxy:8888;ftp=ftpproxy:8889");
- CommandLine per_scheme_proxy_bypass(L"foo.exe");
+ CommandLine per_scheme_proxy_bypass(unused_path);
per_scheme_proxy_bypass.AppendSwitchWithValue(switches::kProxyServer,
L"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");
- CommandLine with_pac_url(L"foo.exe");
+ CommandLine with_pac_url(unused_path);
with_pac_url.AppendSwitchWithValue(switches::kProxyPacUrl,
L"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");
- CommandLine with_auto_detect(L"foo.exe");
+ CommandLine with_auto_detect(unused_path);
with_auto_detect.AppendSwitch(switches::kProxyAutoDetect);
// Inspired from proxy_config_service_win_unittest.cc.
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
index bf048aa..9997efd 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -231,8 +231,7 @@ LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) {
const std::wstring cmd_line =
msg.substr(second_null + 1, third_null - second_null);
- CommandLine parsed_command_line(L"");
- parsed_command_line.ParseFromString(cmd_line);
+ CommandLine parsed_command_line = CommandLine::FromString(cmd_line);
PrefService* prefs = g_browser_process->local_state();
DCHECK(prefs);
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index cebc421..f52a434 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -111,8 +111,7 @@ ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() {
if (!key.Valid() || !key.ReadValue(L"", &value))
return UNKNOWN_DEFAULT_BROWSER;
// Need to normalize path in case it's been munged.
- CommandLine command_line(L"");
- command_line.ParseFromString(value);
+ CommandLine command_line = CommandLine::FromString(value);
std::wstring short_path;
GetShortPathName(command_line.program().c_str(),
WriteInto(&short_path, MAX_PATH), MAX_PATH);
diff --git a/chrome/browser/user_data_manager.cc b/chrome/browser/user_data_manager.cc
index 37aa55c..5e9e0e6 100644
--- a/chrome/browser/user_data_manager.cc
+++ b/chrome/browser/user_data_manager.cc
@@ -188,8 +188,8 @@ std::wstring UserDataManager::GetUserDataFolderForProfile(
void UserDataManager::LaunchChromeForProfile(
const std::wstring& profile_name) const {
std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name);
- std::wstring command;
- DeprecatedPathServiceGet(base::FILE_EXE, &command);
+ FilePath command;
+ PathService::Get(base::FILE_EXE, &command);
CommandLine command_line(command);
command_line.AppendSwitch(switches::kEnableUserDataDirProfiles);
command_line.AppendSwitchWithValue(switches::kUserDataDir,
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc
index 44af7fc..e0f87ae 100644
--- a/chrome/installer/setup/setup_util_unittest.cc
+++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -86,8 +86,7 @@ TEST_F(SetupUtilTest, GetInstallPreferencesTest) {
cmd_str.append(L" --create-all-shortcuts");
cmd_str.append(L" --do-not-launch-chrome");
cmd_str.append(L" --alt-desktop-shortcut");
- CommandLine cmd_line(L"");
- cmd_line.ParseFromString(cmd_str);
+ CommandLine cmd_line = CommandLine::FromString(cmd_str);
scoped_ptr<DictionaryValue> prefs(
setup_util::GetInstallPreferences(cmd_line));
EXPECT_TRUE(prefs.get() != NULL);
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 3dd8699..e4ee42b 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -105,7 +105,7 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) {
// Launches again this same process with a single switch --|flag|=|value|.
// Does not wait for the process to terminate.
bool RelaunchSetup(const std::wstring& flag, int value) {
- CommandLine cmd_line(CommandLine::ForCurrentProcess()->program());
+ CommandLine cmd_line(CommandLine::ForCurrentProcess()->GetProgram());
// TODO: make switches into ASCII.
cmd_line.AppendSwitchWithValue(WideToASCII(flag), IntToWString(value));
return base::LaunchApp(cmd_line, false, false, NULL);
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 8e00ba2..6982fa7 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -301,8 +301,7 @@ bool ElevateAndRegisterChrome(const std::wstring& chrome_exe,
HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
RegKey key(reg_root, dist->GetUninstallRegPath().c_str());
key.ReadValue(installer_util::kUninstallStringField, &exe_path);
- CommandLine command_line(L"");
- command_line.ParseFromString(exe_path);
+ CommandLine command_line = CommandLine::FromString(exe_path);
exe_path = command_line.program();
}
if (file_util::PathExists(FilePath::FromWStringHack(exe_path))) {
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index a8d29b0..6187dfb 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -389,7 +389,7 @@ class AutomationProxyTest2 : public AutomationProxyVisibleTest {
document1_= test_data_directory_.AppendASCII("title1.html");
document2_ = test_data_directory_.AppendASCII("title2.html");
- launch_arguments_ = CommandLine(L"");
+ launch_arguments_ = CommandLine(CommandLine::ARGUMENTS_ONLY);
launch_arguments_.AppendLooseValue(document1_.ToWStringHack());
launch_arguments_.AppendLooseValue(document2_.ToWStringHack());
}
@@ -570,7 +570,7 @@ class AutomationProxyTest3 : public UITest {
document1_ = document1_.AppendASCII("frame_dom_access.html");
dom_automation_enabled_ = true;
- launch_arguments_ = CommandLine(L"");
+ launch_arguments_ = CommandLine(CommandLine::ARGUMENTS_ONLY);
launch_arguments_.AppendLooseValue(document1_.ToWStringHack());
}
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index a5e6625..4df7423 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -726,7 +726,7 @@ void SetPageRange(const CommandLine& parsed_command_line) {
// The command line switch may override the default v8 log path.
if (parsed_command_line.HasSwitch(switches::kJavaScriptFlags)) {
CommandLine v8_command_line(
- parsed_command_line.GetSwitchValue(switches::kJavaScriptFlags));
+ parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags));
if (v8_command_line.HasSwitch(kV8LogFileSwitch)) {
g_v8_log_path = FilePath::FromWStringHack(
v8_command_line.GetSwitchValue(kV8LogFileSwitch));
diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc
index f80c845..ccd7da5 100644
--- a/chrome/test/render_view_test.cc
+++ b/chrome/test/render_view_test.cc
@@ -61,11 +61,7 @@ void RenderViewTest::LoadHTML(const char* html) {
void RenderViewTest::SetUp() {
sandbox_init_wrapper_.reset(new SandboxInitWrapper());
-#if defined(OS_WIN)
- command_line_.reset(new CommandLine(std::wstring()));
-#elif defined(OS_POSIX)
- command_line_.reset(new CommandLine(std::vector<std::string>()));
-#endif
+ command_line_.reset(new CommandLine(CommandLine::ARGUMENTS_ONLY));
params_.reset(new MainFunctionParams(*command_line_, *sandbox_init_wrapper_,
NULL));
platform_.reset(new RendererMainPlatformDelegate(*params_));
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 725092a..e9ca10e 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -97,7 +97,7 @@ const char kEnableErrorDialogs[] = "enable-errdialogs";
UITest::UITest()
: testing::Test(),
- launch_arguments_(L""),
+ launch_arguments_(CommandLine::ARGUMENTS_ONLY),
expected_errors_(0),
expected_crashes_(0),
homepage_(L"about:blank"),
@@ -257,9 +257,9 @@ static CommandLine* CreatePythonCommandLine() {
.Append(FILE_PATH_LITERAL("third_party"))
.Append(FILE_PATH_LITERAL("python_24"))
.Append(FILE_PATH_LITERAL("python.exe"));
- return new CommandLine(python_runtime.ToWStringHack());
+ return new CommandLine(python_runtime);
#elif defined(OS_POSIX)
- return new CommandLine(L"python");
+ return new CommandLine(FilePath("python"));
#endif
}
@@ -1010,10 +1010,9 @@ bool UITest::LaunchBrowserHelper(const CommandLine& arguments,
bool use_existing_browser,
bool wait,
base::ProcessHandle* process) {
- FilePath command = browser_directory_;
- command = command.Append(FilePath::FromWStringHack(
- chrome::kBrowserProcessExecutablePath));
- CommandLine command_line(command.ToWStringHack());
+ FilePath command = browser_directory_.Append(
+ FilePath::FromWStringHack(chrome::kBrowserProcessExecutablePath));
+ CommandLine command_line(command);
// Add any explicit command line flags passed to the process.
std::wstring extra_chrome_flags =
diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc
index 058c40a..ddc7598 100644
--- a/chrome/tools/crash_service/crash_service.cc
+++ b/chrome/tools/crash_service/crash_service.cc
@@ -194,8 +194,7 @@ bool CrashService::Initialize(const std::wstring& command_line) {
return false;
}
- CommandLine cmd_line(L"");
- cmd_line.ParseFromString(command_line);
+ CommandLine cmd_line = CommandLine::FromString(command_line);
// We can override the send reports quota with a command line switch.
if (cmd_line.HasSwitch(kMaxReports))
diff --git a/chrome_frame/chrome_launcher.cc b/chrome_frame/chrome_launcher.cc
index d7cca9c..1f9f0d1 100644
--- a/chrome_frame/chrome_launcher.cc
+++ b/chrome_frame/chrome_launcher.cc
@@ -80,8 +80,7 @@ void SanitizeCommandLine(const CommandLine& original, CommandLine* sanitized) {
bool SanitizeAndLaunchChrome(const wchar_t* command_line) {
std::wstring command_line_with_program(L"dummy.exe ");
command_line_with_program += command_line;
- CommandLine original(L"");
- original.ParseFromString(command_line_with_program);
+ CommandLine original = CommandLine::FromString(command_line_with_program);
CommandLine sanitized(GetChromeExecutablePath());
SanitizeCommandLine(original, &sanitized);
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc
index a75d791..7d2d67b 100644
--- a/chrome_frame/test/chrome_frame_test_utils.cc
+++ b/chrome_frame/test/chrome_frame_test_utils.cc
@@ -322,8 +322,7 @@ base::ProcessHandle LaunchExecutable(const std::wstring& executable,
if (path.empty()) {
DLOG(ERROR) << "Failed to find executable: " << executable;
} else {
- CommandLine cmdline(L"");
- cmdline.ParseFromString(path);
+ CommandLine cmdline = CommandLine::FromString(path);
base::LaunchApp(cmdline, false, false, &process);
}
} else {
diff --git a/chrome_frame/test/net/process_singleton_subclass.cc b/chrome_frame/test/net/process_singleton_subclass.cc
index 2206a74..91a3bef 100644
--- a/chrome_frame/test/net/process_singleton_subclass.cc
+++ b/chrome_frame/test/net/process_singleton_subclass.cc
@@ -99,8 +99,7 @@ LRESULT ProcessSingletonSubclass::OnCopyData(HWND hwnd, HWND from_hwnd,
// Get command line.
std::wstring cmd_line(begin, static_cast<size_t>(end - begin));
- CommandLine parsed_command_line(L"");
- parsed_command_line.ParseFromString(cmd_line);
+ CommandLine parsed_command_line = CommandLine::FromString(cmd_line);
std::string channel_id(WideToASCII(parsed_command_line.GetSwitchValue(
switches::kAutomationClientChannelID)));
EXPECT_FALSE(channel_id.empty());
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index 62b1aba..67c396c 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -39,7 +39,7 @@ int RunSlave(int iteration) {
FilePath exe;
PathService::Get(base::FILE_EXE, &exe);
- CommandLine cmdline(exe.ToWStringHack());
+ CommandLine cmdline(exe);
cmdline.AppendLooseValue(ASCIIToWide(IntToString(iteration)));
base::ProcessHandle handle;
diff --git a/net/socket/ssl_test_util.cc b/net/socket/ssl_test_util.cc
index c0ef832..a58863e 100644
--- a/net/socket/ssl_test_util.cc
+++ b/net/socket/ssl_test_util.cc
@@ -277,14 +277,13 @@ bool TestServerLauncher::Start(Protocol protocol,
#elif defined(OS_POSIX)
std::vector<std::string> command_line;
command_line.push_back("python");
- command_line.push_back(WideToUTF8(testserver_path.ToWStringHack()));
+ command_line.push_back(testserver_path.value());
command_line.push_back("--port=" + port_str);
- command_line.push_back("--data-dir=" +
- WideToUTF8(document_root_dir_.ToWStringHack()));
+ command_line.push_back("--data-dir=" + document_root_dir_.value());
if (protocol == ProtoFTP)
command_line.push_back("-f");
if (!cert_path.value().empty())
- command_line.push_back("--https=" + WideToUTF8(cert_path.ToWStringHack()));
+ command_line.push_back("--https=" + cert_path.value());
if (forking_)
command_line.push_back("--forking");
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc
index 8aa7f65..4686d13 100644
--- a/net/tools/crash_cache/crash_cache.cc
+++ b/net/tools/crash_cache/crash_cache.cc
@@ -40,7 +40,7 @@ int RunSlave(RankCrashes action) {
FilePath exe;
PathService::Get(base::FILE_EXE, &exe);
- CommandLine cmdline(exe.ToWStringHack());
+ CommandLine cmdline(exe);
cmdline.AppendLooseValue(ASCIIToWide(IntToString(action)));
base::ProcessHandle handle;
diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc
index 8a84b91..8e6084e 100644
--- a/net/tools/dump_cache/dump_cache.cc
+++ b/net/tools/dump_cache/dump_cache.cc
@@ -90,8 +90,7 @@ int LaunchSlave(const CommandLine& command_line,
hacked_command_line.insert(to_remove, new_program);
- CommandLine new_command_line(L"");
- new_command_line.ParseFromString(hacked_command_line);
+ CommandLine new_command_line = CommandLine::FromString(hacked_command_line);
if (do_upgrade || do_convert_to_text)
new_command_line.AppendSwitch(kSlave);