summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup
diff options
context:
space:
mode:
authorrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-18 21:39:43 +0000
committerrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-18 21:39:43 +0000
commit8bcdcbe8e59f804e03f75e86744211210c64484a (patch)
tree06a04450b42770a59ecab09998608c005fed391d /chrome/installer/setup
parentaf784739ebdc4ca47d9d52e366587e4c7ba2313b (diff)
downloadchromium_src-8bcdcbe8e59f804e03f75e86744211210c64484a.zip
chromium_src-8bcdcbe8e59f804e03f75e86744211210c64484a.tar.gz
chromium_src-8bcdcbe8e59f804e03f75e86744211210c64484a.tar.bz2
First set of changes to start separating Google specific branding from Chromium. This change mostly tries to modify installer to install Chromium or Google Chrome depending on a compile flag. The goal is to try to isolate all the differences in a single class that can be overridden for customization. There is also a lot of refactoring to make this happen.
Some changes are yet to be done but I didn't want to make this change even bigger than it already is. With all these changes the default build should still work as it is (Google Chrome should get installed/uninstalled). The changes yet to be done: - Separating string resources (this is marked by TODO in one of the files) - Generate different chrome.7z (Chromium will not include rlz.dll) for mini_installer BUG=1296800 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r--chrome/installer/setup/install.cc59
-rw-r--r--chrome/installer/setup/main.cc232
-rw-r--r--chrome/installer/setup/setup.vcproj12
-rw-r--r--chrome/installer/setup/uninstall.cc58
4 files changed, 170 insertions, 191 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 1231d77..57efed4 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -34,6 +34,7 @@
#include "base/string_util.h"
#include "chrome/installer/setup/setup.h"
#include "chrome/installer/setup/setup_constants.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/copy_tree_work_item.h"
#include "chrome/installer/util/create_dir_work_item.h"
#include "chrome/installer/util/create_reg_key_work_item.h"
@@ -64,6 +65,7 @@ std::wstring AppendPath(const std::wstring parent_path,
void AddUninstallShortcutWorkItems(HKEY reg_root,
const std::wstring& exe_path,
const std::wstring& install_path,
+ const std::wstring& product_name,
const std::wstring& new_version,
WorkItemList* install_list) {
std::wstring uninstall_cmd(L"\"");
@@ -75,44 +77,36 @@ void AddUninstallShortcutWorkItems(HKEY reg_root,
uninstall_cmd.append(installer_util::switches::kUninstall);
// Create DisplayName, UninstallString and InstallLocation keys
- install_list->AddCreateRegKeyWorkItem(reg_root,
- installer_util::kUninstallRegPath);
- const std::wstring& product_name =
- installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE);
- install_list->AddSetRegValueWorkItem(
- reg_root, installer_util::kUninstallRegPath,
+ 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,
- installer_util::kUninstallRegPath,
+ uninstall_reg,
installer_util::kUninstallStringField,
uninstall_cmd, true);
install_list->AddSetRegValueWorkItem(reg_root,
- installer_util::kUninstallRegPath,
+ 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,
- installer_util::kUninstallRegPath,
+ install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"DisplayIcon", chrome_icon, true);
- install_list->AddSetRegValueWorkItem(reg_root,
- installer_util::kUninstallRegPath,
+ install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"NoModify", 1, true);
- install_list->AddSetRegValueWorkItem(reg_root,
- installer_util::kUninstallRegPath,
+ install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"NoRepair", 1, true);
- install_list->AddSetRegValueWorkItem(reg_root,
- installer_util::kUninstallRegPath,
+ install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"Publisher",
- installer_util::kPublisherName, true);
- install_list->AddSetRegValueWorkItem(reg_root,
- installer_util::kUninstallRegPath,
+ dist->GetPublisherName(), true);
+ install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"Version", new_version.c_str(), true);
- install_list->AddSetRegValueWorkItem(reg_root,
- installer_util::kUninstallRegPath,
+ install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"DisplayVersion",
new_version.c_str(), true);
time_t rawtime = time(NULL);
@@ -120,8 +114,7 @@ void AddUninstallShortcutWorkItems(HKEY reg_root,
localtime_s(&timeinfo, &rawtime);
wchar_t buffer[9];
if (wcsftime(buffer, 9, L"%Y%m%d", &timeinfo) == 8) {
- install_list->AddSetRegValueWorkItem(reg_root,
- installer_util::kUninstallRegPath,
+ install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"InstallDate",
buffer, false);
}
@@ -221,23 +214,25 @@ bool installer::InstallNewVersion(const std::wstring& exe_path,
// add shortcut in Control Panel->Add/Remove Programs.
AddInstallerCopyTasks(exe_path, archive_path, temp_dir, install_path,
new_version.GetString(), install_list.get());
- AddUninstallShortcutWorkItems(reg_root, exe_path, install_path,
+ const std::wstring& product_name =
+ installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE);
+ AddUninstallShortcutWorkItems(reg_root, exe_path, install_path, product_name,
new_version.GetString(), install_list.get());
// Delete any old_chrome.exe if present.
install_list->AddDeleteTreeWorkItem(
AppendPath(install_path, installer::kChromeOldExe), std::wstring());
- // Create Google Update key (if not already present) and set the new Chrome
+ // Create Version key (if not already present) and set the new Chrome
// version as last step.
- std::wstring chrome_google_update_key =
- InstallUtil::GetChromeGoogleUpdateKey();
- install_list->AddCreateRegKeyWorkItem(reg_root, chrome_google_update_key);
- install_list->AddSetRegValueWorkItem(reg_root, chrome_google_update_key,
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring version_key = dist->GetVersionKey();
+ install_list->AddCreateRegKeyWorkItem(reg_root, version_key);
+ install_list->AddSetRegValueWorkItem(reg_root, version_key,
google_update::kRegNameField,
- installer_util::kChrome,
- false); // Don't overwrite.
- install_list->AddSetRegValueWorkItem(reg_root, chrome_google_update_key,
+ product_name,
+ true); // overwrite name also
+ install_list->AddSetRegValueWorkItem(reg_root, version_key,
google_update::kRegVersionField,
new_version.GetString(),
true); // overwrite version
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 67bd872..5c40f5b 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -29,6 +29,7 @@
#include <string>
+#include "base/at_exit.h"
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/file_util.h"
@@ -38,6 +39,7 @@
#include "chrome/installer/setup/setup.h"
#include "chrome/installer/setup/setup_constants.h"
#include "chrome/installer/setup/uninstall.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/delete_tree_work_item.h"
#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/install_util.h"
@@ -203,46 +205,106 @@ installer::Version* GetVersionFromDir(const std::wstring& chrome_path) {
return version;
}
-// This method checks if we need to change "ap" key in Google Update to try
-// full installer as fall back method in case incremental installer fails.
-// - If incremental installer fails we append a magic string ("-full"), if
-// it is not present already, so that Google Update server next time will send
-// full installer to update Chrome on the local machine
-// - If we are currently running full installer, we remove this magic
-// string (if it is present) regardless of whether installer failed or not.
-// There is no fall-back for full installer :)
-void ResetGoogleUpdateApKey(bool system_install, bool incremental_install,
- installer_util::InstallStatus install_status) {
- HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-
- RegKey key;
- std::wstring ap_key_value;
- std::wstring chrome_google_update_state_key(
- google_update::kRegPathClientState);
- chrome_google_update_state_key.append(L"\\");
- chrome_google_update_state_key.append(google_update::kChromeGuid);
- if (!key.Open(reg_root, chrome_google_update_state_key.c_str(),
- KEY_ALL_ACCESS) || !key.ReadValue(google_update::kRegApFieldName,
- &ap_key_value)) {
- LOG(INFO) << "Application key not found. Returning without changing it.";
- key.Close();
- return;
+installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
+ const installer::Version* installed_version, bool system_install) {
+ // For install the default location for chrome.packed.7z is in current
+ // folder, so get that value first.
+ std::wstring archive = file_util::GetDirectoryFromPath(cmd_line.program());
+ file_util::AppendToPath(&archive,
+ std::wstring(installer::kChromeCompressedArchive));
+ // If --install-archive is given, get the user specified value
+ if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) {
+ archive = cmd_line.GetSwitchValue(
+ installer_util::switches::kInstallArchive);
}
+ LOG(INFO) << "Archive found to install Chrome " << archive;
+
+ // Create a temp folder where we will unpack Chrome archive. If it fails,
+ // then we are doomed, so return immediately and no cleanup is required.
+ std::wstring temp_path;
+ if (!file_util::CreateNewTempDirectory(std::wstring(L"chrome_"),
+ &temp_path)) {
+ LOG(ERROR) << "Could not create temporary path.";
+ return installer_util::TEMP_DIR_FAILED;
+ }
+ LOG(INFO) << "created path " << temp_path;
+
+ std::wstring unpack_path(temp_path);
+ file_util::AppendToPath(&unpack_path,
+ std::wstring(installer::kInstallSourceDir));
+ bool incremental_install = false;
+ installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS;
+ if (UnPackArchive(archive, system_install, installed_version,
+ temp_path, unpack_path, incremental_install)) {
+ install_status = installer_util::UNCOMPRESSION_FAILED;
+ } else {
+ LOG(INFO) << "unpacked to " << unpack_path;
+ std::wstring src_path(unpack_path);
+ file_util::AppendToPath(&src_path,
+ std::wstring(installer::kInstallSourceChromeDir));
+ scoped_ptr<installer::Version>
+ installer_version(GetVersionFromDir(src_path));
+ if (!installer_version.get()) {
+ LOG(ERROR) << "Did not find any valid version in installer.";
+ install_status = installer_util::INVALID_ARCHIVE;
+ } else {
+ LOG(INFO) << "version to install: " << installer_version->GetString();
+ if (installed_version &&
+ installed_version->IsHigherThan(installer_version.get())) {
+ LOG(ERROR) << "Higher version is already installed.";
+ install_status = installer_util::HIGHER_VERSION_EXISTS;
+ } else {
+ // We want to keep uncompressed archive (chrome.7z) that we get after
+ // uncompressing and binary patching. Get the location for this file.
+ std::wstring archive_to_copy(temp_path);
+ file_util::AppendToPath(&archive_to_copy,
+ std::wstring(installer::kChromeArchive));
+ install_status = installer::InstallOrUpdateChrome(
+ cmd_line.program(), archive_to_copy, temp_path, system_install,
+ *installer_version, installed_version);
+ if (install_status == installer_util::FIRST_INSTALL_SUCCESS) {
+ LOG(INFO) << "First install successful. Launching Chrome.";
+ installer::LaunchChrome(system_install);
+ }
+ }
+ }
+ }
+
+ // Delete install temporary directory.
+ LOG(INFO) << "Deleting temporary directory " << temp_path;
+ scoped_ptr<DeleteTreeWorkItem> delete_tree(
+ WorkItem::CreateDeleteTreeWorkItem(temp_path, std::wstring()));
+ delete_tree->Do();
- std::wstring new_value = InstallUtil::GetNewGoogleUpdateApKey(
- incremental_install, install_status, ap_key_value);
- if ((new_value.compare(ap_key_value) != 0) &&
- !key.WriteValue(google_update::kRegApFieldName, new_value.c_str())) {
- LOG(ERROR) << "Failed to write value " << new_value
- << " to the registry field " << google_update::kRegApFieldName;
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ dist->UpdateDiffInstallStatus(system_install, incremental_install,
+ install_status);
+ return install_status;
+}
+
+installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
+ const installer::Version* version,
+ bool system_install) {
+ bool remove_all = true;
+ if (cmd_line.HasSwitch(installer_util::switches::kDoNotRemoveSharedItems))
+ remove_all = false;
+ LOG(INFO) << "Uninstalling Chome";
+ if (!version) {
+ LOG(ERROR) << "No Chrome installation found for uninstall.";
+ return installer_util::CHROME_NOT_INSTALLED;
+ } else {
+ return installer_setup::UninstallChrome(cmd_line.program(), system_install,
+ *version, remove_all);
}
- key.Close();
}
} // namespace
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
wchar_t* command_line, int show_command) {
+ // The exit manager is in charge of calling the dtors of singletons.
+ base::AtExitManager exit_manager;
+
CommandLine parsed_command_line;
installer::InitInstallerLogging(parsed_command_line);
@@ -283,107 +345,19 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
}
installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS;
+ // If --uninstall option is given, uninstall chrome
if (parsed_command_line.HasSwitch(installer_util::switches::kUninstall)) {
- bool remove_all = true;
- if (parsed_command_line.HasSwitch(
- installer_util::switches::kDoNotRemoveSharedItems))
- remove_all = false;
- // If --uninstall option is given, uninstall chrome
- LOG(INFO) << "Uninstalling Chome";
- if (!installed_version.get()) {
- LOG(ERROR) << "No Chrome installation found for uninstall.";
- install_status = installer_util::CHROME_NOT_INSTALLED;
- } else {
- install_status = installer_setup::UninstallChrome(
- parsed_command_line.program(), system_install,
- *installed_version, remove_all);
- }
+ install_status = UninstallChrome(parsed_command_line,
+ installed_version.get(),
+ system_install);
+ // If --uninstall option is not specified, we assume it is install case.
} else {
- // If --uninstall option is not specified, we assume it is install case.
- // For install the default location for chrome.packed.7z is in current
- // folder, so get that value first.
- std::wstring archive_path =
- file_util::GetDirectoryFromPath(parsed_command_line.program());
- file_util::AppendToPath(&archive_path,
- std::wstring(installer::kChromeCompressedArchive));
- // If --install-archive is given, get the user specified value
- if (parsed_command_line.HasSwitch(
- installer_util::switches::kInstallArchive)) {
- archive_path = parsed_command_line.GetSwitchValue(
- installer_util::switches::kInstallArchive);
- }
- LOG(INFO) << "Archive found to install Chrome " << archive_path;
-
- // Create a temp folder where we will unpack Chrome archive. If it fails,
- // then we are doomed so return immediately and no cleanup is required.
- std::wstring install_temp_path;
- if (!file_util::CreateNewTempDirectory(std::wstring(L"chrome_"),
- &install_temp_path)) {
- LOG(ERROR) << "Could not create temporary path.";
- return installer_util::TEMP_DIR_FAILED;
- }
- LOG(INFO) << "created path " << install_temp_path;
- std::wstring unpack_path(install_temp_path);
- file_util::AppendToPath(&unpack_path,
- std::wstring(installer::kInstallSourceDir));
-
- bool incremental_install = false;
- if (UnPackArchive(archive_path, system_install, installed_version.get(),
- install_temp_path, unpack_path, incremental_install)) {
- install_status = installer_util::UNCOMPRESSION_FAILED;
- } else {
- LOG(INFO) << "unpacked to " << unpack_path;
- std::wstring src_path(unpack_path);
- file_util::AppendToPath(&src_path,
- std::wstring(installer::kInstallSourceChromeDir));
- scoped_ptr<installer::Version>
- installer_version(GetVersionFromDir(src_path));
- if (!installer_version.get()) {
- LOG(ERROR) << "Did not find any valid version in installer.";
- install_status = installer_util::INVALID_ARCHIVE;
- } else {
- LOG(INFO) << "version to be installed: " <<
- installer_version->GetString();
- if (installed_version.get() &&
- installed_version->IsHigherThan(installer_version.get())) {
- LOG(ERROR) << "Higher version is already installed.";
- install_status = installer_util::HIGHER_VERSION_EXISTS;
- } else {
- // We want to keep uncompressed archive (chrome.7z) that we get after
- // uncompressing and binary patching. Get the location for this file.
- std::wstring archive_to_copy(install_temp_path);
- file_util::AppendToPath(&archive_to_copy,
- std::wstring(installer::kChromeArchive));
- install_status = installer::InstallOrUpdateChrome(
- parsed_command_line.program(), archive_to_copy,
- install_temp_path, system_install,
- *installer_version, installed_version.get());
- if (install_status == installer_util::FIRST_INSTALL_SUCCESS) {
- LOG(INFO) << "First install successful. Launching Chrome.";
- installer::LaunchChrome(system_install);
- }
- }
- }
- }
-
- // Delete install temporary directory.
- LOG(INFO) << "Deleting temporary directory " << install_temp_path;
- scoped_ptr<DeleteTreeWorkItem> delete_tree(
- WorkItem::CreateDeleteTreeWorkItem(install_temp_path,
- std::wstring()));
- delete_tree->Do();
-
- ResetGoogleUpdateApKey(system_install, incremental_install, install_status);
-
- // TBD: The previous installs/updates may leave some temporary files
- // that were not deleted when the installs/updates exited, probably due
- // to a crash. Try delete those temporary files again?
+ install_status = InstallChrome(parsed_command_line,
+ installed_version.get(),
+ system_install);
}
CoUninitialize();
- if (InstallUtil::InstallSuccessful(install_status))
- return 0; // For Google Update's benefit we need to return 0 for success
- // cases.
- else
- return install_status;
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ return dist->GetInstallReturnCode(install_status);
}
diff --git a/chrome/installer/setup/setup.vcproj b/chrome/installer/setup/setup.vcproj
index e6c6abf..5c468c8 100644
--- a/chrome/installer/setup/setup.vcproj
+++ b/chrome/installer/setup/setup.vcproj
@@ -21,7 +21,7 @@
<Configuration
Name="Debug|Win32"
ConfigurationType="1"
- InheritedPropertySheets=".\setup_debug.vsprops;..\util\using_util.vsprops;..\util\prebuild\util_prebuild.vsprops"
+ InheritedPropertySheets=".\setup_debug.vsprops;..\util\prebuild\util_prebuild.vsprops"
>
<Tool
Name="Version"
@@ -42,7 +42,7 @@
<Configuration
Name="Release|Win32"
ConfigurationType="1"
- InheritedPropertySheets=".\setup_release.vsprops;..\util\using_util.vsprops;..\util\prebuild\util_prebuild.vsprops"
+ InheritedPropertySheets=".\setup_release.vsprops;..\util\prebuild\util_prebuild.vsprops"
>
<Tool
Name="Version"
@@ -68,10 +68,6 @@
Name="resources"
>
<File
- RelativePath=".\setup_resource.h"
- >
- </File>
- <File
RelativePath=".\setup.ico"
>
</File>
@@ -84,6 +80,10 @@
>
</File>
<File
+ RelativePath=".\setup_resource.h"
+ >
+ </File>
+ <File
RelativePath="$(IntDir)\..\util_prebuild\setup_strings.h"
>
</File>
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index c9b80ab..92466b2 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -44,7 +44,9 @@
#include "base/wmi_util.h"
#include "chrome/app/result_codes.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/installer/setup/setup.h"
#include "chrome/installer/setup/setup_constants.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/l10n_string_util.h"
@@ -147,6 +149,23 @@ installer_util::InstallStatus IsChromeActiveOrUserCancelled(
return installer_util::UNINSTALL_FAILED;
}
+#if defined(GOOGLE_CHROME_BUILD)
+// Uninstall Chrome specific Gears. First we find Gears MSI ProductId (that
+// changes with every new version of Gears) using Gears MSI UpgradeCode (that
+// does not change) and then uninstall Gears using API.
+void UninstallGears() {
+ wchar_t product[39]; // GUID + '\0'
+ MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); // Don't show any UI to user.
+ for (int i = 0; MsiEnumRelatedProducts(google_update::kGearsUpgradeCode, 0, i,
+ product) != ERROR_NO_MORE_ITEMS; ++i) {
+ LOG(INFO) << "Uninstalling Gears - " << product;
+ unsigned int ret = MsiConfigureProduct(product, INSTALLLEVEL_MAXIMUM,
+ INSTALLSTATE_ABSENT);
+ if (ret != ERROR_SUCCESS)
+ LOG(ERROR) << "Failed to uninstall Gears " << product << ": " << ret;
+ }
+}
+
// Read the URL from the resource file and substitute the locale parameter
// with whatever Google Update tells us is the locale. In case we fail to find
// the locale, we use US English.
@@ -202,21 +221,7 @@ void LaunchUninstallSurvey(const installer::Version& installed_version) {
WMIProcessUtil::Launch(command, &pid);
}
-// Uninstall Chrome specific Gears. First we find Gears MSI ProductId (that
-// changes with every new version of Gears) using Gears MSI UpgradeCode (that
-// does not change) and then uninstall Gears using API.
-void UninstallGears() {
- wchar_t product[39]; // GUID + '\0'
- MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); // Don't show any UI to user.
- for (int i = 0; MsiEnumRelatedProducts(google_update::kGearsUpgradeCode, 0, i,
- product) != ERROR_NO_MORE_ITEMS; ++i) {
- LOG(INFO) << "Uninstalling Gears - " << product;
- unsigned int ret = MsiConfigureProduct(product, INSTALLLEVEL_MAXIMUM,
- INSTALLSTATE_ABSENT);
- if (ret != ERROR_SUCCESS)
- LOG(ERROR) << "Failed to uninstall Gears " << product << ": " << ret;
- }
-}
+#endif
} // namespace
@@ -229,8 +234,11 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
if (status != installer_util::UNINSTALL_CONFIRMED)
return status;
- // Uninstall Gears first.
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ dist->DoPreUninstallOperations();
+#if defined(GOOGLE_CHROME_BUILD)
UninstallGears();
+#endif
// Chrome is not in use so lets uninstall Chrome by deleting various files
// and registry entries. Here we will just make best effort and keep going
@@ -238,11 +246,11 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
// First delete shortcut from Start->Programs.
DeleteChromeShortcut(system_uninstall);
- // Delete the registry keys (Uninstall key and Google Update update key).
+ // Delete the registry keys (Uninstall key and Version key).
HKEY reg_root = system_uninstall ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
RegKey key(reg_root, L"", KEY_ALL_ACCESS);
- DeleteRegistryKey(key, installer_util::kUninstallRegPath);
- DeleteRegistryKey(key, InstallUtil::GetChromeGoogleUpdateKey());
+ DeleteRegistryKey(key, dist->GetUninstallRegPath());
+ DeleteRegistryKey(key, dist->GetVersionKey());
// Delete Software\Classes\ChromeHTML,
// Software\Clients\StartMenuInternet\chrome.exe and
@@ -256,7 +264,7 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
DeleteRegistryKey(key, set_access_key);
DeleteRegistryValue(reg_root, ShellUtil::kRegRegisteredApplications,
- installer_util::kApplicationName);
+ dist->GetApplicationName());
key.Close();
// Delete shared registry keys as well (these require admin rights) if
@@ -267,7 +275,7 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
DeleteRegistryKey(hklm_key, html_prog_id);
DeleteRegistryValue(HKEY_LOCAL_MACHINE,
ShellUtil::kRegRegisteredApplications,
- installer_util::kApplicationName);
+ dist->GetApplicationName());
// Delete media player registry key that exists only in HKLM.
std::wstring reg_path(installer::kMediaPlayerRegPath);
@@ -287,9 +295,8 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
LOG(INFO) << "install destination path: " << install_path;
}
- std::wstring setup_exe(install_path);
- file_util::AppendToPath(&setup_exe, installed_version.GetString());
- file_util::AppendToPath(&setup_exe, installer::kInstallerDir);
+ std::wstring setup_exe(installer::GetInstallerPathUnderChrome(
+ install_path, installed_version.GetString()));
file_util::AppendToPath(&setup_exe, file_util::GetFilenameFromPath(exe_path));
std::wstring temp_file;
@@ -301,6 +308,9 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
LOG(ERROR) << "Failed to delete folder: " << install_path;
LOG(INFO) << "Uninstallation complete. Launching Uninstall survey.";
+ dist->DoPostUninstallOperations(installed_version);
+#if defined(GOOGLE_CHROME_BUILD)
LaunchUninstallSurvey(installed_version);
+#endif
return installer_util::UNINSTALL_SUCCESSFUL;
}