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

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: tweaks Created 5 years, 11 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // A product other than Chrome is being installed in multi-install mode, 442 // A product other than Chrome is being installed in multi-install mode,
443 // and Chrome is already present. Add Chrome to the set of products 443 // and Chrome is already present. Add Chrome to the set of products
444 // (making it multi-install in the process) so that it is updated, too. 444 // (making it multi-install in the process) so that it is updated, too.
445 scoped_ptr<Product> multi_chrome(new Product( 445 scoped_ptr<Product> multi_chrome(new Product(
446 BrowserDistribution::GetSpecificDistribution( 446 BrowserDistribution::GetSpecificDistribution(
447 BrowserDistribution::CHROME_BROWSER))); 447 BrowserDistribution::CHROME_BROWSER)));
448 multi_chrome->SetOption(installer::kOptionMultiInstall, true); 448 multi_chrome->SetOption(installer::kOptionMultiInstall, true);
449 chrome = installer_state->AddProduct(&multi_chrome); 449 chrome = installer_state->AddProduct(&multi_chrome);
450 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode."; 450 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode.";
451 } 451 }
452 } else { 452 } // else migrate multi-install Chrome to single-install.
453 // This is a non-multi installation.
454
455 // Check for an existing installation of the product.
456 const ProductState* product_state = original_state.GetProductState(
457 system_level, products[0]->distribution()->GetType());
458 if (product_state != NULL) {
459 // Block downgrades from multi-install to single-install.
460 if (product_state->is_multi_install()) {
461 LOG(ERROR) << "Multi-install "
462 << products[0]->distribution()->GetDisplayName()
463 << " exists; aborting single install.";
464 *status = installer::MULTI_INSTALLATION_EXISTS;
465 installer_state->WriteInstallerResult(*status,
466 IDS_INSTALL_MULTI_INSTALLATION_EXISTS_BASE, NULL);
467 return false;
468 }
469 }
470 }
471 453
472 return true; 454 return true;
473 } 455 }
474 456
475 // Checks app host pre-install conditions, specifically that this is a 457 // Checks app host pre-install conditions, specifically that this is a
476 // user-level multi-install. When the pre-install conditions are not 458 // user-level multi-install. When the pre-install conditions are not
477 // satisfied, the result is written to the registry (via WriteInstallerResult), 459 // satisfied, the result is written to the registry (via WriteInstallerResult),
478 // |status| is set appropriately, and false is returned. 460 // |status| is set appropriately, and false is returned.
479 bool CheckAppHostPreconditions(const InstallationState& original_state, 461 bool CheckAppHostPreconditions(const InstallationState& original_state,
480 InstallerState* installer_state, 462 InstallerState* installer_state,
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 // multi-install install or update. The operation is performed directly rather 1304 // multi-install install or update. The operation is performed directly rather
1323 // than delegated to the existing install since there is no facility in older 1305 // than delegated to the existing install since there is no facility in older
1324 // versions of setup.exe to uninstall GCF without touching the binaries. The 1306 // versions of setup.exe to uninstall GCF without touching the binaries. The
1325 // binaries will be uninstalled during later processing if they are not in-use 1307 // binaries will be uninstalled during later processing if they are not in-use
1326 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are 1308 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are
1327 // updated to reflect the state of the world following the operation. 1309 // updated to reflect the state of the world following the operation.
1328 void UninstallMultiChromeFrameIfPresent(const base::CommandLine& cmd_line, 1310 void UninstallMultiChromeFrameIfPresent(const base::CommandLine& cmd_line,
1329 const MasterPreferences& prefs, 1311 const MasterPreferences& prefs,
1330 InstallationState* original_state, 1312 InstallationState* original_state,
1331 InstallerState* installer_state) { 1313 InstallerState* installer_state) {
1332 // Early exit if not installing or updating multi-install product(s). 1314 // Early exit if not installing or updating.
1333 if (installer_state->operation() != InstallerState::MULTI_INSTALL && 1315 if (installer_state->operation() == InstallerState::UNINSTALL)
1334 installer_state->operation() != InstallerState::MULTI_UPDATE) {
1335 return; 1316 return;
1336 }
1337 1317
1338 // Early exit if Chrome Frame is not present as multi-install. 1318 // Early exit if Chrome Frame is not present as multi-install.
1339 const ProductState* chrome_frame_state = 1319 const ProductState* chrome_frame_state =
1340 original_state->GetProductState(installer_state->system_install(), 1320 original_state->GetProductState(installer_state->system_install(),
1341 BrowserDistribution::CHROME_FRAME); 1321 BrowserDistribution::CHROME_FRAME);
1342 if (!chrome_frame_state || !chrome_frame_state->is_multi_install()) 1322 if (!chrome_frame_state || !chrome_frame_state->is_multi_install())
1343 return; 1323 return;
1344 1324
1345 LOG(INFO) << "Uninstalling multi-install Chrome Frame."; 1325 LOG(INFO) << "Uninstalling multi-install Chrome Frame.";
1346 installer_state->UpdateStage(installer::UNINSTALLING_CHROME_FRAME); 1326 installer_state->UpdateStage(installer::UNINSTALLING_CHROME_FRAME);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1799 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1820 // to pass through, since this is only returned on uninstall which is 1800 // to pass through, since this is only returned on uninstall which is
1821 // never invoked directly by Google Update. 1801 // never invoked directly by Google Update.
1822 return_code = InstallUtil::GetInstallReturnCode(install_status); 1802 return_code = InstallUtil::GetInstallReturnCode(install_status);
1823 } 1803 }
1824 1804
1825 VLOG(1) << "Installation complete, returning: " << return_code; 1805 VLOG(1) << "Installation complete, returning: " << return_code;
1826 1806
1827 return return_code; 1807 return return_code;
1828 } 1808 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698