diff options
-rw-r--r-- | chrome/installer/setup/install.cc | 95 | ||||
-rw-r--r-- | chrome/installer/setup/setup_util.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.cc | 1 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.h | 1 |
6 files changed, 66 insertions, 40 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 226437d..cba5704 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -113,7 +113,8 @@ void AppendUninstallCommandLineFlags(std::wstring* uninstall_cmd_line, } // This method adds work items to create (or update) Chrome uninstall entry in -// Control Panel->Add/Remove Programs list. +// either the Control Panel->Add/Remove Programs list or in the Omaha client +// state key if running under an MSI installer. void AddUninstallShortcutWorkItems(HKEY reg_root, const std::wstring& exe_path, const std::wstring& install_path, @@ -130,47 +131,60 @@ void AddUninstallShortcutWorkItems(HKEY reg_root, AppendUninstallCommandLineFlags(&uninstall_cmd, reg_root == HKEY_LOCAL_MACHINE); - // Create DisplayName, UninstallString and InstallLocation keys BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - std::wstring uninstall_reg = dist->GetUninstallRegPath(); - install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); - install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - installer_util::kUninstallDisplayNameField, product_name, true); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - installer_util::kUninstallStringField, - uninstall_cmd, true); - install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, - L"InstallLocation", install_path, true); - - // DisplayIcon, NoModify and NoRepair - std::wstring chrome_icon = AppendPath(install_path, - installer_util::kChromeExe); - ShellUtil::GetChromeIcon(chrome_icon); - install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - L"DisplayIcon", chrome_icon, true); - install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - L"NoModify", 1, true); - install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - L"NoRepair", 1, true); - - install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - L"Publisher", - dist->GetPublisherName(), true); - install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - L"Version", new_version.c_str(), true); - install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - L"DisplayVersion", - new_version.c_str(), true); - time_t rawtime = time(NULL); - struct tm timeinfo = {0}; - localtime_s(&timeinfo, &rawtime); - wchar_t buffer[9]; - if (wcsftime(buffer, 9, L"%Y%m%d", &timeinfo) == 8) { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + + if (command_line.HasSwitch(installer_util::switches::kMsi)) { + // If we're running at the behest of an MSI, store our uninstall string + // in the Google Update client state key. + std::wstring update_state_key = dist->GetStateKey(); + install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); + install_list->AddSetRegValueWorkItem(reg_root, update_state_key, + installer_util::kUninstallStringField, uninstall_cmd, true); + } else { + // Otherwise, create DisplayName, UninstallString and InstallLocation keys. + std::wstring uninstall_reg = dist->GetUninstallRegPath(); + install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + installer_util::kUninstallDisplayNameField, product_name, true); + install_list->AddSetRegValueWorkItem(reg_root, + uninstall_reg, + installer_util::kUninstallStringField, + uninstall_cmd, true); + install_list->AddSetRegValueWorkItem(reg_root, + uninstall_reg, + L"InstallLocation", + install_path, + true); + + // DisplayIcon, NoModify and NoRepair + std::wstring chrome_icon = AppendPath(install_path, + installer_util::kChromeExe); + ShellUtil::GetChromeIcon(chrome_icon); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + L"DisplayIcon", chrome_icon, true); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + L"NoModify", 1, true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - L"InstallDate", - buffer, false); + L"NoRepair", 1, true); + + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + L"Publisher", + dist->GetPublisherName(), true); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + L"Version", new_version.c_str(), true); + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + L"DisplayVersion", + new_version.c_str(), true); + time_t rawtime = time(NULL); + struct tm timeinfo = {0}; + localtime_s(&timeinfo, &rawtime); + wchar_t buffer[9]; + if (wcsftime(buffer, 9, L"%Y%m%d", &timeinfo) == 8) { + install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, + L"InstallDate", + buffer, false); + } } } @@ -558,6 +572,7 @@ installer_util::InstallStatus InstallNewVersion( new_version.GetString(), install_list.get(), (reg_root == HKEY_LOCAL_MACHINE)); std::wstring product_name = dist->GetAppShortCutName(); + AddUninstallShortcutWorkItems(reg_root, exe_path, install_path, product_name, new_version.GetString(), install_list.get()); diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index 0e801b2..ad09ec8 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -54,6 +54,10 @@ DictionaryValue* setup_util::GetInstallPreferences( installer_util::SetDistroBooleanPreference( prefs, installer_util::master_preferences::kDoNotCreateShortcuts, true); + if (cmd_line.HasSwitch(installer_util::switches::kMsi)) + installer_util::SetDistroBooleanPreference( + prefs, installer_util::master_preferences::kMsi, true); + if (cmd_line.HasSwitch( installer_util::switches::kDoNotRegisterForUpdateLaunch)) installer_util::SetDistroBooleanPreference( diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index ab7bf06..0ac4e63 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -64,6 +64,7 @@ const wchar_t kDoNotRegisterForUpdateLaunch[] = L"do_not_register_for_update_launch"; const wchar_t kMakeChromeDefault[] = L"make_chrome_default"; const wchar_t kMakeChromeDefaultForUser[] = L"make_chrome_default_for_user"; +const wchar_t kMsi[] = L"msi"; const wchar_t kRequireEula[] = L"require_eula"; const wchar_t kSystemLevel[] = L"system_level"; const wchar_t kVerboseLogging[] = L"verbose_logging"; diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h index cc7b8a1..178587f 100644 --- a/chrome/installer/util/master_preferences.h +++ b/chrome/installer/util/master_preferences.h @@ -55,6 +55,8 @@ extern const wchar_t kDoNotRegisterForUpdateLaunch[]; extern const wchar_t kMakeChromeDefault[]; // Boolean. Register Chrome as default browser for the current user. extern const wchar_t kMakeChromeDefaultForUser[]; +// Boolean. Expect to be run by an MSI installer. Cmd line override present. +extern const wchar_t kMsi[]; // Boolean. Show EULA dialog before install. extern const wchar_t kRequireEula[]; // Boolean. Install Chrome to system wise location. Cmd line override present. diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index aa3539e..261863d 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -62,6 +62,9 @@ const wchar_t kLogFile[] = L"log-file"; // register as default browser only for the current user. const wchar_t kMakeChromeDefault[] = L"make-chrome-default"; +// Tells installer to expect to be run as a subsidiary to an MSI. +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"; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 0b4eb34..7c0db12 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -65,6 +65,7 @@ extern const wchar_t kInstallArchive[]; extern const wchar_t 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[]; |