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

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

Issue 1468803002: Switch to static_assert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@assert1
Patch Set: message cleanup Created 5 years 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/browser/extensions/window_controller.cc ('k') | chrome/installer/util/channel_info.cc » ('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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 if (!installer_version.get()) { 1492 if (!installer_version.get()) {
1493 LOG(ERROR) << "Did not find any valid version in installer."; 1493 LOG(ERROR) << "Did not find any valid version in installer.";
1494 install_status = INVALID_ARCHIVE; 1494 install_status = INVALID_ARCHIVE;
1495 installer_state.WriteInstallerResult(install_status, 1495 installer_state.WriteInstallerResult(install_status,
1496 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); 1496 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL);
1497 } else { 1497 } else {
1498 VLOG(1) << "version to install: " << installer_version->GetString(); 1498 VLOG(1) << "version to install: " << installer_version->GetString();
1499 bool proceed_with_installation = true; 1499 bool proceed_with_installation = true;
1500 1500
1501 uint32 higher_products = 0; 1501 uint32 higher_products = 0;
1502 COMPILE_ASSERT( 1502 static_assert(sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES,
1503 sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES, 1503 "too many distribution types");
1504 too_many_distribution_types_);
1505 const Products& products = installer_state.products(); 1504 const Products& products = installer_state.products();
1506 for (Products::const_iterator it = products.begin(); it < products.end(); 1505 for (Products::const_iterator it = products.begin(); it < products.end();
1507 ++it) { 1506 ++it) {
1508 const Product& product = **it; 1507 const Product& product = **it;
1509 const ProductState* product_state = 1508 const ProductState* product_state =
1510 original_state.GetProductState(system_install, 1509 original_state.GetProductState(system_install,
1511 product.distribution()->GetType()); 1510 product.distribution()->GetType());
1512 if (product_state != NULL && 1511 if (product_state != NULL &&
1513 (product_state->version().CompareTo(*installer_version) > 0)) { 1512 (product_state->version().CompareTo(*installer_version) > 0)) {
1514 LOG(ERROR) << "Higher version of " 1513 LOG(ERROR) << "Higher version of "
1515 << product.distribution()->GetDisplayName() 1514 << product.distribution()->GetDisplayName()
1516 << " is already installed."; 1515 << " is already installed.";
1517 higher_products |= (1 << product.distribution()->GetType()); 1516 higher_products |= (1 << product.distribution()->GetType());
1518 } 1517 }
1519 } 1518 }
1520 1519
1521 if (higher_products != 0) { 1520 if (higher_products != 0) {
1522 COMPILE_ASSERT(BrowserDistribution::NUM_TYPES == 3, 1521 static_assert(BrowserDistribution::NUM_TYPES == 3,
1523 add_support_for_new_products_here_); 1522 "add support for new products here");
1524 int message_id = IDS_INSTALL_HIGHER_VERSION_BASE; 1523 int message_id = IDS_INSTALL_HIGHER_VERSION_BASE;
1525 proceed_with_installation = false; 1524 proceed_with_installation = false;
1526 install_status = HIGHER_VERSION_EXISTS; 1525 install_status = HIGHER_VERSION_EXISTS;
1527 installer_state.WriteInstallerResult(install_status, message_id, NULL); 1526 installer_state.WriteInstallerResult(install_status, message_id, NULL);
1528 } 1527 }
1529 1528
1530 if (proceed_with_installation) { 1529 if (proceed_with_installation) {
1531 base::FilePath prefs_source_path(cmd_line.GetSwitchValueNative( 1530 base::FilePath prefs_source_path(cmd_line.GetSwitchValueNative(
1532 switches::kInstallerData)); 1531 switches::kInstallerData));
1533 install_status = InstallOrUpdateProduct( 1532 install_status = InstallOrUpdateProduct(
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1824 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1826 // to pass through, since this is only returned on uninstall which is 1825 // to pass through, since this is only returned on uninstall which is
1827 // never invoked directly by Google Update. 1826 // never invoked directly by Google Update.
1828 return_code = InstallUtil::GetInstallReturnCode(install_status); 1827 return_code = InstallUtil::GetInstallReturnCode(install_status);
1829 } 1828 }
1830 1829
1831 VLOG(1) << "Installation complete, returning: " << return_code; 1830 VLOG(1) << "Installation complete, returning: " << return_code;
1832 1831
1833 return return_code; 1832 return return_code;
1834 } 1833 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/window_controller.cc ('k') | chrome/installer/util/channel_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698