summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r--chrome/installer/setup/install.cc47
-rw-r--r--chrome/installer/setup/setup_main.cc13
-rw-r--r--chrome/installer/setup/uninstall.cc20
-rw-r--r--chrome/installer/setup/uninstall.h3
4 files changed, 50 insertions, 33 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.";
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 7d0725c..88b74d1 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -401,6 +401,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
}
installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
+ const wchar_t* cmd_params,
const installer::Version* version,
bool system_install) {
VLOG(1) << "Uninstalling Chome";
@@ -419,7 +420,7 @@ installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
return installer_setup::UninstallChrome(cmd_line.GetProgram().value(),
system_install,
remove_all, force,
- cmd_line);
+ cmd_line, cmd_params);
}
installer_util::InstallStatus ShowEULADialog(const std::wstring& inner_frame) {
@@ -680,13 +681,14 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
if (system_install && !IsUserAnAdmin()) {
if (base::win::GetVersion() >= base::win::VERSION_VISTA &&
!parsed_command_line.HasSwitch(installer_util::switches::kRunAsAdmin)) {
- CommandLine new_cmd(CommandLine::NO_PROGRAM);
- new_cmd.AppendArguments(parsed_command_line, true);
+ std::wstring exe = parsed_command_line.GetProgram().value();
+ std::wstring params(command_line);
// Append --run-as-admin flag to let the new instance of setup.exe know
// that we already tried to launch ourselves as admin.
- new_cmd.AppendSwitch(installer_util::switches::kRunAsAdmin);
+ params.append(L" --");
+ params.append(installer_util::switches::kRunAsAdmin);
DWORD exit_code = installer_util::UNKNOWN_STATUS;
- InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code);
+ InstallUtil::ExecuteExeAsAdmin(exe, params, &exit_code);
return exit_code;
} else {
LOG(ERROR) << "Non admin user can not install system level Chrome.";
@@ -708,6 +710,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
// If --uninstall option is given, uninstall chrome
if (parsed_command_line.HasSwitch(installer_util::switches::kUninstall)) {
install_status = UninstallChrome(parsed_command_line,
+ command_line,
installed_version.get(),
system_install);
// If --uninstall option is not specified, we assume it is install case.
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index ba77cd8..7a3ca1d 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -470,7 +470,7 @@ const wchar_t kChromeExtProgId[] = L"ChromiumExt";
installer_util::InstallStatus installer_setup::UninstallChrome(
const std::wstring& exe_path, bool system_uninstall,
bool remove_all, bool force_uninstall,
- const CommandLine& cmd_line) {
+ const CommandLine& cmd_line, const wchar_t* cmd_params) {
installer_util::InstallStatus status = installer_util::UNINSTALL_CONFIRMED;
std::wstring suffix;
if (!ShellUtil::GetUserSpecificDefaultBrowserSuffix(&suffix))
@@ -496,19 +496,23 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
!::IsUserAnAdmin() &&
(base::win::GetVersion() >= base::win::VERSION_VISTA) &&
!cmd_line.HasSwitch(installer_util::switches::kRunAsAdmin)) {
- CommandLine new_cmd(CommandLine::NO_PROGRAM);
- new_cmd.AppendArguments(cmd_line, true);
+ std::wstring exe = cmd_line.GetProgram().value();
+ std::wstring params(cmd_params);
// Append --run-as-admin flag to let the new instance of setup.exe know
// that we already tried to launch ourselves as admin.
- new_cmd.AppendSwitch(installer_util::switches::kRunAsAdmin);
+ params.append(L" --");
+ params.append(installer_util::switches::kRunAsAdmin);
// Append --remove-chrome-registration to remove registry keys only.
- new_cmd.AppendSwitch(installer_util::switches::kRemoveChromeRegistration);
+ params.append(L" --");
+ params.append(installer_util::switches::kRemoveChromeRegistration);
if (!suffix.empty()) {
- new_cmd.AppendSwitchNative(
- installer_util::switches::kRegisterChromeBrowserSuffix, suffix);
+ params.append(L" --");
+ params.append(ASCIIToWide(
+ installer_util::switches::kRegisterChromeBrowserSuffix));
+ params.append(L"=\"" + suffix + L"\"");
}
DWORD exit_code = installer_util::UNKNOWN_STATUS;
- InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code);
+ InstallUtil::ExecuteExeAsAdmin(exe, params, &exit_code);
}
}
diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h
index d0dc8c3..6c6513a4d 100644
--- a/chrome/installer/setup/uninstall.h
+++ b/chrome/installer/setup/uninstall.h
@@ -42,10 +42,11 @@ void RemoveLegacyRegistryKeys();
// any checks for Chrome running.
// cmd_line: CommandLine that contains information about the command that
// was used to launch current uninstaller.
+// cmd_params: Command line parameters passed to the uninstaller.
installer_util::InstallStatus UninstallChrome(
const std::wstring& exe_path, bool system_uninstall,
bool remove_all, bool force_uninstall,
- const CommandLine& cmd_line);
+ const CommandLine& cmd_line, const wchar_t* cmd_params);
} // namespace installer_setup