diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 16:48:45 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 16:48:45 +0000 |
commit | 5d67720d49524b249eeb0892a61fcf179fde8dbf (patch) | |
tree | e2085749344892828c9cab18d26b4f458c7a2f38 /chrome/installer/util/installer_state.cc | |
parent | e3d3a94984f6ce4d4fdaf0ce3dd3039d436188b5 (diff) | |
download | chromium_src-5d67720d49524b249eeb0892a61fcf179fde8dbf.zip chromium_src-5d67720d49524b249eeb0892a61fcf179fde8dbf.tar.gz chromium_src-5d67720d49524b249eeb0892a61fcf179fde8dbf.tar.bz2 |
Properly detect the current version when migrating single to multi. Previously, we were missing the current version, which could have led to:
- failing to set "opv" on in-use update
- failing to unregister Chrome Frame COM DLLs
- returning INSTALL_FAILED instead of SAME_VERSION_REPAIR_FAILED
- returning FIRST_INSTALL_SUCCESS instead of INSTALL_REPAIRED, IN_USE_UPDATED, or NEW_VERSION_UPDATED
- leaving behind old version directories
- failing to check for duplicates on same version repair
BUG=none
TEST=install single chrome. run mini_installer.exe with --multi-install --chrome to migrate to multi-install. make sure the installer result code is correct as above.
Review URL: http://codereview.chromium.org/6976049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/installer_state.cc')
-rw-r--r-- | chrome/installer/util/installer_state.cc | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index ff8a6b7..42e8e10 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -364,9 +364,33 @@ Version* InstallerState::GetCurrentVersion( const InstallationState& machine_state) const { DCHECK(!products_.empty()); scoped_ptr<Version> current_version; - const BrowserDistribution::Type prod_type = (package_type_ == MULTI_PACKAGE) ? - BrowserDistribution::CHROME_BINARIES : - products_[0]->distribution()->GetType(); + // If we're doing a multi-install, the current version may be either an + // existing multi or an existing single product that is being migrated + // in place (i.e., Chrome). In the latter case, there is no existing + // CHROME_BINARIES installation so we need to search for the product. + BrowserDistribution::Type prod_type; + if (package_type_ == MULTI_PACKAGE) { + prod_type = BrowserDistribution::CHROME_BINARIES; + if (machine_state.GetProductState(level_ == SYSTEM_LEVEL, + prod_type) == NULL) { + // Search for a product on which we're operating that is installed in our + // target directory. + Products::const_iterator end = products().end(); + for (Products::const_iterator scan = products().begin(); scan != end; + ++scan) { + BrowserDistribution::Type product_type = + (*scan)->distribution()->GetType(); + const ProductState* state = + machine_state.GetProductState(level_ == SYSTEM_LEVEL, product_type); + if (state != NULL && target_path_.IsParent(state->GetSetupPath())) { + prod_type = product_type; + break; + } + } + } + } else { + prod_type = products_[0]->distribution()->GetType(); + } const ProductState* product_state = machine_state.GetProductState(level_ == SYSTEM_LEVEL, prod_type); |