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

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

Issue 821673004: replace COMPILE_ASSERT with static_assert in chrome/installer/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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/mini_installer/mini_string.h ('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 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 if (DeferToExistingInstall(existing_setup_exe, cmd_line, 1493 if (DeferToExistingInstall(existing_setup_exe, cmd_line,
1494 installer_state, temp_path.path(), 1494 installer_state, temp_path.path(),
1495 &install_status)) { 1495 &install_status)) {
1496 *delegated_to_existing = true; 1496 *delegated_to_existing = true;
1497 return install_status; 1497 return install_status;
1498 } 1498 }
1499 } 1499 }
1500 } 1500 }
1501 1501
1502 uint32 higher_products = 0; 1502 uint32 higher_products = 0;
1503 COMPILE_ASSERT( 1503 static_assert(
1504 sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES, 1504 sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES,
1505 too_many_distribution_types_); 1505 "too many distribution types");
1506 const Products& products = installer_state.products(); 1506 const Products& products = installer_state.products();
1507 for (Products::const_iterator it = products.begin(); it < products.end(); 1507 for (Products::const_iterator it = products.begin(); it < products.end();
1508 ++it) { 1508 ++it) {
1509 const Product& product = **it; 1509 const Product& product = **it;
1510 const ProductState* product_state = 1510 const ProductState* product_state =
1511 original_state.GetProductState(system_install, 1511 original_state.GetProductState(system_install,
1512 product.distribution()->GetType()); 1512 product.distribution()->GetType());
1513 if (product_state != NULL && 1513 if (product_state != NULL &&
1514 (product_state->version().CompareTo(*installer_version) > 0)) { 1514 (product_state->version().CompareTo(*installer_version) > 0)) {
1515 LOG(ERROR) << "Higher version of " 1515 LOG(ERROR) << "Higher version of "
1516 << product.distribution()->GetDisplayName() 1516 << product.distribution()->GetDisplayName()
1517 << " is already installed."; 1517 << " is already installed.";
1518 higher_products |= (1 << product.distribution()->GetType()); 1518 higher_products |= (1 << product.distribution()->GetType());
1519 } 1519 }
1520 } 1520 }
1521 1521
1522 if (higher_products != 0) { 1522 if (higher_products != 0) {
1523 COMPILE_ASSERT(BrowserDistribution::NUM_TYPES == 4, 1523 static_assert(BrowserDistribution::NUM_TYPES == 4,
1524 add_support_for_new_products_here_); 1524 "add support for new products here");
1525 const uint32 kBrowserBit = 1 << BrowserDistribution::CHROME_BROWSER; 1525 const uint32 kBrowserBit = 1 << BrowserDistribution::CHROME_BROWSER;
1526 int message_id = 0; 1526 int message_id = 0;
1527 1527
1528 proceed_with_installation = false; 1528 proceed_with_installation = false;
1529 install_status = HIGHER_VERSION_EXISTS; 1529 install_status = HIGHER_VERSION_EXISTS;
1530 switch (higher_products) { 1530 switch (higher_products) {
1531 case kBrowserBit: 1531 case kBrowserBit:
1532 message_id = IDS_INSTALL_HIGHER_VERSION_BASE; 1532 message_id = IDS_INSTALL_HIGHER_VERSION_BASE;
1533 break; 1533 break;
1534 default: 1534 default:
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1819 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1820 // to pass through, since this is only returned on uninstall which is 1820 // to pass through, since this is only returned on uninstall which is
1821 // never invoked directly by Google Update. 1821 // never invoked directly by Google Update.
1822 return_code = InstallUtil::GetInstallReturnCode(install_status); 1822 return_code = InstallUtil::GetInstallReturnCode(install_status);
1823 } 1823 }
1824 1824
1825 VLOG(1) << "Installation complete, returning: " << return_code; 1825 VLOG(1) << "Installation complete, returning: " << return_code;
1826 1826
1827 return return_code; 1827 return return_code;
1828 } 1828 }
OLDNEW
« no previous file with comments | « chrome/installer/mini_installer/mini_string.h ('k') | chrome/installer/util/channel_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698