diff options
Diffstat (limited to 'chrome/installer/setup/install.cc')
-rw-r--r-- | chrome/installer/setup/install.cc | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 8aefcf3..c1325f8 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -82,10 +82,15 @@ void AddInstallerCopyTasks(const std::wstring& exe_path, } } +// A little helper function to save on tons of WideToASCII call sites. +void AppendWideSwitch(CommandLine* cmd, const wchar_t* switch_name) { + cmd->AppendSwitch(WideToASCII(switch_name)); +} + void AppendUninstallCommandLineFlags(CommandLine* uninstall_cmd, bool is_system) { DCHECK(uninstall_cmd); - uninstall_cmd->AppendSwitch(installer_util::switches::kUninstall); + AppendWideSwitch(uninstall_cmd, installer_util::switches::kUninstall); // TODO(tommi): In case of multiple installations, we need to create multiple // uninstall entries, and not one magic one for all. @@ -94,26 +99,26 @@ void AppendUninstallCommandLineFlags(CommandLine* uninstall_cmd, DCHECK(!prefs.is_multi_install()); if (prefs.install_chrome_frame()) { - uninstall_cmd->AppendSwitch(installer_util::switches::kDeleteProfile); - uninstall_cmd->AppendSwitch(installer_util::switches::kChromeFrame); + AppendWideSwitch(uninstall_cmd, installer_util::switches::kDeleteProfile); + AppendWideSwitch(uninstall_cmd, installer_util::switches::kChromeFrame); } if (InstallUtil::IsChromeSxSProcess()) { - uninstall_cmd->AppendSwitch(installer_util::switches::kChromeSxS); + AppendWideSwitch(uninstall_cmd, installer_util::switches::kChromeSxS); } if (InstallUtil::IsMSIProcess(is_system)) { - uninstall_cmd->AppendSwitch(installer_util::switches::kMsi); + AppendWideSwitch(uninstall_cmd, installer_util::switches::kMsi); } // Propagate the verbose logging switch to uninstalls too. const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(installer_util::switches::kVerboseLogging)) { - uninstall_cmd->AppendSwitch(installer_util::switches::kVerboseLogging); + AppendWideSwitch(uninstall_cmd, installer_util::switches::kVerboseLogging); } if (is_system) { - uninstall_cmd->AppendSwitch(installer_util::switches::kSystemLevel); + AppendWideSwitch(uninstall_cmd, installer_util::switches::kSystemLevel); } } @@ -415,26 +420,30 @@ bool DoPostInstallTasks(HKEY reg_root, google_update::kRegOldVersionField, current_version.c_str(), true); - FilePath installer_path(installer::GetInstallerPathUnderChrome(install_path, - new_version.GetString())); - installer_path = installer_path.Append( - file_util::GetFilenameFromPath(exe_path)); - CommandLine rename_cmd(installer_path); - rename_cmd.AppendSwitch(installer_util::switches::kRenameChromeExe); + std::wstring rename_cmd(installer::GetInstallerPathUnderChrome( + install_path, new_version.GetString())); + file_util::AppendToPath(&rename_cmd, + file_util::GetFilenameFromPath(exe_path)); + rename_cmd = L"\"" + rename_cmd + + L"\" --" + installer_util::switches::kRenameChromeExe; if (is_system_install) - rename_cmd.AppendSwitch(installer_util::switches::kSystemLevel); + rename_cmd = rename_cmd + L" --" + installer_util::switches::kSystemLevel; - if (prefs.install_chrome_frame()) - rename_cmd.AppendSwitch(installer_util::switches::kChromeFrame); + if (prefs.install_chrome_frame()) { + rename_cmd += L" --"; + rename_cmd += installer_util::switches::kChromeFrame; + } - if (InstallUtil::IsChromeSxSProcess()) - rename_cmd.AppendSwitch(installer_util::switches::kChromeSxS); + if (InstallUtil::IsChromeSxSProcess()) { + rename_cmd += L" --"; + rename_cmd += installer_util::switches::kChromeSxS; + } inuse_list->AddSetRegValueWorkItem(reg_root, version_key, google_update::kRegRenameCmdField, - rename_cmd.command_line_string(), + rename_cmd.c_str(), true); if (!inuse_list->Do()) { LOG(ERROR) << "Couldn't write opv/cmd values to registry."; |