diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-10 14:54:37 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-10 14:54:37 +0000 |
commit | 018fecd4e824983bf016e6d638a059dd3fac3cc4 (patch) | |
tree | 140fa9fddfe6dd58793228814a56f45402117601 /chrome/installer/setup | |
parent | 4ac0a0958a86c3310f36745cf9bb08ced79f7336 (diff) | |
download | chromium_src-018fecd4e824983bf016e6d638a059dd3fac3cc4.zip chromium_src-018fecd4e824983bf016e6d638a059dd3fac3cc4.tar.gz chromium_src-018fecd4e824983bf016e6d638a059dd3fac3cc4.tar.bz2 |
Add a flag to the installer that prevents the Add/Remove Programs uninstall shortcut from being created.
BUG=19370
TEST=Chrome installs without creating an uninstall shortcut. Nothing else drops off.
Review URL: http://codereview.chromium.org/661009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41160 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r-- | chrome/installer/setup/install.cc | 95 | ||||
-rw-r--r-- | chrome/installer/setup/setup_util.cc | 4 |
2 files changed, 59 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( |