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

Side by Side Diff: chrome/installer/setup/setup_main.cc

Issue 869153004: Support migrating multi-install Chrome to single-install. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: verifier fix Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/installer/setup/setup_main.h" 5 #include "chrome/installer/setup/setup_main.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <msi.h> 8 #include <msi.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // A product other than Chrome is being installed in multi-install mode, 407 // A product other than Chrome is being installed in multi-install mode,
408 // and Chrome is already present. Add Chrome to the set of products 408 // and Chrome is already present. Add Chrome to the set of products
409 // (making it multi-install in the process) so that it is updated, too. 409 // (making it multi-install in the process) so that it is updated, too.
410 scoped_ptr<Product> multi_chrome(new Product( 410 scoped_ptr<Product> multi_chrome(new Product(
411 BrowserDistribution::GetSpecificDistribution( 411 BrowserDistribution::GetSpecificDistribution(
412 BrowserDistribution::CHROME_BROWSER))); 412 BrowserDistribution::CHROME_BROWSER)));
413 multi_chrome->SetOption(installer::kOptionMultiInstall, true); 413 multi_chrome->SetOption(installer::kOptionMultiInstall, true);
414 chrome = installer_state->AddProduct(&multi_chrome); 414 chrome = installer_state->AddProduct(&multi_chrome);
415 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode."; 415 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode.";
416 } 416 }
417 } else { 417 } // else migrate multi-install Chrome to single-install.
418 // This is a non-multi installation.
419
420 // Check for an existing installation of the product.
421 const ProductState* product_state = original_state.GetProductState(
422 system_level, products[0]->distribution()->GetType());
423 if (product_state != NULL) {
424 // Block downgrades from multi-install to single-install.
425 if (product_state->is_multi_install()) {
426 LOG(ERROR) << "Multi-install "
427 << products[0]->distribution()->GetDisplayName()
428 << " exists; aborting single install.";
429 *status = installer::MULTI_INSTALLATION_EXISTS;
430 installer_state->WriteInstallerResult(*status,
431 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL);
432 return false;
433 }
434 }
435 }
436 418
437 return true; 419 return true;
438 } 420 }
439 421
440 // Checks for compatibility between the current state of the system and the 422 // Checks for compatibility between the current state of the system and the
441 // desired operation. Also applies policy that mutates the desired operation; 423 // desired operation. Also applies policy that mutates the desired operation;
442 // specifically, the |installer_state| object. 424 // specifically, the |installer_state| object.
443 // Also blocks simultaneous user-level and system-level installs. In the case 425 // Also blocks simultaneous user-level and system-level installs. In the case
444 // of trying to install user-level Chrome when system-level exists, the 426 // of trying to install user-level Chrome when system-level exists, the
445 // existing system-level Chrome is launched. 427 // existing system-level Chrome is launched.
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 // multi-install install or update. The operation is performed directly rather 1222 // multi-install install or update. The operation is performed directly rather
1241 // than delegated to the existing install since there is no facility in older 1223 // than delegated to the existing install since there is no facility in older
1242 // versions of setup.exe to uninstall GCF without touching the binaries. The 1224 // versions of setup.exe to uninstall GCF without touching the binaries. The
1243 // binaries will be uninstalled during later processing if they are not in-use 1225 // binaries will be uninstalled during later processing if they are not in-use
1244 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are 1226 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are
1245 // updated to reflect the state of the world following the operation. 1227 // updated to reflect the state of the world following the operation.
1246 void UninstallMultiChromeFrameIfPresent(const base::CommandLine& cmd_line, 1228 void UninstallMultiChromeFrameIfPresent(const base::CommandLine& cmd_line,
1247 const MasterPreferences& prefs, 1229 const MasterPreferences& prefs,
1248 InstallationState* original_state, 1230 InstallationState* original_state,
1249 InstallerState* installer_state) { 1231 InstallerState* installer_state) {
1250 // Early exit if not installing or updating multi-install product(s). 1232 // Early exit if not installing or updating.
1251 if (installer_state->operation() != InstallerState::MULTI_INSTALL && 1233 if (installer_state->operation() == InstallerState::UNINSTALL)
1252 installer_state->operation() != InstallerState::MULTI_UPDATE) {
1253 return; 1234 return;
1254 }
1255 1235
1256 // Early exit if Chrome Frame is not present as multi-install. 1236 // Early exit if Chrome Frame is not present as multi-install.
1257 const ProductState* chrome_frame_state = 1237 const ProductState* chrome_frame_state =
1258 original_state->GetProductState(installer_state->system_install(), 1238 original_state->GetProductState(installer_state->system_install(),
1259 BrowserDistribution::CHROME_FRAME); 1239 BrowserDistribution::CHROME_FRAME);
1260 if (!chrome_frame_state || !chrome_frame_state->is_multi_install()) 1240 if (!chrome_frame_state || !chrome_frame_state->is_multi_install())
1261 return; 1241 return;
1262 1242
1263 LOG(INFO) << "Uninstalling multi-install Chrome Frame."; 1243 LOG(INFO) << "Uninstalling multi-install Chrome Frame.";
1264 installer_state->UpdateStage(installer::UNINSTALLING_CHROME_FRAME); 1244 installer_state->UpdateStage(installer::UNINSTALLING_CHROME_FRAME);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1690 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1711 // to pass through, since this is only returned on uninstall which is 1691 // to pass through, since this is only returned on uninstall which is
1712 // never invoked directly by Google Update. 1692 // never invoked directly by Google Update.
1713 return_code = InstallUtil::GetInstallReturnCode(install_status); 1693 return_code = InstallUtil::GetInstallReturnCode(install_status);
1714 } 1694 }
1715 1695
1716 VLOG(1) << "Installation complete, returning: " << return_code; 1696 VLOG(1) << "Installation complete, returning: " << return_code;
1717 1697
1718 return return_code; 1698 return return_code;
1719 } 1699 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/util/installation_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698