diff options
Diffstat (limited to 'chrome')
28 files changed, 144 insertions, 126 deletions
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index d38636f..06d4a3c 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -274,8 +274,8 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, FilePath inner_html; if (WriteEULAtoTempFile(&inner_html)) { int retcode = 0; - const std::string eula = WideToASCII(installer_util::switches::kShowEula); - if (!LaunchSetupWithParam(eula, inner_html.ToWStringHack(), &retcode) || + if (!LaunchSetupWithParam(installer_util::switches::kShowEula, + inner_html.ToWStringHack(), &retcode) || (retcode == installer_util::EULA_REJECTED)) { LOG(WARNING) << "EULA rejected. Fast exit."; ::ExitProcess(1); diff --git a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc index 9cc1b53..f763b51c 100644 --- a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc +++ b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc @@ -345,8 +345,9 @@ TEST(SafeBrowsingBloomFilter, HashTime) { int num_checks = kNumHashChecks; if (cmd_line.HasSwitch(kFilterNumChecks)) { - ASSERT_TRUE(base::StringToInt(cmd_line.GetSwitchValue(kFilterNumChecks), - &num_checks)); + ASSERT_TRUE( + base::StringToInt(cmd_line.GetSwitchValueASCII(kFilterNumChecks), + &num_checks)); } // Populate the bloom filter and measure the time. diff --git a/chrome/common/chrome_plugin_util.cc b/chrome/common/chrome_plugin_util.cc index 33b8345..649975f 100644 --- a/chrome/common/chrome_plugin_util.cc +++ b/chrome/common/chrome_plugin_util.cc @@ -141,11 +141,11 @@ CPError CPB_GetCommandLineArgumentsCommon(const char* url, } } -#if defined (OS_CHROMEOS) - std::wstring profile = cmd.GetSwitchValue(switches::kLoginProfile); +#if defined(OS_CHROMEOS) + FilePath profile = cmd.GetSwitchValuePath(switches::kLoginProfile); if (!profile.empty()) { arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kLoginProfile) + - L"=\"" + profile + L"\" "; + L"=\"" + profile.ToWStringHack() + L"\" "; } #endif diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc index 0a39bc2..7caf9c9 100644 --- a/chrome/common/pepper_plugin_registry.cc +++ b/chrome/common/pepper_plugin_registry.cc @@ -54,8 +54,9 @@ void PepperPluginRegistry::PreloadModules() { // static void PepperPluginRegistry::GetPluginInfoFromSwitch( std::vector<PepperPluginInfo>* plugins) { - const std::wstring& value = CommandLine::ForCurrentProcess()->GetSwitchValue( - switches::kRegisterPepperPlugins); + const std::string value = + CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kRegisterPepperPlugins); if (value.empty()) return; @@ -64,27 +65,34 @@ void PepperPluginRegistry::GetPluginInfoFromSwitch( // plugin-entry = <file-path> + ["#" + <name> + ["#" + <description>]] + // *1( LWS + ";" + LWS + <mime-type> ) - std::vector<std::wstring> modules; + std::vector<std::string> modules; SplitString(value, ',', &modules); for (size_t i = 0; i < modules.size(); ++i) { - std::vector<std::wstring> parts; + std::vector<std::string> parts; SplitString(modules[i], ';', &parts); if (parts.size() < 2) { DLOG(ERROR) << "Required mime-type not found"; continue; } - std::vector<std::wstring> name_parts; + std::vector<std::string> name_parts; SplitString(parts[0], '#', &name_parts); PepperPluginInfo plugin; - plugin.path = FilePath::FromWStringHack(name_parts[0]); +#if defined(OS_WIN) + // This means we can't provide plugins from non-ASCII paths, but + // since this switch is only for development I don't think that's + // too awful. + plugin.path = FilePath(ASCIIToUTF16(name_parts[0])); +#else + plugin.path = FilePath(name_parts[0]); +#endif if (name_parts.size() > 1) - plugin.name = WideToUTF8(name_parts[1]); + plugin.name = name_parts[1]; if (name_parts.size() > 2) - plugin.type_descriptions = WideToUTF8(name_parts[2]); + plugin.type_descriptions = name_parts[2]; for (size_t j = 1; j < parts.size(); ++j) - plugin.mime_types.push_back(WideToASCII(parts[j])); + plugin.mime_types.push_back(parts[j]); plugins->push_back(plugin); } diff --git a/chrome/common/sandbox_init_wrapper_mac.cc b/chrome/common/sandbox_init_wrapper_mac.cc index 1b8e2d9..79cf08f 100644 --- a/chrome/common/sandbox_init_wrapper_mac.cc +++ b/chrome/common/sandbox_init_wrapper_mac.cc @@ -41,8 +41,8 @@ bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, } else if (process_type == switches::kUtilityProcess) { // Utility process sandbox. sandbox_process_type = sandbox::SANDBOX_TYPE_UTILITY; - allowed_dir = FilePath::FromWStringHack( - command_line.GetSwitchValue(switches::kUtilityProcessAllowedDir)); + allowed_dir = + command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); } else if (process_type == switches::kWorkerProcess) { // Worker process sandbox. sandbox_process_type = sandbox::SANDBOX_TYPE_WORKER; diff --git a/chrome/common/sandbox_policy.cc b/chrome/common/sandbox_policy.cc index b93f5a2..2f649c5 100644 --- a/chrome/common/sandbox_policy.cc +++ b/chrome/common/sandbox_policy.cc @@ -340,9 +340,9 @@ bool ApplyPolicyForBuiltInFlashPlugin(sandbox::TargetPolicy* policy) { bool AddPolicyForPlugin(const CommandLine* cmd_line, sandbox::TargetPolicy* policy) { std::wstring plugin_dll = cmd_line-> - GetSwitchValue(switches::kPluginPath); + GetSwitchValueNative(switches::kPluginPath); std::wstring trusted_plugins = CommandLine::ForCurrentProcess()-> - GetSwitchValue(switches::kTrustedPlugins); + GetSwitchValueNative(switches::kTrustedPlugins); // Add the policy for the pipes. sandbox::ResultCode result = sandbox::SBOX_ALL_OK; result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index c6e8c60..41b1c95 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -231,7 +231,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, // If --install-archive is given, get the user specified value if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) { - archive = cmd_line.GetSwitchValue( + archive = cmd_line.GetSwitchValueNative( installer_util::switches::kInstallArchive); } LOG(INFO) << "Archive found to install Chrome " << archive; @@ -287,7 +287,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, // uncompressing and binary patching. Get the location for this file. std::wstring archive_to_copy(temp_path.ToWStringHack()); file_util::AppendToPath(&archive_to_copy, installer::kChromeArchive); - std::wstring prefs_source_path = cmd_line.GetSwitchValue( + std::wstring prefs_source_path = cmd_line.GetSwitchValueNative( installer_util::switches::kInstallerData); install_status = installer::InstallOrUpdateChrome( cmd_line.program(), archive_to_copy, temp_path.ToWStringHack(), @@ -354,7 +354,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, LOG(INFO) << "Deleting temporary directory " << temp_path.value(); bool cleanup_success = file_util::Delete(temp_path, true); if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { - std::wstring prefs_path = cmd_line.GetSwitchValue( + std::wstring prefs_path = cmd_line.GetSwitchValueNative( installer_util::switches::kInstallerData); cleanup_success = file_util::Delete(prefs_path, true) && cleanup_success; } @@ -368,7 +368,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, if (!cleanup_success) { ScheduleDirectoryForDeletion(temp_path.ToWStringHack().c_str()); if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { - std::wstring prefs_path = cmd_line.GetSwitchValue( + std::wstring prefs_path = cmd_line.GetSwitchValueNative( installer_util::switches::kInstallerData); ScheduleDirectoryForDeletion(prefs_path.c_str()); } @@ -446,14 +446,14 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { LOG(ERROR) << "Could not create temporary path."; } else { - std::wstring setup_patch = cmd_line.GetSwitchValue( + std::wstring setup_patch = cmd_line.GetSwitchValueNative( installer_util::switches::kUpdateSetupExe); LOG(INFO) << "Opening archive " << setup_patch; std::wstring uncompressed_patch; if (LzmaUtil::UnPackArchive(setup_patch, temp_path.ToWStringHack(), &uncompressed_patch) == NO_ERROR) { std::wstring old_setup_exe = cmd_line.program(); - std::wstring new_setup_exe = cmd_line.GetSwitchValue( + std::wstring new_setup_exe = cmd_line.GetSwitchValueNative( installer_util::switches::kNewSetupExe); if (!setup_util::ApplyDiffPatch(old_setup_exe, uncompressed_patch, new_setup_exe)) @@ -473,7 +473,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, // Check if we need to show the EULA. If it is passed as a command line // then the dialog is shown and regardless of the outcome setup exits here. std::wstring inner_frame = - cmd_line.GetSwitchValue(installer_util::switches::kShowEula); + cmd_line.GetSwitchValueNative(installer_util::switches::kShowEula); exit_code = ShowEULADialog(inner_frame); if (installer_util::EULA_REJECTED != exit_code) GoogleUpdateSettings::SetEULAConsent(true); @@ -485,12 +485,12 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, // browser for Start Menu->Internet shortcut. This option should only // be used when setup.exe is launched with admin rights. We do not // make any user specific changes in this option. - std::wstring chrome_exe(cmd_line.GetSwitchValue( + std::wstring chrome_exe(cmd_line.GetSwitchValueNative( installer_util::switches::kRegisterChromeBrowser)); std::wstring suffix; if (cmd_line.HasSwitch( installer_util::switches::kRegisterChromeBrowserSuffix)) { - suffix = cmd_line.GetSwitchValue( + suffix = cmd_line.GetSwitchValueNative( installer_util::switches::kRegisterChromeBrowserSuffix); } exit_code = ShellUtil::RegisterChromeBrowser(chrome_exe, suffix, false); @@ -509,7 +509,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, std::wstring suffix; if (cmd_line.HasSwitch( installer_util::switches::kRegisterChromeBrowserSuffix)) { - suffix = cmd_line.GetSwitchValue( + suffix = cmd_line.GetSwitchValueNative( installer_util::switches::kRegisterChromeBrowserSuffix); } installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS; @@ -519,8 +519,8 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, return true; } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { // Launch the inactive user toast experiment. - std::wstring flavor = - cmd_line.GetSwitchValue(installer_util::switches::kInactiveUserToast); + std::string flavor = cmd_line.GetSwitchValueASCII( + installer_util::switches::kInactiveUserToast); int flavor_int; base::StringToInt(flavor, &flavor_int); dist->InactiveUserToastExperiment(flavor_int, diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index bbee52e..ff3eac9 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -469,7 +469,8 @@ installer_util::InstallStatus installer_setup::UninstallChrome( params.append(installer_util::switches::kRemoveChromeRegistration); if (!suffix.empty()) { params.append(L" --"); - params.append(installer_util::switches::kRegisterChromeBrowserSuffix); + params.append(ASCIIToWide( + installer_util::switches::kRegisterChromeBrowserSuffix)); params.append(L"=\"" + suffix + L"\""); } DWORD exit_code = installer_util::UNKNOWN_STATUS; diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 15e1d2a..8a2069d 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -129,10 +129,10 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) { // Launches again this same process with switch --|flag|=|value|. // If system_level_toast is true, appends --system-level-toast. // Does not wait for the process to terminate. -bool RelaunchSetup(const std::wstring& flag, int value, +bool RelaunchSetup(const std::string& flag, int value, bool system_level_toast) { CommandLine cmd_line(CommandLine::ForCurrentProcess()->GetProgram()); - cmd_line.AppendSwitchASCII(WideToASCII(flag), base::IntToString(value)); + cmd_line.AppendSwitchASCII(flag, base::IntToString(value)); if (system_level_toast) cmd_line.AppendSwitch( WideToASCII(installer_util::switches::kSystemLevelToast)); diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 3f11eb5..9dfda73 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -29,7 +29,7 @@ void InitInstallerLogging(const CommandLine& command_line) { return; } - logging::InitLogging(GetLogFilePath(command_line).c_str(), + logging::InitLogging(GetLogFilePath(command_line).value().c_str(), logging::LOG_ONLY_TO_FILE, logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE); @@ -50,10 +50,10 @@ void EndInstallerLogging() { installer_logging_ = false; } -std::wstring GetLogFilePath(const CommandLine& command_line) { +FilePath GetLogFilePath(const CommandLine& command_line) { if (command_line.HasSwitch( WideToASCII(installer_util::switches::kLogFile))) { - return command_line.GetSwitchValue( + return command_line.GetSwitchValuePath( WideToASCII(installer_util::switches::kLogFile)); } @@ -65,12 +65,11 @@ std::wstring GetLogFilePath(const CommandLine& command_line) { } FilePath log_path; - if (PathService::Get(base::DIR_TEMP, &log_path)) { log_path = log_path.Append(log_filename); - return log_path.ToWStringHack(); + return log_path; } else { - return log_filename; + return FilePath(log_filename); } } diff --git a/chrome/installer/util/logging_installer.h b/chrome/installer/util/logging_installer.h index c2b0a96..50882dc 100644 --- a/chrome/installer/util/logging_installer.h +++ b/chrome/installer/util/logging_installer.h @@ -11,6 +11,7 @@ #include "base/logging.h" class CommandLine; +class FilePath; namespace installer { @@ -21,7 +22,7 @@ void InitInstallerLogging(const CommandLine& command_line); void EndInstallerLogging(); // Returns the full path of the log file. -std::wstring GetLogFilePath(const CommandLine& command_line); +FilePath GetLogFilePath(const CommandLine& command_line); } // namespace installer diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 053dc45..293d35b 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -7,6 +7,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" +#include "base/string_util.h" #include "chrome/common/json_value_serializer.h" #include "chrome/installer/util/util_constants.h" #include "googleurl/src/gurl.h" @@ -106,8 +107,8 @@ DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line) { DictionaryValue* prefs = NULL; #if defined(OS_WIN) if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { - FilePath prefs_path( - cmd_line.GetSwitchValue(installer_util::switches::kInstallerData)); + FilePath prefs_path = cmd_line.GetSwitchValuePath( + installer_util::switches::kInstallerData); prefs = installer_util::ParseDistributionPreferences(prefs_path); } diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 66b6382..56685ad 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -309,11 +309,13 @@ bool ElevateAndRegisterChrome(const std::wstring& chrome_exe, } if (file_util::PathExists(FilePath::FromWStringHack(exe_path))) { std::wstring params(L"--"); - params.append(installer_util::switches::kRegisterChromeBrowser); + params.append( + ASCIIToWide(installer_util::switches::kRegisterChromeBrowser)); params.append(L"=\"" + chrome_exe + L"\""); if (!suffix.empty()) { params.append(L" --"); - params.append(installer_util::switches::kRegisterChromeBrowserSuffix); + params.append(ASCIIToWide( + installer_util::switches::kRegisterChromeBrowserSuffix)); params.append(L"=\"" + suffix + L"\""); } diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index d7e7d3d..d6b4efe 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -48,10 +48,10 @@ const wchar_t kEnableLogging[] = L"enable-logging"; const wchar_t kForceUninstall[] = L"force-uninstall"; // Specify the file path of Chrome archive for install. -const wchar_t kInstallArchive[] = L"install-archive"; +const char kInstallArchive[] = "install-archive"; // Specify the file path of Chrome master preference file. -const wchar_t kInstallerData[] = L"installerdata"; +const char kInstallerData[] = "installerdata"; // If present, specify file path to write logging info. const wchar_t kLogFile[] = L"log-file"; @@ -67,15 +67,15 @@ const wchar_t kMsi[] = L"msi"; // Useful only when used with --update-setup-exe, otherwise ignored. It // specifies the full path where updated setup.exe will be stored. -const wchar_t kNewSetupExe[] = L"new-setup-exe"; +const char kNewSetupExe[] = "new-setup-exe"; // Register Chrome as a valid browser on the current sytem. This option // requires that setup.exe is running as admin. If this option is specified, // options kInstallArchive and kUninstall are ignored. -const wchar_t kRegisterChromeBrowser[] = L"register-chrome-browser"; +const char kRegisterChromeBrowser[] = "register-chrome-browser"; -const wchar_t kRegisterChromeBrowserSuffix[] = - L"register-chrome-browser-suffix"; +const char kRegisterChromeBrowserSuffix[] = + "register-chrome-browser-suffix"; // Renames chrome.exe to old_chrome.exe and renames new_chrome.exe to chrome.exe // to support in-use updates. Also deletes opv key. @@ -97,19 +97,19 @@ const wchar_t kUninstall[] = L"uninstall"; // Also see --new-setup-exe. This command line option specifies a diff patch // that setup.exe will apply to itself and store the resulting binary in the // path given by --new-setup-exe. -const wchar_t kUpdateSetupExe[] = L"update-setup-exe"; +const char kUpdateSetupExe[] = "update-setup-exe"; // Enable verbose logging (info level). const wchar_t kVerboseLogging[] = L"verbose-logging"; // Show the embedded EULA dialog. -const wchar_t kShowEula[] = L"show-eula"; +const char kShowEula[] = "show-eula"; // Use the alternate desktop shortcut name. const wchar_t kAltDesktopShortcut[] = L"alt-desktop-shortcut"; // Perform the inactive user toast experiment. -const wchar_t kInactiveUserToast[] = L"inactive-user-toast"; +const char kInactiveUserToast[] = "inactive-user-toast"; // User toast experiment switch from system context to user context. const wchar_t kSystemLevelToast[] = L"system-level-toast"; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index ddecd71..8501c03 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -62,24 +62,24 @@ extern const wchar_t kDoNotRegisterForUpdateLaunch[]; extern const wchar_t kDoNotRemoveSharedItems[]; extern const wchar_t kEnableLogging[]; extern const wchar_t kForceUninstall[]; -extern const wchar_t kInstallArchive[]; -extern const wchar_t kInstallerData[]; +extern const char kInstallArchive[]; +extern const char kInstallerData[]; extern const wchar_t kLogFile[]; extern const wchar_t kMakeChromeDefault[]; extern const wchar_t kMsi[]; -extern const wchar_t kNewSetupExe[]; -extern const wchar_t kRegisterChromeBrowser[]; -extern const wchar_t kRegisterChromeBrowserSuffix[]; +extern const char kNewSetupExe[]; +extern const char kRegisterChromeBrowser[]; +extern const char kRegisterChromeBrowserSuffix[]; extern const wchar_t kRenameChromeExe[]; extern const wchar_t kRemoveChromeRegistration[]; extern const wchar_t kRunAsAdmin[]; extern const wchar_t kSystemLevel[]; extern const wchar_t kUninstall[]; -extern const wchar_t kUpdateSetupExe[]; +extern const char kUpdateSetupExe[]; extern const wchar_t kVerboseLogging[]; -extern const wchar_t kShowEula[]; +extern const char kShowEula[]; extern const wchar_t kAltDesktopShortcut[]; -extern const wchar_t kInactiveUserToast[]; +extern const char kInactiveUserToast[]; extern const wchar_t kSystemLevelToast[]; } // namespace switches diff --git a/chrome/nacl/nacl_main_platform_delegate_win.cc b/chrome/nacl/nacl_main_platform_delegate_win.cc index df01489..3cf140ca 100644 --- a/chrome/nacl/nacl_main_platform_delegate_win.cc +++ b/chrome/nacl/nacl_main_platform_delegate_win.cc @@ -34,7 +34,7 @@ void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { if (target_services && !no_sandbox) { std::wstring test_dll_name = - command_line.GetSwitchValue(switches::kTestNaClSandbox); + command_line.GetSwitchValueNative(switches::kTestNaClSandbox); if (!test_dll_name.empty()) { // At this point, hack on the suffix according to with bitness // of your windows process. diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc index 2f16e63..8313b68 100644 --- a/chrome/plugin/plugin_main.cc +++ b/chrome/plugin/plugin_main.cc @@ -94,7 +94,7 @@ int PluginMain(const MainFunctionParams& parameters) { // The command line might specify a test plugin to load. if (parsed_command_line.HasSwitch(switches::kTestSandbox)) { std::wstring test_plugin_name = - parsed_command_line.GetSwitchValue(switches::kTestSandbox); + parsed_command_line.GetSwitchValueNative(switches::kTestSandbox); sandbox_test_module = LoadLibrary(test_plugin_name.c_str()); DCHECK(sandbox_test_module); } diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 9bc8561..acf83b1 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -165,9 +165,8 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, } const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - FilePath path = FilePath::FromWStringHack( - command_line.GetSwitchValue(switches::kPluginPath)); - + FilePath path = + command_line.GetSwitchValuePath(switches::kPluginPath); gfx::PluginWindowHandle parent = gfx::kNullPluginWindow; #if defined(OS_WIN) diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc index 2673fb9..0e544ad 100644 --- a/chrome/renderer/devtools_client.cc +++ b/chrome/renderer/devtools_client.cc @@ -24,7 +24,7 @@ DevToolsClient::DevToolsClient(RenderView* view) WebDevToolsFrontend::create( view->webview(), this, - WideToUTF16Hack(command_line.GetSwitchValue(switches::kLang)))); + ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); } DevToolsClient::~DevToolsClient() { diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index daf873a..5339708 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -255,8 +255,8 @@ int RendererMain(const MainFunctionParams& parameters) { FieldTrialList field_trial; // Ensure any field trials in browser are reflected into renderer. if (parsed_command_line.HasSwitch(switches::kForceFieldTestNameAndValue)) { - std::string persistent(WideToASCII(parsed_command_line.GetSwitchValue( - switches::kForceFieldTestNameAndValue))); + std::string persistent = parsed_command_line.GetSwitchValueASCII( + switches::kForceFieldTestNameAndValue); bool ret = field_trial.StringAugmentsState(persistent); DCHECK(ret); } diff --git a/chrome/renderer/renderer_main_platform_delegate_win.cc b/chrome/renderer/renderer_main_platform_delegate_win.cc index d5cca59..104eba5 100644 --- a/chrome/renderer/renderer_main_platform_delegate_win.cc +++ b/chrome/renderer/renderer_main_platform_delegate_win.cc @@ -102,7 +102,7 @@ bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { if (target_services && !no_sandbox) { std::wstring test_dll_name = - command_line.GetSwitchValue(switches::kTestSandbox); + command_line.GetSwitchValueNative(switches::kTestSandbox); if (!test_dll_name.empty()) { sandbox_test_module_ = LoadLibrary(test_dll_name.c_str()); DCHECK(sandbox_test_module_); diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc index 6d877dc..8903517 100644 --- a/chrome/test/mini_installer_test/test.cc +++ b/chrome/test/mini_installer_test/test.cc @@ -53,7 +53,8 @@ class MiniInstallTest : public testing::Test { virtual void SetUp() { // Parse test command-line arguments. const CommandLine* cmd = CommandLine::ForCurrentProcess(); - std::wstring build = cmd->GetSwitchValue(switches::kInstallerTestBuild); + std::wstring build = + cmd->GetSwitchValueNative(switches::kInstallerTestBuild); if (build.empty()) build = L"latest"; force_tests_ = cmd->HasSwitch(switches::kInstallerTestForce); diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index abf83ca..4c77378 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -628,11 +628,13 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kStartPageSwitch)) { ASSERT_TRUE(parsed_command_line.HasSwitch(kEndPageSwitch)); ASSERT_TRUE( - base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( - kStartPageSwitch)), &g_start_page)); + base::StringToInt(parsed_command_line.GetSwitchValueASCII( + kStartPageSwitch), + &g_start_page)); ASSERT_TRUE( - base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( - kEndPageSwitch)), &g_end_page)); + base::StringToInt(parsed_command_line.GetSwitchValueASCII( + kEndPageSwitch), + &g_end_page)); ASSERT_TRUE(g_start_page > 0 && g_end_page > 0); ASSERT_TRUE(g_start_page < g_end_page); g_append_page_id = true; @@ -641,20 +643,22 @@ void SetPageRange(const CommandLine& parsed_command_line) { } if (parsed_command_line.HasSwitch(kSiteSwitch)) { - g_server_url = WideToUTF8(parsed_command_line.GetSwitchValue(kSiteSwitch)); + g_server_url = parsed_command_line.GetSwitchValueASCII(kSiteSwitch); } if (parsed_command_line.HasSwitch(kStartIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( - kStartIndexSwitch)), &g_start_index)); + base::StringToInt(parsed_command_line.GetSwitchValueASCII( + kStartIndexSwitch), + &g_start_index)); ASSERT_GT(g_start_index, 0); } if (parsed_command_line.HasSwitch(kEndIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( - kEndIndexSwitch)), &g_end_index)); + base::StringToInt(parsed_command_line.GetSwitchValueASCII( + kEndIndexSwitch), + &g_end_index)); ASSERT_GT(g_end_index, 0); } @@ -665,8 +669,9 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kIterationSwitch)) { ASSERT_TRUE( - base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( - kIterationSwitch)), &g_iterations)); + base::StringToInt(parsed_command_line.GetSwitchValueASCII( + kIterationSwitch), + &g_iterations)); ASSERT_GT(g_iterations, 0); } @@ -676,18 +681,17 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kContinuousLoadSwitch)) g_continuous_load = true; - if (parsed_command_line.HasSwitch(kEndURLSwitch)) { - g_end_url = WideToUTF8( - parsed_command_line.GetSwitchValue(kEndURLSwitch)); - } + if (parsed_command_line.HasSwitch(kEndURLSwitch)) + g_end_url = parsed_command_line.GetSwitchValueASCII(kEndURLSwitch); if (parsed_command_line.HasSwitch(kLogFileSwitch)) g_log_file_path = parsed_command_line.GetSwitchValuePath(kLogFileSwitch); if (parsed_command_line.HasSwitch(kTimeoutSwitch)) { ASSERT_TRUE( - base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( - kTimeoutSwitch)), &g_timeout_ms)); + base::StringToInt(parsed_command_line.GetSwitchValueASCII( + kTimeoutSwitch), + &g_timeout_ms)); ASSERT_GT(g_timeout_ms, 0); } diff --git a/chrome/test/test_launcher/out_of_proc_test_runner.cc b/chrome/test/test_launcher/out_of_proc_test_runner.cc index 2401a36..eb4e172 100644 --- a/chrome/test/test_launcher/out_of_proc_test_runner.cc +++ b/chrome/test/test_launcher/out_of_proc_test_runner.cc @@ -86,10 +86,10 @@ class OutOfProcTestRunner : public tests::TestRunner { int test_terminate_timeout_ms = kDefaultTestTimeoutMs; if (cmd_line->HasSwitch(kTestTerminateTimeoutFlag)) { - std::wstring timeout_str( - cmd_line->GetSwitchValue(kTestTerminateTimeoutFlag)); + std::string timeout_str = + cmd_line->GetSwitchValueASCII(kTestTerminateTimeoutFlag); int timeout; - base::StringToInt(WideToUTF8(timeout_str), &timeout); + base::StringToInt(timeout_str, &timeout); test_terminate_timeout_ms = std::max(test_terminate_timeout_ms, timeout); } diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index bef3801..a80718f 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -214,41 +214,41 @@ void UITestBase::TearDown() { void UITestBase::InitializeTimeouts() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(kUiTestTimeout)) { - std::wstring timeout_str = command_line.GetSwitchValue(kUiTestTimeout); + std::string timeout_str = command_line.GetSwitchValueASCII(kUiTestTimeout); int timeout; - base::StringToInt(WideToUTF8(timeout_str), &timeout); + base::StringToInt(timeout_str, &timeout); command_execution_timeout_ms_ = std::max(kCommandExecutionTimeout, timeout); } if (command_line.HasSwitch(kUiTestActionTimeout)) { - std::wstring act_str = command_line.GetSwitchValue(kUiTestActionTimeout); + std::string act_str = + command_line.GetSwitchValueASCII(kUiTestActionTimeout); int act_timeout; - base::StringToInt(WideToUTF8(act_str), &act_timeout); + base::StringToInt(act_str, &act_timeout); action_timeout_ms_ = std::max(kWaitForActionMsec, act_timeout); } if (command_line.HasSwitch(kUiTestActionMaxTimeout)) { - std::wstring action_max_str = - command_line.GetSwitchValue(kUiTestActionMaxTimeout); + std::string action_max_str = + command_line.GetSwitchValueASCII(kUiTestActionMaxTimeout); int max_timeout; - base::StringToInt(WideToUTF8(action_max_str), &max_timeout); + base::StringToInt(action_max_str, &max_timeout); action_max_timeout_ms_ = std::max(kWaitForActionMaxMsec, max_timeout); } if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestSleepTimeout)) { - std::wstring sleep_timeout_str = - CommandLine::ForCurrentProcess()->GetSwitchValue(kUiTestSleepTimeout); + std::string sleep_timeout_str = + command_line.GetSwitchValueASCII(kUiTestSleepTimeout); int sleep_timeout; - base::StringToInt(WideToUTF8(sleep_timeout_str), &sleep_timeout); + base::StringToInt(sleep_timeout_str, &sleep_timeout); sleep_timeout_ms_ = std::max(kWaitForActionMsec, sleep_timeout); } if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestTerminateTimeout)) { - std::wstring terminate_timeout_str = - CommandLine::ForCurrentProcess()->GetSwitchValue( - kUiTestTerminateTimeout); + std::string terminate_timeout_str = + command_line.GetSwitchValueASCII(kUiTestTerminateTimeout); int terminate_timeout; - base::StringToInt(WideToUTF8(terminate_timeout_str), &terminate_timeout); + base::StringToInt(terminate_timeout_str, &terminate_timeout); terminate_timeout_ms_ = std::max(kWaitForActionMsec, terminate_timeout); } } diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc index 934a8e9..fd83857 100644 --- a/chrome/test/ui/ui_test_suite.cc +++ b/chrome/test/ui/ui_test_suite.cc @@ -49,26 +49,26 @@ void UITestSuite::Initialize() { parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK)); UITest::set_disable_breakpad( parsed_command_line.HasSwitch(switches::kDisableBreakpad)); - std::wstring test_timeout = - parsed_command_line.GetSwitchValue(UITestSuite::kTestTimeout); + std::string test_timeout = + parsed_command_line.GetSwitchValueASCII(UITestSuite::kTestTimeout); if (!test_timeout.empty()) { int timeout; - base::StringToInt(WideToUTF8(test_timeout), &timeout); + base::StringToInt(test_timeout, &timeout); UITest::set_test_timeout_ms(timeout); } #if defined(OS_WIN) int batch_count = 0; int batch_index = 0; - std::wstring batch_count_str = - parsed_command_line.GetSwitchValue(UITestSuite::kBatchCount); + std::string batch_count_str = + parsed_command_line.GetSwitchValueASCII(UITestSuite::kBatchCount); if (!batch_count_str.empty()) { - base::StringToInt(WideToUTF16Hack(batch_count_str), &batch_count); + base::StringToInt(batch_count_str, &batch_count); } - std::wstring batch_index_str = - parsed_command_line.GetSwitchValue(UITestSuite::kBatchIndex); + std::string batch_index_str = + parsed_command_line.GetSwitchValueASCII(UITestSuite::kBatchIndex); if (!batch_index_str.empty()) { - base::StringToInt(WideToUTF16Hack(batch_index_str), &batch_index); + base::StringToInt(batch_index_str, &batch_index); } if (batch_count > 0 && batch_index >= 0 && batch_index < batch_count) { // Running UI test in parallel. Gtest supports running tests in shards, @@ -76,9 +76,9 @@ void UITestSuite::Initialize() { // Thus all we need to do is to set up environment variables for gtest. // See http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide. std::string batch_count_env(UITestSuite::kGTestTotalShards); - batch_count_env.append(WideToASCII(batch_count_str)); + batch_count_env.append(batch_count_str); std::string batch_index_env(UITestSuite::kGTestShardIndex); - batch_index_env.append(WideToASCII(batch_index_str)); + batch_index_env.append(batch_index_str); _putenv(batch_count_env.c_str()); _putenv(batch_index_env.c_str()); } diff --git a/chrome/test/url_fetch_test/url_fetch_test.cc b/chrome/test/url_fetch_test/url_fetch_test.cc index ec87c76..5729785 100644 --- a/chrome/test/url_fetch_test/url_fetch_test.cc +++ b/chrome/test/url_fetch_test/url_fetch_test.cc @@ -49,7 +49,7 @@ class UrlFetchTest : public UITest { } void RunTest(const GURL& url, const char* wait_cookie_name, - const char* wait_cookie_value, const wchar_t* var_to_fetch, + const char* wait_cookie_value, const char* var_to_fetch, UrlFetchTestResult* result) { scoped_refptr<TabProxy> tab(GetActiveTab()); ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); @@ -67,11 +67,12 @@ class UrlFetchTest : public UITest { } } if (var_to_fetch) { - std::wstring script = StringPrintf( - L"window.domAutomationController.send(%ls);", var_to_fetch); + std::string script = StringPrintf( + "window.domAutomationController.send(%s);", var_to_fetch); std::wstring value; - bool success = tab->ExecuteAndExtractString(L"", script, &value); + bool success = tab->ExecuteAndExtractString(L"", ASCIIToWide(script), + &value); ASSERT_TRUE(success); result->javascript_variable = WideToUTF8(value); } @@ -121,10 +122,10 @@ TEST_F(UrlFetchTest, UrlFetch) { std::string cookie_value = cmd_line->GetSwitchValueASCII("wait_cookie_value"); - std::wstring jsvar = cmd_line->GetSwitchValue("jsvar"); + std::string jsvar = cmd_line->GetSwitchValueASCII("jsvar"); UrlFetchTestResult result; - RunTest(GURL(WideToASCII(cmd_line->GetSwitchValue("url"))), + RunTest(GURL(cmd_line->GetSwitchValueASCII("url")), cookie_name.length() > 0 ? cookie_name.c_str() : NULL, cookie_value.length() > 0 ? cookie_value.c_str() : NULL, jsvar.length() > 0 ? jsvar.c_str() : NULL, diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc index c062c04..09768fa 100644 --- a/chrome/tools/crash_service/crash_service.cc +++ b/chrome/tools/crash_service/crash_service.cc @@ -200,7 +200,7 @@ bool CrashService::Initialize(const std::wstring& command_line) { // We can override the send reports quota with a command line switch. if (cmd_line.HasSwitch(kMaxReports)) - max_reports = _wtoi(cmd_line.GetSwitchValue(kMaxReports).c_str()); + max_reports = _wtoi(cmd_line.GetSwitchValueNative(kMaxReports).c_str()); if (max_reports > 0) { // Create the http sender object. @@ -252,7 +252,7 @@ bool CrashService::Initialize(const std::wstring& command_line) { reporter_tag_ = L"crash svc"; if (cmd_line.HasSwitch(kReporterTag)) - reporter_tag_ = cmd_line.GetSwitchValue(kReporterTag); + reporter_tag_ = cmd_line.GetSwitchValueNative(kReporterTag); // Log basic information. LOG(INFO) << "pipe name is " << pipe_name; |