Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8307)

Unified Diff: chrome/installer/setup/setup_main.cc

Issue 10957016: Ensuring Google Update at user-level is installed alongside App Host, for the quick-enable App Host… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing unit tests. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/setup/setup_main.cc
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 3c416d19a31408f29c5125416b61850f77f1d63f..47d33133185b4ed3d71f0ba11d2751c5ce84d63a 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -39,6 +39,7 @@
#include "chrome/installer/util/delete_tree_work_item.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "chrome/installer/util/google_update_util.h"
#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/html_dialog.h"
#include "chrome/installer/util/install_util.h"
@@ -67,7 +68,6 @@ using installer::MasterPreferences;
const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\";
const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
-const int kGoogleUpdateTimeoutMs = 20 * 1000;
const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>(
MiniDumpWithProcessThreadData | // Get PEB and TEB.
@@ -599,6 +599,18 @@ bool CheckPreInstallConditions(const InstallationState& original_state,
return false;
}
}
+
+ } else { // System-level install.
+ // --ensure-google-update-present is supported for user-level only.
+ // The flag is generic, but its primary use case involves App Host.
+ if (installer_state->ensure_google_update_present()) {
+ LOG(DFATAL) << "--" << installer::switches::kEnsureGoogleUpdatePresent
+ << " is supported for user-level only.";
+ *status = installer::APP_HOST_REQUIRES_USER_LEVEL;
+ // No message string since there is nothing a user can do.
+ installer_state->WriteInstallerResult(*status, 0, NULL);
+ return false;
+ }
}
return true;
@@ -748,6 +760,21 @@ installer::InstallStatus InstallProductsHelper(
*installer_version, &install_status);
if (proceed_with_installation) {
+ // If Google Update is absent at user-level, install it using the
+ // Google Update installer from an existing system-level installation.
+ // This is for quick-enable App Host install from a system-level
+ // Chrome Binaries installation.
+ if (!system_install && installer_state.ensure_google_update_present()) {
+ if (!google_update::EnsureUserLevelGoogleUpdatePresent()) {
+ LOG(ERROR) << "Failed to install Google Update";
+ proceed_with_installation = false;
+ install_status = installer::INSTALL_OF_GOOGLE_UPDATE_FAILED;
+ installer_state.WriteInstallerResult(install_status, 0, NULL);
+ }
+ }
+ }
+
+ if (proceed_with_installation) {
FilePath prefs_source_path(cmd_line.GetSwitchValueNative(
installer::switches::kInstallerData));
install_status = installer::InstallOrUpdateProduct(
@@ -933,42 +960,6 @@ installer::InstallStatus UninstallProduct(
remove_all, force_uninstall, cmd_line);
}
-// Tell Google Update that an uninstall has taken place. This gives it a chance
-// to uninstall itself straight away if no more products are installed on the
-// system rather than waiting for the next time the scheduled task runs.
-// Success or failure of Google Update has no bearing on the success or failure
-// of Chrome's uninstallation.
-void UninstallGoogleUpdate(bool system_install) {
- string16 uninstall_cmd(
- GoogleUpdateSettings::GetUninstallCommandLine(system_install));
- if (!uninstall_cmd.empty()) {
- base::win::ScopedHandle process;
- LOG(INFO) << "Launching Google Update's uninstaller: " << uninstall_cmd;
- if (base::LaunchProcess(uninstall_cmd, base::LaunchOptions(),
- process.Receive())) {
- int exit_code = 0;
- if (base::WaitForExitCodeWithTimeout(
- process, &exit_code,
- base::TimeDelta::FromMilliseconds(kGoogleUpdateTimeoutMs))) {
- if (exit_code == 0) {
- LOG(INFO) << " normal exit.";
- } else {
- LOG(ERROR) << "Google Update uninstaller (" << uninstall_cmd
- << ") exited with code " << exit_code << ".";
- }
- } else {
- // The process didn't finish in time, or GetExitCodeProcess failed.
- LOG(ERROR) << "Google Update uninstaller (" << uninstall_cmd
- << ") is taking more than " << kGoogleUpdateTimeoutMs
- << " milliseconds to complete.";
- }
- } else {
- PLOG(ERROR) << "Failed to launch Google Update uninstaller ("
- << uninstall_cmd << ")";
- }
- }
-}
-
installer::InstallStatus UninstallProducts(
const InstallationState& original_state,
const InstallerState& installer_state,
@@ -1003,7 +994,10 @@ installer::InstallStatus UninstallProducts(
install_status = prod_status;
}
- UninstallGoogleUpdate(installer_state.system_install());
+ // Tell Google Update that an uninstall has taken place.
+ // Ignore the return value: success or failure of Google Update
+ // has no bearing on the success or failure of Chrome's uninstallation.
+ google_update::UninstallGoogleUpdate(installer_state.system_install());
return install_status;
}
@@ -1094,16 +1088,14 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state,
GoogleUpdateSettings::SetEULAConsent(
original_state, BrowserDistribution::GetDistribution(), true);
}
- } else if (cmd_line.HasSwitch(
- installer::switches::kConfigureUserSettings)) {
+ } else if (cmd_line.HasSwitch(installer::switches::kConfigureUserSettings)) {
DCHECK(installer_state->system_install());
const Product* chrome_install =
installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER);
DCHECK(chrome_install);
// TODO(gab): Implement the new shortcut functionality here.
LOG(ERROR) << "--configure-user-settings is not implemented.";
- } else if (cmd_line.HasSwitch(
- installer::switches::kRegisterChromeBrowser)) {
+ } else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) {
installer::InstallStatus status = installer::UNKNOWN_STATUS;
const Product* chrome_install =
installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER);
@@ -1132,8 +1124,7 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state,
suffix = cmd_line.GetSwitchValueNative(
installer::switches::kRegisterChromeBrowserSuffix);
}
- if (cmd_line.HasSwitch(
- installer::switches::kRegisterURLProtocol)) {
+ if (cmd_line.HasSwitch(installer::switches::kRegisterURLProtocol)) {
string16 protocol = cmd_line.GetSwitchValueNative(
installer::switches::kRegisterURLProtocol);
// ShellUtil::RegisterChromeForProtocol performs all registration

Powered by Google App Engine
This is Rietveld 408576698