summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup
diff options
context:
space:
mode:
authorgab <gab@chromium.org>2015-08-13 07:43:50 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-13 14:44:32 +0000
commit7e0b5ad5fce6f7bd9ad7aef65f4b2e3f19001463 (patch)
treeb490417c34795178b936e0fffab088dc769a2fd9 /chrome/installer/setup
parent5d012b5a7745dce3e9594bc97f0ea9e2e757ee04 (diff)
downloadchromium_src-7e0b5ad5fce6f7bd9ad7aef65f4b2e3f19001463.zip
chromium_src-7e0b5ad5fce6f7bd9ad7aef65f4b2e3f19001463.tar.gz
chromium_src-7e0b5ad5fce6f7bd9ad7aef65f4b2e3f19001463.tar.bz2
Restore potentially missing Active Setup keys following an OS upgrade.
Without this change the latest changes to trigger Active Setup on update to system-level Chromes fail. Also cleanup some documentation to be more accurate. BUG=488247 TEST= 1) Install setup.exe --chrome --multi-install --system-level 2) Delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Active Setup\Installed Components\{8A69D345-D564-463c-AFF1-A69D9E530F96} 3) As admin, run the command @ HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Google\Update\Clients\{8A69D345-D564-463c-AFF1-A69D9E530F96}\Commands\on-os-upgrade 4) Verify that it restored the key in (2.) and bumped the OS upgrade component (i.e. 43.0.1.0). Review URL: https://codereview.chromium.org/1274043002 Cr-Commit-Position: refs/heads/master@{#343191}
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r--chrome/installer/setup/install.cc42
-rw-r--r--chrome/installer/setup/install.h5
-rw-r--r--chrome/installer/setup/setup_main.cc16
3 files changed, 49 insertions, 14 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 9f7b6b3..edc7cc5 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -38,6 +38,7 @@
#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/set_reg_value_work_item.h"
#include "chrome/installer/util/util_constants.h"
+#include "chrome/installer/util/work_item.h"
#include "chrome/installer/util/work_item_list.h"
@@ -616,28 +617,49 @@ InstallStatus InstallOrUpdateProduct(
}
void HandleOsUpgradeForBrowser(const installer::InstallerState& installer_state,
- const installer::Product& chrome) {
+ const installer::Product& chrome,
+ const base::Version& installed_version) {
DCHECK(chrome.is_chrome());
+
// Upon upgrading to Windows 8, we need to fix Chrome shortcuts and register
// Chrome, so that Metro Chrome would work if Chrome is the default browser.
+ // TODO(gab): This now handles more than just the Win8 things and this
+ // condition should be removed.
if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
VLOG(1) << "Updating and registering shortcuts.";
// Read master_preferences copied beside chrome.exe at install.
- MasterPreferences prefs(
+ const MasterPreferences prefs(
installer_state.target_path().AppendASCII(kDefaultMasterPrefs));
- // Unfortunately, if this is a system-level install, we can't update the
- // shortcuts of each individual user (this only matters if this is an OS
- // upgrade from XP/Vista to Win7+ as some properties are only set on
- // shortcuts as of Win7).
- // At least attempt to update potentially existing all-users shortcuts.
- InstallShortcutLevel level = installer_state.system_install() ?
- ALL_USERS : CURRENT_USER;
- base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe));
+ // Update shortcuts at this install level, per-user shortcuts on system-
+ // level will be updated through Active Setup.
+ const InstallShortcutLevel level =
+ installer_state.system_install() ? ALL_USERS : CURRENT_USER;
+ const base::FilePath chrome_exe(
+ installer_state.target_path().Append(kChromeExe));
CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level,
INSTALL_SHORTCUT_REPLACE_EXISTING);
+
+ // Adapt Chrome registrations to this new OS.
RegisterChromeOnMachine(installer_state, chrome, false);
+ // Active Setup registrations are sometimes lost across OS update, make sure
+ // they're back in place. Note: when Active Setup registrations in HKLM are
+ // lost, the per-user values of performed Active Setups in HKCU are also
+ // lost, so it is fine to restart the dynamic components of the Active Setup
+ // version (ref. UpdateActiveSetupVersionWorkItem) from scratch.
+ // TODO(gab): This should really perform all registry only update steps
+ // (i.e., something between InstallOrUpdateProduct and
+ // AddActiveSetupWorkItems, but this takes care of what is most required for
+ // now).
+ scoped_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList());
+ AddActiveSetupWorkItems(installer_state, installed_version, chrome,
+ work_item_list.get());
+ if (!work_item_list->Do()) {
+ LOG(WARNING) << "Failed to reinstall Active Setup keys.";
+ work_item_list->Rollback();
+ }
+
UpdateOsUpgradeBeacon(installer_state.system_install(),
BrowserDistribution::GetDistribution());
diff --git a/chrome/installer/setup/install.h b/chrome/installer/setup/install.h
index 22f3c3d..5eac8e2 100644
--- a/chrome/installer/setup/install.h
+++ b/chrome/installer/setup/install.h
@@ -19,6 +19,7 @@
namespace base {
class FilePath;
+class Version;
}
namespace installer {
@@ -118,8 +119,10 @@ InstallStatus InstallOrUpdateProduct(
// Performs installation-related tasks following an OS upgrade.
// |chrome| The installed product (must be a browser).
+// |installed_version| the current version of this install.
void HandleOsUpgradeForBrowser(const InstallerState& installer_state,
- const Product& chrome);
+ const Product& chrome,
+ const base::Version& installed_version);
// Performs per-user installation-related tasks on Active Setup (ran on first
// login for each user post system-level Chrome install).
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 15998d1..8bdd55c 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -27,6 +27,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "base/version.h"
#include "base/win/registry.h"
#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_comptr.h"
@@ -1078,9 +1079,18 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state,
installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER);
installer::InstallStatus status = installer::INVALID_STATE_FOR_OPTION;
if (chrome_install) {
- installer::HandleOsUpgradeForBrowser(*installer_state,
- *chrome_install);
- status = installer::INSTALL_REPAIRED;
+ scoped_ptr<FileVersionInfo> version_info(
+ FileVersionInfo::CreateFileVersionInfo(setup_exe));
+ const base::Version installed_version(
+ base::UTF16ToUTF8(version_info->product_version()));
+ if (installed_version.IsValid()) {
+ installer::HandleOsUpgradeForBrowser(*installer_state, *chrome_install,
+ installed_version);
+ status = installer::INSTALL_REPAIRED;
+ } else {
+ LOG(DFATAL) << "Failed to extract product version from "
+ << setup_exe.value();
+ }
} else {
LOG(DFATAL) << "Chrome product not found.";
}