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

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

Issue 1914213002: Support rollback with installerdata in mini_installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cr Created 4 years, 7 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
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/setup/setup_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 GetMaxVersionFromArchiveDir(src_path)); 1497 GetMaxVersionFromArchiveDir(src_path));
1498 if (!installer_version.get()) { 1498 if (!installer_version.get()) {
1499 LOG(ERROR) << "Did not find any valid version in installer."; 1499 LOG(ERROR) << "Did not find any valid version in installer.";
1500 install_status = INVALID_ARCHIVE; 1500 install_status = INVALID_ARCHIVE;
1501 installer_state.WriteInstallerResult(install_status, 1501 installer_state.WriteInstallerResult(install_status,
1502 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); 1502 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL);
1503 } else { 1503 } else {
1504 VLOG(1) << "version to install: " << installer_version->GetString(); 1504 VLOG(1) << "version to install: " << installer_version->GetString();
1505 bool proceed_with_installation = true; 1505 bool proceed_with_installation = true;
1506 1506
1507 uint32_t higher_products = 0; 1507 if (!IsDowngradeAllowed(prefs)) {
1508 static_assert(sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES, 1508 uint32_t higher_products = 0;
1509 "too many distribution types"); 1509 static_assert(
1510 const Products& products = installer_state.products(); 1510 sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES,
1511 for (Products::const_iterator it = products.begin(); it < products.end(); 1511 "too many distribution types");
1512 ++it) { 1512 const Products& products = installer_state.products();
1513 const Product& product = **it; 1513 for (Products::const_iterator it = products.begin(); it < products.end();
1514 const ProductState* product_state = 1514 ++it) {
1515 original_state.GetProductState(system_install, 1515 const Product& product = **it;
1516 product.distribution()->GetType()); 1516 const ProductState* product_state = original_state.GetProductState(
1517 if (product_state != NULL && 1517 system_install, product.distribution()->GetType());
1518 (product_state->version().CompareTo(*installer_version) > 0)) { 1518 if (product_state != NULL &&
1519 LOG(ERROR) << "Higher version of " 1519 (product_state->version().CompareTo(*installer_version) > 0)) {
1520 << product.distribution()->GetDisplayName() 1520 LOG(ERROR) << "Higher version of "
1521 << " is already installed."; 1521 << product.distribution()->GetDisplayName()
1522 higher_products |= (1 << product.distribution()->GetType()); 1522 << " is already installed.";
1523 higher_products |= (1 << product.distribution()->GetType());
1524 }
1525 }
1526
1527 if (higher_products != 0) {
1528 static_assert(BrowserDistribution::NUM_TYPES == 3,
1529 "add support for new products here");
1530 int message_id = IDS_INSTALL_HIGHER_VERSION_BASE;
1531 proceed_with_installation = false;
1532 install_status = HIGHER_VERSION_EXISTS;
1533 installer_state.WriteInstallerResult(install_status, message_id, NULL);
1523 } 1534 }
1524 } 1535 }
1525 1536
1526 if (higher_products != 0) {
1527 static_assert(BrowserDistribution::NUM_TYPES == 3,
1528 "add support for new products here");
1529 int message_id = IDS_INSTALL_HIGHER_VERSION_BASE;
1530 proceed_with_installation = false;
1531 install_status = HIGHER_VERSION_EXISTS;
1532 installer_state.WriteInstallerResult(install_status, message_id, NULL);
1533 }
1534
1535 if (proceed_with_installation) { 1537 if (proceed_with_installation) {
1536 base::FilePath prefs_source_path(cmd_line.GetSwitchValueNative( 1538 base::FilePath prefs_source_path(cmd_line.GetSwitchValueNative(
1537 switches::kInstallerData)); 1539 switches::kInstallerData));
1538 install_status = InstallOrUpdateProduct( 1540 install_status = InstallOrUpdateProduct(
1539 original_state, installer_state, setup_exe, uncompressed_archive, 1541 original_state, installer_state, setup_exe, uncompressed_archive,
1540 temp_path.path(), src_path, prefs_source_path, prefs, 1542 temp_path.path(), src_path, prefs_source_path, prefs,
1541 *installer_version); 1543 *installer_version);
1542 1544
1543 int install_msg_base = IDS_INSTALL_FAILED_BASE; 1545 int install_msg_base = IDS_INSTALL_FAILED_BASE;
1544 base::FilePath chrome_exe; 1546 base::FilePath chrome_exe;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 // to pass through, since this is only returned on uninstall which is 1850 // to pass through, since this is only returned on uninstall which is
1849 // never invoked directly by Google Update. 1851 // never invoked directly by Google Update.
1850 return_code = InstallUtil::GetInstallReturnCode(install_status); 1852 return_code = InstallUtil::GetInstallReturnCode(install_status);
1851 } 1853 }
1852 1854
1853 installer::EndPersistentHistogramStorage(installer_state.target_path()); 1855 installer::EndPersistentHistogramStorage(installer_state.target_path());
1854 VLOG(1) << "Installation complete, returning: " << return_code; 1856 VLOG(1) << "Installation complete, returning: " << return_code;
1855 1857
1856 return return_code; 1858 return return_code;
1857 } 1859 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/setup/setup_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698