summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-15 00:18:30 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-15 00:18:30 +0000
commit9d84e1a1e1d17ab3d64757c0a82f7f95a0aae293 (patch)
treef70d6b45b28c268a03006d0859086d9649e4f0d2 /chrome
parent12c0b1823a10d2b0cf63144bcd32b556c73177af (diff)
downloadchromium_src-9d84e1a1e1d17ab3d64757c0a82f7f95a0aae293.zip
chromium_src-9d84e1a1e1d17ab3d64757c0a82f7f95a0aae293.tar.gz
chromium_src-9d84e1a1e1d17ab3d64757c0a82f7f95a0aae293.tar.bz2
Revert 66088 - Changing the installer switches from wchar_t[] to char[].
Because of this I'm also refactoring some code that before was using wstring to build command lines by hand instead of using the CommandLine class. Now we use CommandLine. To get this to work correctly, I also needed to fix CommandLine::AppendArguments so I added a little test for it. TEST=There should be no changes in functionality. Run all installer tests. BUG=61609 Review URL: http://codereview.chromium.org/4928002 TBR=tommi@chromium.org Review URL: http://codereview.chromium.org/4988001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_main_win.cc12
-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
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc16
-rw-r--r--chrome/installer/util/install_util.cc23
-rw-r--r--chrome/installer/util/install_util.h5
-rw-r--r--chrome/installer/util/master_preferences.cc4
-rw-r--r--chrome/installer/util/master_preferences_unittest.cc61
-rw-r--r--chrome/installer/util/shell_util.cc27
-rw-r--r--chrome/installer/util/util_constants.cc54
-rw-r--r--chrome/installer/util/util_constants.h52
13 files changed, 177 insertions, 160 deletions
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc
index 7536a3b..65a991f 100644
--- a/chrome/browser/browser_main_win.cc
+++ b/chrome/browser/browser_main_win.cc
@@ -188,12 +188,12 @@ bool CheckMachineLevelInstall() {
const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST;
win_util::MessageBox(NULL, text, caption, flags);
- FilePath uninstall_path(InstallUtil::GetChromeUninstallCmd(false));
- CommandLine uninstall_cmd(uninstall_path);
- if (!uninstall_cmd.GetProgram().value().empty()) {
- uninstall_cmd.AppendSwitch(installer_util::switches::kForceUninstall);
- uninstall_cmd.AppendSwitch(
- installer_util::switches::kDoNotRemoveSharedItems);
+ std::wstring uninstall_cmd = InstallUtil::GetChromeUninstallCmd(false);
+ if (!uninstall_cmd.empty()) {
+ uninstall_cmd.append(L" --");
+ uninstall_cmd.append(installer_util::switches::kForceUninstall);
+ uninstall_cmd.append(L" --");
+ uninstall_cmd.append(installer_util::switches::kDoNotRemoveSharedItems);
base::LaunchApp(uninstall_cmd, false, false, NULL);
}
return true;
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
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 34a6333..882ddb3 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -139,14 +139,15 @@ bool RelaunchSetup(const std::string& flag, int value,
// Re-add the system level toast flag.
if (system_level_toast) {
- new_cmd_line.AppendSwitch(installer_util::switches::kSystemLevelToast);
+ new_cmd_line.AppendSwitch(
+ WideToASCII(installer_util::switches::kSystemLevelToast));
// Re-add the toast result key. We need to do this because Setup running as
// system passes the key to Setup running as user, but that child process
// does not perform the actual toasting, it launches another Setup (as user)
// to do so. That is the process that needs the key.
const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
- std::string key(installer_util::switches::kToastResultsKey);
+ std::string key = WideToASCII(installer_util::switches::kToastResultsKey);
std::string toast_key = current_cmd_line.GetSwitchValueASCII(key);
if (!toast_key.empty()) {
new_cmd_line.AppendSwitchASCII(key, toast_key);
@@ -216,16 +217,17 @@ bool FixDACLsForExecute(const wchar_t* exe) {
// the computer is on but nobody has logged in locally.
// Remote Desktop sessions do not count as interactive sessions; running this
// method as a user logged in via remote desktop will do nothing.
-bool RelaunchSetupAsConsoleUser(const std::string& flag) {
+bool RelaunchSetupAsConsoleUser(const std::wstring& flag) {
FilePath setup_exe = CommandLine::ForCurrentProcess()->GetProgram();
CommandLine cmd_line(setup_exe);
- cmd_line.AppendSwitch(flag);
+ cmd_line.AppendSwitch(WideToASCII(flag));
// Get the Google Update results key, and pass it on the command line to
// the child process.
int key = GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey();
- cmd_line.AppendSwitchASCII(installer_util::switches::kToastResultsKey,
- base::IntToString(key));
+ cmd_line.AppendSwitchASCII(
+ WideToASCII(installer_util::switches::kToastResultsKey),
+ base::IntToString(key));
if (base::win::GetVersion() > base::win::VERSION_XP) {
// Make sure that in Vista and Above we have the proper DACLs so
@@ -528,7 +530,7 @@ void SetClient(std::wstring experiment_group, bool last_write) {
if (cmd_line.HasSwitch(installer_util::switches::kToastResultsKey)) {
// Get the handle to the key under HKLM.
base::StringToInt(cmd_line.GetSwitchValueASCII(
- installer_util::switches::kToastResultsKey).c_str(),
+ WideToASCII(installer_util::switches::kToastResultsKey)).c_str(),
&reg_key_handle);
} else {
reg_key_handle = 0;
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 6c11f99..74b4e9f 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -12,6 +12,7 @@
#include <algorithm>
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -36,28 +37,14 @@ const MasterPreferences& InstallUtil::GetMasterPreferencesForCurrentProcess() {
return prefs;
}
-bool InstallUtil::ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code) {
- FilePath::StringType program(cmd.GetProgram().value());
- DCHECK(!program.empty());
- DCHECK(program[0] != '\"');
-
- CommandLine::StringType params(cmd.command_line_string());
- if (params[0] == '"') {
- DCHECK_EQ('"', params[program.length() + 1]);
- DCHECK_EQ(program, params.substr(1, program.length()));
- params = params.substr(program.length() + 2);
- } else {
- DCHECK_EQ(program, params.substr(0, program.length()));
- params = params.substr(program.length());
- }
-
- TrimWhitespace(params, TRIM_ALL, &params);
-
+bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe,
+ const std::wstring& params,
+ DWORD* exit_code) {
SHELLEXECUTEINFO info = {0};
info.cbSize = sizeof(SHELLEXECUTEINFO);
info.fMask = SEE_MASK_NOCLOSEPROCESS;
info.lpVerb = L"runas";
- info.lpFile = program.c_str();
+ info.lpFile = exe.c_str();
info.lpParameters = params.c_str();
info.nShow = SW_SHOW;
if (::ShellExecuteEx(&info) == FALSE)
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index 027a8ee..1e8fd79 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -15,7 +15,6 @@
#include <string>
#include "base/basictypes.h"
-#include "base/command_line.h"
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/version.h"
@@ -34,7 +33,9 @@ class RegKey;
class InstallUtil {
public:
// Launches given exe as admin on Vista.
- static bool ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code);
+ static bool ExecuteExeAsAdmin(const std::wstring& exe,
+ const std::wstring& params,
+ DWORD* exit_code);
// Reads the uninstall command for Chromium from registry and returns it.
// If system_install is true the command is read from HKLM, otherwise
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index 2d77ada..51b9192 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -92,7 +92,7 @@ MasterPreferences::MasterPreferences(const CommandLine& cmd_line)
// distribution dictionary. Currently all switches added will be set to
// 'true'.
static const struct CmdLineSwitchToDistributionSwitch {
- const char* cmd_line_switch;
+ const wchar_t* cmd_line_switch;
const char* distribution_switch;
} translate_switches[] = {
{ installer_util::switches::kCeee,
@@ -136,7 +136,7 @@ MasterPreferences::MasterPreferences(const CommandLine& cmd_line)
// See if the log file path was specified on the command line.
std::wstring str_value(cmd_line.GetSwitchValueNative(
- installer_util::switches::kLogFile));
+ WideToASCII(installer_util::switches::kLogFile)));
if (!str_value.empty()) {
name.resize(arraysize(kDistroDict) - 1);
name.append(".").append(installer_util::master_preferences::kLogFile);
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index 8490025..fe53c29 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -303,14 +303,15 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) {
}
TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) {
- std::wstringstream chrome_cmd, cf_cmd, ceee_cmd;
- chrome_cmd << "setup.exe";
- cf_cmd << "setup.exe --" << installer_util::switches::kChromeFrame;
- ceee_cmd << "setup.exe --" << installer_util::switches::kCeee;
+ const std::wstring kChromeInstall(L"setup.exe");
+ const std::wstring kCfInstall(StringPrintf(L"setup.exe --%ls",
+ installer_util::switches::kChromeFrame));
+ const std::wstring kCeeeInstall(StringPrintf(L"setup.exe --%ls",
+ installer_util::switches::kCeee));
- CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str()));
- CommandLine cf_install(CommandLine::FromString(cf_cmd.str()));
- CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str()));
+ CommandLine chrome_install(CommandLine::FromString(kChromeInstall));
+ CommandLine cf_install(CommandLine::FromString(kCfInstall));
+ CommandLine ceee_install(CommandLine::FromString(kCeeeInstall));
installer_util::MasterPreferences pref_chrome(chrome_install);
installer_util::MasterPreferences pref_cf(cf_install);
@@ -333,27 +334,33 @@ TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) {
}
TEST_F(MasterPreferencesTest, TestMultiInstallConfig) {
- using installer_util::switches::kMultiInstall;
- using installer_util::switches::kChrome;
- using installer_util::switches::kChromeFrame;
- using installer_util::switches::kCeee;
-
- std::wstringstream chrome_cmd, cf_cmd, ceee_cmd, chrome_cf_cmd,
- chrome_ceee_cf_cmd;
- chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome;
- cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChromeFrame;
- ceee_cmd << "setup.exe --" << kMultiInstall << " --" << kCeee;
- chrome_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome <<
- " --" << kChromeFrame;
- chrome_ceee_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome <<
- " --" << kChromeFrame << " --" << kCeee;
-
- CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str()));
- CommandLine cf_install(CommandLine::FromString(cf_cmd.str()));
- CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str()));
- CommandLine chrome_cf_install(CommandLine::FromString(chrome_cf_cmd.str()));
+ const std::wstring kChromeInstall(StringPrintf(L"setup.exe --%ls --%ls",
+ installer_util::switches::kMultiInstall,
+ installer_util::switches::kChrome));
+ const std::wstring kCfInstall(StringPrintf(L"setup.exe --%ls --%ls",
+ installer_util::switches::kMultiInstall,
+ installer_util::switches::kChromeFrame));
+ const std::wstring kCeeeInstall(StringPrintf(L"setup.exe --%ls --%ls",
+ installer_util::switches::kMultiInstall,
+ installer_util::switches::kCeee));
+ const std::wstring kChromeCfInstall(
+ StringPrintf(L"setup.exe --%ls --%ls --%ls",
+ installer_util::switches::kMultiInstall,
+ installer_util::switches::kChrome,
+ installer_util::switches::kChromeFrame));
+ const std::wstring kChromeCeeeCfInstall(
+ StringPrintf(L"setup.exe --%ls --%ls --%ls --%ls",
+ installer_util::switches::kMultiInstall,
+ installer_util::switches::kChrome,
+ installer_util::switches::kChromeFrame,
+ installer_util::switches::kCeee));
+
+ CommandLine chrome_install(CommandLine::FromString(kChromeInstall));
+ CommandLine cf_install(CommandLine::FromString(kCfInstall));
+ CommandLine ceee_install(CommandLine::FromString(kCeeeInstall));
+ CommandLine chrome_cf_install(CommandLine::FromString(kChromeCfInstall));
CommandLine chrome_cf_ceee_install(
- CommandLine::FromString(chrome_ceee_cf_cmd.str()));
+ CommandLine::FromString(kChromeCeeeCfInstall));
installer_util::MasterPreferences pref_chrome(chrome_install);
installer_util::MasterPreferences pref_cf(cf_install);
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index b82bbf8..947c8a0 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -295,10 +295,10 @@ bool IsChromeRegistered(const std::wstring& chrome_exe,
return registered;
}
-// This method registers Chrome on Vista by launching an elevated setup.exe.
-// That will show the user the standard Vista elevation prompt. If the user
-// accepts it the new process will make the necessary changes and return SUCCESS
-// that we capture and return.
+// This method registers Chrome on Vista by launching eleavated setup.exe.
+// That will show user standard Vista elevation prompt. If user accepts it
+// the new process will make the necessary changes and return SUCCESS that
+// we capture and return.
bool ElevateAndRegisterChrome(const std::wstring& chrome_exe,
const std::wstring& suffix) {
FilePath exe_path =
@@ -314,23 +314,26 @@ bool ElevateAndRegisterChrome(const std::wstring& chrome_exe,
CommandLine command_line = CommandLine::FromString(uninstall_string);
exe_path = command_line.GetProgram();
}
-
if (file_util::PathExists(exe_path)) {
- CommandLine cmd(exe_path);
- cmd.AppendSwitchNative(installer_util::switches::kRegisterChromeBrowser,
- chrome_exe);
+ std::wstring params(L"--");
+ params.append(
+ ASCIIToWide(installer_util::switches::kRegisterChromeBrowser));
+ params.append(L"=\"" + chrome_exe + L"\"");
if (!suffix.empty()) {
- cmd.AppendSwitchNative(
- installer_util::switches::kRegisterChromeBrowserSuffix, suffix);
+ params.append(L" --");
+ params.append(ASCIIToWide(
+ installer_util::switches::kRegisterChromeBrowserSuffix));
+ params.append(L"=\"" + suffix + L"\"");
}
CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
if (browser_command_line.HasSwitch(switches::kChromeFrame)) {
- cmd.AppendSwitch(installer_util::switches::kChromeFrame);
+ params.append(L" --");
+ params.append(installer_util::switches::kChromeFrame);
}
DWORD ret_val = 0;
- InstallUtil::ExecuteExeAsAdmin(cmd, &ret_val);
+ InstallUtil::ExecuteExeAsAdmin(exe_path.value(), params, &ret_val);
if (ret_val == 0)
return true;
}
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc
index 04df035..2cb5ceb 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -9,50 +9,50 @@ namespace installer_util {
namespace switches {
// Install CEEE.
-const char kCeee[] = "ceee";
+const wchar_t kCeee[] = L"ceee";
// Install Chrome.
// Currently this is only required when used in combination with kMultiInstall.
-const char kChrome[] = "chrome";
+const wchar_t kChrome[] = L"chrome";
// Run the installer in Chrome Frame mode.
-const char kChromeFrame[] = "chrome-frame";
+const wchar_t kChromeFrame[] = L"chrome-frame";
// Run the installer for Chrome SxS.
-const char kChromeSxS[] = "chrome-sxs";
+const wchar_t kChromeSxS[] = L"chrome-sxs";
// Create Desktop and QuickLaunch shortcuts
-const char kCreateAllShortcuts[] = "create-all-shortcuts";
+const wchar_t kCreateAllShortcuts[] = L"create-all-shortcuts";
// Delete user profile data. This param is useful only when specified with
// kUninstall, otherwise it is silently ignored.
-const char kDeleteProfile[] = "delete-profile";
+const wchar_t kDeleteProfile[] = L"delete-profile";
// Disable logging
-const char kDisableLogging[] = "disable-logging";
+const wchar_t kDisableLogging[] = L"disable-logging";
// Prevent installer from creating desktop shortcuts.
-const char kDoNotCreateShortcuts[] = "do-not-create-shortcuts";
+const wchar_t kDoNotCreateShortcuts[] = L"do-not-create-shortcuts";
// Prevent installer from launching Chrome after a successful first install.
-const char kDoNotLaunchChrome[] = "do-not-launch-chrome";
+const wchar_t kDoNotLaunchChrome[] = L"do-not-launch-chrome";
// Prevents installer from writing the Google Update key that causes Google
// Update to launch Chrome after a first install.
-const char kDoNotRegisterForUpdateLaunch[] =
- "do-not-register-for-update-launch";
+const wchar_t kDoNotRegisterForUpdateLaunch[] =
+ L"do-not-register-for-update-launch";
// By default we remove all shared (between users) files, registry entries etc
// during uninstall. If this option is specified together with kUninstall option
// we do not clean up shared entries otherwise this option is ignored.
-const char kDoNotRemoveSharedItems[] = "do-not-remove-shared-items";
+const wchar_t kDoNotRemoveSharedItems[] = L"do-not-remove-shared-items";
// Enable logging at the error level. This is the default behavior.
-const char kEnableLogging[] = "enable-logging";
+const wchar_t kEnableLogging[] = L"enable-logging";
// If present, setup will uninstall chrome without asking for any
// confirmation from user.
-const char kForceUninstall[] = "force-uninstall";
+const wchar_t kForceUninstall[] = L"force-uninstall";
// Specify the file path of Chrome archive for install.
const char kInstallArchive[] = "install-archive";
@@ -61,20 +61,20 @@ const char kInstallArchive[] = "install-archive";
const char kInstallerData[] = "installerdata";
// If present, specify file path to write logging info.
-const char kLogFile[] = "log-file";
+const wchar_t kLogFile[] = L"log-file";
// Register Chrome as default browser on the system. Usually this will require
// that setup is running as admin. If running as admin we try to register
// as default browser at system level, if running as non-admin we try to
// register as default browser only for the current user.
-const char kMakeChromeDefault[] = "make-chrome-default";
+const wchar_t kMakeChromeDefault[] = L"make-chrome-default";
// Tells installer to expect to be run as a subsidiary to an MSI.
-const char kMsi[] = "msi";
+const wchar_t kMsi[] = L"msi";
// Tells installer to install multiple products specified on the command line.
// (e.g. Chrome Frame, CEEE, Chrome)
-const char kMultiInstall[] = "multi-install";
+const wchar_t kMultiInstall[] = L"multi-install";
// Useful only when used with --update-setup-exe, otherwise ignored. It
// specifies the full path where updated setup.exe will be stored.
@@ -90,20 +90,20 @@ const char kRegisterChromeBrowserSuffix[] =
// Renames chrome.exe to old_chrome.exe and renames new_chrome.exe to chrome.exe
// to support in-use updates. Also deletes opv key.
-const char kRenameChromeExe[] = "rename-chrome-exe";
+const wchar_t kRenameChromeExe[] = L"rename-chrome-exe";
// Removes Chrome registration from current machine. Requires admin rights.
-const char kRemoveChromeRegistration[] = "remove-chrome-registration";
+const wchar_t kRemoveChromeRegistration[] = L"remove-chrome-registration";
// When we try to relaunch setup.exe as admin on Vista, we append this command
// line flag so that we try the launch only once.
-const char kRunAsAdmin[] = "run-as-admin";
+const wchar_t kRunAsAdmin[] = L"run-as-admin";
// Install Chrome to system wise location. The default is per user install.
-const char kSystemLevel[] = "system-level";
+const wchar_t kSystemLevel[] = L"system-level";
// If present, setup will uninstall chrome.
-const char kUninstall[] = "uninstall";
+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
@@ -111,23 +111,23 @@ const char kUninstall[] = "uninstall";
const char kUpdateSetupExe[] = "update-setup-exe";
// Enable verbose logging (info level).
-const char kVerboseLogging[] = "verbose-logging";
+const wchar_t kVerboseLogging[] = L"verbose-logging";
// Show the embedded EULA dialog.
const char kShowEula[] = "show-eula";
// Use the alternate desktop shortcut name.
-const char kAltDesktopShortcut[] = "alt-desktop-shortcut";
+const wchar_t kAltDesktopShortcut[] = L"alt-desktop-shortcut";
// Perform the inactive user toast experiment.
const char kInactiveUserToast[] = "inactive-user-toast";
// User toast experiment switch from system context to user context.
-const char kSystemLevelToast[] = "system-level-toast";
+const wchar_t kSystemLevelToast[] = L"system-level-toast";
// A handle value of the key to write the results of the toast experiment
// to. See DuplicateGoogleUpdateSystemClientKey for details.
-const char kToastResultsKey[] = "toast-results-key";
+const wchar_t kToastResultsKey[] = L"toast-results-key";
} // namespace switches
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index db53573..eb6342e 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -51,40 +51,40 @@ enum InstallStatus {
};
namespace switches {
-extern const char kCeee[];
-extern const char kChrome[];
-extern const char kChromeFrame[];
-extern const char kChromeSxS[];
-extern const char kCreateAllShortcuts[];
-extern const char kDeleteProfile[];
-extern const char kDisableLogging[];
-extern const char kDoNotCreateShortcuts[];
-extern const char kDoNotLaunchChrome[];
-extern const char kDoNotRegisterForUpdateLaunch[];
-extern const char kDoNotRemoveSharedItems[];
-extern const char kEnableLogging[];
-extern const char kForceUninstall[];
+extern const wchar_t kCeee[];
+extern const wchar_t kChrome[];
+extern const wchar_t kChromeFrame[];
+extern const wchar_t kChromeSxS[];
+extern const wchar_t kCreateAllShortcuts[];
+extern const wchar_t kDeleteProfile[];
+extern const wchar_t kDisableLogging[];
+extern const wchar_t kDoNotCreateShortcuts[];
+extern const wchar_t kDoNotLaunchChrome[];
+extern const wchar_t kDoNotRegisterForUpdateLaunch[];
+extern const wchar_t kDoNotRemoveSharedItems[];
+extern const wchar_t kEnableLogging[];
+extern const wchar_t kForceUninstall[];
extern const char kInstallArchive[];
extern const char kInstallerData[];
-extern const char kLogFile[];
-extern const char kMakeChromeDefault[];
-extern const char kMsi[];
-extern const char kMultiInstall[];
+extern const wchar_t kLogFile[];
+extern const wchar_t kMakeChromeDefault[];
+extern const wchar_t kMsi[];
+extern const wchar_t kMultiInstall[];
extern const char kNewSetupExe[];
extern const char kRegisterChromeBrowser[];
extern const char kRegisterChromeBrowserSuffix[];
-extern const char kRenameChromeExe[];
-extern const char kRemoveChromeRegistration[];
-extern const char kRunAsAdmin[];
-extern const char kSystemLevel[];
-extern const char kUninstall[];
+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 char kUpdateSetupExe[];
-extern const char kVerboseLogging[];
+extern const wchar_t kVerboseLogging[];
extern const char kShowEula[];
-extern const char kAltDesktopShortcut[];
+extern const wchar_t kAltDesktopShortcut[];
extern const char kInactiveUserToast[];
-extern const char kSystemLevelToast[];
-extern const char kToastResultsKey[];
+extern const wchar_t kSystemLevelToast[];
+extern const wchar_t kToastResultsKey[];
} // namespace switches
extern const wchar_t kChromeDll[];