summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup/setup_main.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 19:54:02 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 19:54:02 +0000
commit36b6f4f462adc4ff57d65acef4c60939c2dfd8fe (patch)
tree38f40e2fa1773ff67ccb6b2283bf722fa54c9ab5 /chrome/installer/setup/setup_main.cc
parent15e7eba9c74140f4e976c0d152ba738c36f14bb5 (diff)
downloadchromium_src-36b6f4f462adc4ff57d65acef4c60939c2dfd8fe.zip
chromium_src-36b6f4f462adc4ff57d65acef4c60939c2dfd8fe.tar.gz
chromium_src-36b6f4f462adc4ff57d65acef4c60939c2dfd8fe.tar.bz2
Support for GCF ready-mode.
The installer can now be run in a way that installs both Chrome and Chrome Frame at the same time, into a shared directory. The command line to do this is: mini_installer.exe --multi-install --chrome --chrome-frame --ready-mode --system-level --verbose-logging This installs both products although only Chrome will have an entry in the add/remove programs dialog that serves as an uninstallation command for both products. Chrome Frame will be installed in ready-mode, which means that the user will have to opt-in or opt-out of using it. The installer will create a REG_DWORD value to indicate this mode, here: HKEY_LOCAL_MACHINE\SOFTWARE\Google\Update\ClientState\{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D} Value name: ChromeFrameReadyMode Value: 1 If the user opts-in to use GCF, setup will be run again to remove this value, update Chrome's uninstallation commands to only uninstall Chrome, and add an entry to the Add/Remove Programs dialog for GCF. To do this, the installer needs to be run with this switch: --multi-install --chrome-frame --system-level --ready-mode-opt-in --verbose-logging If the user opts-out, Chrome Frame will be uninstalled by running the installer with these arguments: --uninstall --chrome-frame --ready-mode --system-level --multi-install --verbose-logging In addition to uninstalling GCF, this updates Chrome's uninstallation commands accordingly and sets the ChromeFrameReadyMode value to 0 to avoid enabling ready mode again. Requirements that must currently be met in order to install Chrome and Chrome Frame into the same shared location: - Chrome Frame must not already be installed OR - Chrome Frame must be already installed as multi, into the shared location **** other changes **** The installer does no use the ap value for detecting other multi-install products anymore. Instead we inspect the uninstallation switches to see if --multi-install is present. Updated unit tests accordingly. When uninstalling Chrome Frame along with Chrome, the Chrome Frame uninstallation prompt is not shown. Added safeguards: If we attempt to install Chrome Frame multi over a single, install aborts and returns an error. If we attempt to install Chrome Frame single over a multi, install aborts and returns an error. TEST=See description above. BUG=61609 Review URL: http://codereview.chromium.org/5989007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup/setup_main.cc')
-rw-r--r--chrome/installer/setup/setup_main.cc88
1 files changed, 51 insertions, 37 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 386c023..a3db00d 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -201,7 +201,7 @@ bool CheckPreInstallConditions(const Package& installation,
if (chrome_version.get()) {
LOG(ERROR) << "Already installed version " << chrome_version->GetString()
<< " conflicts with the current install mode.";
- if (!system_level && is_first_install) {
+ if (!system_level && is_first_install && product->is_chrome()) {
// This is user-level install and there is a system-level chrome
// installation. Instruct Omaha to launch the existing one. There
// should be no error dialog.
@@ -323,8 +323,7 @@ installer::InstallStatus InstallChrome(const CommandLine& cmd_line,
higher_version_installed = true;
install_status = installer::HIGHER_VERSION_EXISTS;
- if (product->distribution()->GetType() !=
- BrowserDistribution::CHROME_BROWSER) {
+ if (product->is_chrome()) {
// TODO(robertshield): We should take the installer result text
// strings from the Product.
installation.WriteInstallerResult(install_status,
@@ -342,9 +341,9 @@ installer::InstallStatus InstallChrome(const CommandLine& cmd_line,
FilePath archive_to_copy(temp_path.Append(installer::kChromeArchive));
FilePath prefs_source_path(cmd_line.GetSwitchValueNative(
installer::switches::kInstallerData));
- install_status = installer::InstallOrUpdateChrome(cmd_line.GetProgram(),
- archive_to_copy, temp_path, prefs_source_path, prefs,
- *installer_version, installation);
+ install_status = installer::InstallOrUpdateProduct(
+ cmd_line.GetProgram(), archive_to_copy, temp_path,
+ prefs_source_path, prefs, *installer_version, installation);
int install_msg_base = IDS_INSTALL_FAILED_BASE;
std::wstring chrome_exe;
@@ -456,10 +455,8 @@ installer::InstallStatus InstallChrome(const CommandLine& cmd_line,
return install_status;
}
-installer::InstallStatus UninstallChrome(const CommandLine& cmd_line,
- const Product& product) {
- VLOG(1) << "Uninstalling Chome";
-
+installer::InstallStatus UninstallProduct(const CommandLine& cmd_line,
+ const Product& product) {
bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall);
if (product.IsInstalled()) {
VLOG(1) << "version on the system: "
@@ -474,8 +471,8 @@ installer::InstallStatus UninstallChrome(const CommandLine& cmd_line,
bool remove_all = !cmd_line.HasSwitch(
installer::switches::kDoNotRemoveSharedItems);
- return installer::UninstallChrome(cmd_line.GetProgram(), product, remove_all,
- force, cmd_line);
+ return installer::UninstallProduct(cmd_line.GetProgram(), product, remove_all,
+ force, cmd_line);
}
installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) {
@@ -513,6 +510,9 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
int& exit_code,
const ProductPackageMapping& installs) {
DCHECK(installs.products().size());
+ bool handled = true;
+ // TODO(tommi): Split these checks up into functions and use a data driven
+ // map of switch->function.
if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) {
installer::InstallStatus status = installer::SETUP_PATCH_FAILED;
// If --update-setup-exe command line option is given, we apply the given
@@ -546,7 +546,6 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
IDS_SETUP_PATCH_FAILED_BASE, NULL);
}
file_util::Delete(temp_path, true);
- return true;
} else if (cmd_line.HasSwitch(installer::switches::kShowEula)) {
// Check if we need to show the EULA. If it is passed as a command line
// then the dialog is shown and regardless of the outcome setup exits here.
@@ -555,7 +554,6 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
exit_code = ShowEULADialog(inner_frame);
if (installer::EULA_REJECTED != exit_code)
GoogleUpdateSettings::SetEULAConsent(*installs.packages()[0].get(), true);
- return true;
} else if (cmd_line.HasSwitch(
installer::switches::kRegisterChromeBrowser)) {
const Product* chrome_install =
@@ -581,7 +579,6 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
LOG(ERROR) << "Can't register browser - Chrome distribution not found";
exit_code = installer::UNKNOWN_STATUS;
}
- return true;
} else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) {
// If --rename-chrome-exe is specified, we want to rename the executables
// and exit.
@@ -589,7 +586,6 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
DCHECK_EQ(1U, packages.size());
for (size_t i = 0; i < packages.size(); ++i)
exit_code = RenameChromeExecutables(*packages[i].get());
- return true;
} else if (cmd_line.HasSwitch(
installer::switches::kRemoveChromeRegistration)) {
// This is almost reverse of --register-chrome-browser option above.
@@ -611,7 +607,6 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
HKEY_LOCAL_MACHINE, suffix, tmp);
}
exit_code = tmp;
- return true;
} else if (cmd_line.HasSwitch(installer::switches::kInactiveUserToast)) {
// Launch the inactive user toast experiment.
int flavor = -1;
@@ -628,7 +623,6 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
browser_dist->InactiveUserToastExperiment(flavor, *product);
}
}
- return true;
} else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) {
const Products& products = installs.products();
for (size_t i = 0; i < products.size(); ++i) {
@@ -641,9 +635,15 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
browser_dist->LaunchUserExperiment(installer::REENTRY_SYS_UPDATE,
*installed_version, *product, true);
}
- return true;
+ } else if (cmd_line.HasSwitch(
+ installer::switches::kChromeFrameReadyModeOptIn)) {
+ exit_code = InstallUtil::GetInstallReturnCode(
+ installer::ChromeFrameReadyModeOptIn(cmd_line));
+ } else {
+ handled = false;
}
- return false;
+
+ return handled;
}
bool ShowRebootDialog() {
@@ -700,18 +700,22 @@ class AutoCom {
bool initialized_;
};
-void PopulateInstallations(const MasterPreferences& prefs,
+bool PopulateInstallations(const MasterPreferences& prefs,
ProductPackageMapping* installations) {
DCHECK(installations);
+ bool success = true;
if (prefs.install_chrome()) {
VLOG(1) << "Install distribution: Chrome";
- installations->AddDistribution(BrowserDistribution::CHROME_BROWSER, prefs);
+ success = installations->AddDistribution(
+ BrowserDistribution::CHROME_BROWSER, prefs);
}
- if (prefs.install_chrome_frame()) {
+ if (success && prefs.install_chrome_frame()) {
VLOG(1) << "Install distribution: Chrome Frame";
- installations->AddDistribution(BrowserDistribution::CHROME_FRAME, prefs);
+ success = installations->AddDistribution(
+ BrowserDistribution::CHROME_FRAME, prefs);
}
+ return success;
}
// Returns the Custom information for the client identified by the exe path
@@ -790,8 +794,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
base::AtExitManager exit_manager;
CommandLine::Init(0, NULL);
- const MasterPreferences& prefs =
- installer::MasterPreferences::ForCurrentProcess();
+ const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess();
installer::InitInstallerLogging(prefs);
const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
@@ -806,7 +809,18 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
InitializeCrashReporting(system_install));
ProductPackageMapping installations(prefs.is_multi_install(), system_install);
- PopulateInstallations(prefs, &installations);
+ if (!PopulateInstallations(prefs, &installations)) {
+ // Currently this can only fail if one of the installations is a multi and
+ // a pre-existing single installation exists or vice versa.
+ installer::InstallStatus status;
+ if (prefs.is_multi_install()) {
+ status = installer::NON_MULTI_INSTALLATION_EXISTS;
+ } else {
+ status = installer::MULTI_INSTALLATION_EXISTS;
+ }
+ LOG(ERROR) << "Failed to populate installations: " << status;
+ return status;
+ }
// Check to make sure current system is WinXP or later. If not, log
// error message and get out.
@@ -869,12 +883,8 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
installer::InstallStatus install_status = installer::UNKNOWN_STATUS;
// If --uninstall option is given, uninstall chrome
if (is_uninstall) {
- DCHECK_EQ(1U, installations.products().size()) <<
- "We currently really only support uninstalling one distribution "
- "at a time";
for (size_t i = 0; i < installations.products().size(); ++i) {
- install_status = UninstallChrome(cmd_line,
- *installations.products()[i]);
+ install_status = UninstallProduct(cmd_line, *installations.products()[i]);
}
} else {
// If --uninstall option is not specified, we assume it is install case.
@@ -893,11 +903,15 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
if (install_status == installer::UNINSTALL_REQUIRES_REBOOT) {
ShowRebootDialog();
} else if (is_uninstall) {
- ::MessageBoxW(NULL,
- installer::GetLocalizedString(
- IDS_UNINSTALL_COMPLETE_BASE).c_str(),
- cf_install->distribution()->GetApplicationName().c_str(),
- MB_OK);
+ // Only show the message box if Chrome Frame was the only product being
+ // uninstalled.
+ if (installations.products().size() == 1U) {
+ ::MessageBoxW(NULL,
+ installer::GetLocalizedString(
+ IDS_UNINSTALL_COMPLETE_BASE).c_str(),
+ cf_install->distribution()->GetApplicationName().c_str(),
+ MB_OK);
+ }
}
}