| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 #include "base/win/registry.h" | 29 #include "base/win/registry.h" |
| 30 #include "base/win/scoped_com_initializer.h" | 30 #include "base/win/scoped_com_initializer.h" |
| 31 #include "base/win/scoped_comptr.h" | 31 #include "base/win/scoped_comptr.h" |
| 32 #include "base/win/scoped_handle.h" | 32 #include "base/win/scoped_handle.h" |
| 33 #include "base/win/win_util.h" | 33 #include "base/win/win_util.h" |
| 34 #include "base/win/windows_version.h" | 34 #include "base/win/windows_version.h" |
| 35 #include "breakpad/src/client/windows/handler/exception_handler.h" | 35 #include "breakpad/src/client/windows/handler/exception_handler.h" |
| 36 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
| 37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/installer/setup/archive_patch_helper.h" | 38 #include "chrome/installer/setup/archive_patch_helper.h" |
| 39 #include "chrome/installer/setup/cf_migration.h" |
| 39 #include "chrome/installer/setup/install.h" | 40 #include "chrome/installer/setup/install.h" |
| 40 #include "chrome/installer/setup/install_worker.h" | 41 #include "chrome/installer/setup/install_worker.h" |
| 41 #include "chrome/installer/setup/setup_constants.h" | 42 #include "chrome/installer/setup/setup_constants.h" |
| 42 #include "chrome/installer/setup/setup_util.h" | 43 #include "chrome/installer/setup/setup_util.h" |
| 43 #include "chrome/installer/setup/uninstall.h" | 44 #include "chrome/installer/setup/uninstall.h" |
| 44 #include "chrome/installer/util/browser_distribution.h" | 45 #include "chrome/installer/util/browser_distribution.h" |
| 45 #include "chrome/installer/util/channel_info.h" | 46 #include "chrome/installer/util/channel_info.h" |
| 46 #include "chrome/installer/util/delete_after_reboot_helper.h" | 47 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 47 #include "chrome/installer/util/delete_tree_work_item.h" | 48 #include "chrome/installer/util/delete_tree_work_item.h" |
| 48 #include "chrome/installer/util/eula_util.h" | 49 #include "chrome/installer/util/eula_util.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // Move chrome.exe to old_chrome.exe, then move new_chrome.exe to chrome.exe. | 243 // Move chrome.exe to old_chrome.exe, then move new_chrome.exe to chrome.exe. |
| 243 install_list->AddMoveTreeWorkItem(chrome_exe.value(), | 244 install_list->AddMoveTreeWorkItem(chrome_exe.value(), |
| 244 chrome_old_exe.value(), | 245 chrome_old_exe.value(), |
| 245 temp_path.path().value(), | 246 temp_path.path().value(), |
| 246 WorkItem::ALWAYS_MOVE); | 247 WorkItem::ALWAYS_MOVE); |
| 247 install_list->AddMoveTreeWorkItem(chrome_new_exe.value(), | 248 install_list->AddMoveTreeWorkItem(chrome_new_exe.value(), |
| 248 chrome_exe.value(), | 249 chrome_exe.value(), |
| 249 temp_path.path().value(), | 250 temp_path.path().value(), |
| 250 WorkItem::ALWAYS_MOVE); | 251 WorkItem::ALWAYS_MOVE); |
| 251 install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); | 252 install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); |
| 253 // Delete an elevation policy associated with the old version, should one |
| 254 // exist. |
| 255 if (installer_state->FindProduct(BrowserDistribution::CHROME_FRAME)) { |
| 256 installer::AddDeleteOldIELowRightsPolicyWorkItems(*installer_state, |
| 257 install_list.get()); |
| 258 } |
| 252 // old_chrome.exe is still in use in most cases, so ignore failures here. | 259 // old_chrome.exe is still in use in most cases, so ignore failures here. |
| 253 install_list->AddDeleteTreeWorkItem(chrome_old_exe, temp_path.path())-> | 260 install_list->AddDeleteTreeWorkItem(chrome_old_exe, temp_path.path())-> |
| 254 set_ignore_failure(true); | 261 set_ignore_failure(true); |
| 255 | 262 |
| 256 // Add work items to delete the "opv", "cpv", and "cmd" values from all | 263 // Add work items to delete the "opv", "cpv", and "cmd" values from all |
| 257 // products we're operating on (which including the multi-install binaries). | 264 // products we're operating on (which including the multi-install binaries). |
| 258 const Products& products = installer_state->products(); | 265 const Products& products = installer_state->products(); |
| 259 HKEY reg_root = installer_state->root_key(); | 266 HKEY reg_root = installer_state->root_key(); |
| 260 base::string16 version_key; | 267 base::string16 version_key; |
| 261 for (Products::const_iterator it = products.begin(); it < products.end(); | 268 for (Products::const_iterator it = products.begin(); it < products.end(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 *status = installer::INCONSISTENT_UPDATE_POLICY; | 359 *status = installer::INCONSISTENT_UPDATE_POLICY; |
| 353 installer_state.WriteInstallerResult( | 360 installer_state.WriteInstallerResult( |
| 354 *status, IDS_INSTALL_INCONSISTENT_UPDATE_POLICY_BASE, NULL); | 361 *status, IDS_INSTALL_INCONSISTENT_UPDATE_POLICY_BASE, NULL); |
| 355 } | 362 } |
| 356 | 363 |
| 357 return settings_are_valid; | 364 return settings_are_valid; |
| 358 #endif // defined(GOOGLE_CHROME_BUILD) | 365 #endif // defined(GOOGLE_CHROME_BUILD) |
| 359 } | 366 } |
| 360 | 367 |
| 361 // If only the binaries are being updated, fail. | 368 // If only the binaries are being updated, fail. |
| 369 // If Chrome Frame is being installed by itself in multi-mode: |
| 370 // - If a non-multi Chrome Frame installation is present, fail. |
| 362 // If any product is being installed in single-mode that already exists in | 371 // If any product is being installed in single-mode that already exists in |
| 363 // multi-mode, fail. | 372 // multi-mode, fail. |
| 364 bool CheckMultiInstallConditions(const InstallationState& original_state, | 373 bool CheckMultiInstallConditions(const InstallationState& original_state, |
| 365 InstallerState* installer_state, | 374 InstallerState* installer_state, |
| 366 installer::InstallStatus* status) { | 375 installer::InstallStatus* status) { |
| 367 const Products& products = installer_state->products(); | 376 const Products& products = installer_state->products(); |
| 368 DCHECK(products.size()); | 377 DCHECK(products.size()); |
| 369 | 378 |
| 370 const bool system_level = installer_state->system_install(); | 379 const bool system_level = installer_state->system_install(); |
| 371 | 380 |
| 372 if (installer_state->is_multi_install()) { | 381 if (installer_state->is_multi_install()) { |
| 373 const Product* chrome = | 382 const Product* chrome = |
| 374 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); | 383 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); |
| 375 const Product* app_host = | 384 const Product* app_host = |
| 376 installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST); | 385 installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST); |
| 377 const Product* binaries = | 386 const Product* binaries = |
| 378 installer_state->FindProduct(BrowserDistribution::CHROME_BINARIES); | 387 installer_state->FindProduct(BrowserDistribution::CHROME_BINARIES); |
| 388 const Product* chrome_frame = |
| 389 installer_state->FindProduct(BrowserDistribution::CHROME_FRAME); |
| 390 const ProductState* cf_state = |
| 391 original_state.GetProductState(system_level, |
| 392 BrowserDistribution::CHROME_FRAME); |
| 379 const ProductState* chrome_state = | 393 const ProductState* chrome_state = |
| 380 original_state.GetProductState(system_level, | 394 original_state.GetProductState(system_level, |
| 381 BrowserDistribution::CHROME_BROWSER); | 395 BrowserDistribution::CHROME_BROWSER); |
| 382 | 396 |
| 383 if (binaries) { | 397 if (binaries) { |
| 384 if (products.size() == 1) { | 398 if (products.size() == 1) { |
| 385 // There are no products aside from the binaries, so there is no update | 399 // There are no products aside from the binaries, so there is no update |
| 386 // to be applied. This can happen after multi-install Chrome Frame is | 400 // to be applied. This can happen after multi-install Chrome Frame is |
| 387 // migrated to single-install. This is treated as an update failure | 401 // migrated to single-install. This is treated as an update failure |
| 388 // unless the binaries are not in-use, in which case they will be | 402 // unless the binaries are not in-use, in which case they will be |
| 389 // uninstalled and success will be reported (see handling in wWinMain). | 403 // uninstalled and success will be reported (see handling in wWinMain). |
| 390 VLOG(1) << "No products to be updated."; | 404 VLOG(1) << "No products to be updated."; |
| 391 *status = installer::UNUSED_BINARIES; | 405 *status = installer::UNUSED_BINARIES; |
| 392 installer_state->WriteInstallerResult(*status, 0, NULL); | 406 installer_state->WriteInstallerResult(*status, 0, NULL); |
| 393 return false; | 407 return false; |
| 394 } | 408 } |
| 395 } else { | 409 } else { |
| 396 // This will only be hit if --multi-install is given with no products, or | 410 // This will only be hit if --multi-install is given with no products, or |
| 397 // if the app host is being installed and doesn't need the binaries at | 411 // if the app host is being installed and doesn't need the binaries at |
| 398 // user-level. | 412 // user-level. |
| 399 // The former case might be due to a request by an orphaned Application | 413 // The former case might be due to a request by an orphaned Application |
| 400 // Host to re-install the binaries. Thus we add them to the installation. | 414 // Host to re-install the binaries. Thus we add them to the installation. |
| 401 // The latter case is fine and we let it be. | 415 // The latter case is fine and we let it be. |
| 402 // If this is not an app host install and the binaries are not already | 416 // If this is not an app host install and the binaries are not already |
| 403 // present, the installation will fail later due to a lack of products to | 417 // present, the installation will fail later due to a lack of products to |
| 404 // install. | 418 // install. |
| 405 if (app_host && !chrome && !chrome_state) { | 419 if (app_host && !chrome && !chrome_frame && !cf_state && !chrome_state) { |
| 406 DCHECK(!system_level); | 420 DCHECK(!system_level); |
| 407 // App Host may use Chrome/Chrome binaries at system-level. | 421 // App Host may use Chrome/Chrome binaries at system-level. |
| 408 if (original_state.GetProductState( | 422 if (original_state.GetProductState( |
| 409 true, // system | 423 true, // system |
| 410 BrowserDistribution::CHROME_BROWSER) || | 424 BrowserDistribution::CHROME_BROWSER) || |
| 411 original_state.GetProductState( | 425 original_state.GetProductState( |
| 412 true, // system | 426 true, // system |
| 413 BrowserDistribution::CHROME_BINARIES)) { | 427 BrowserDistribution::CHROME_BINARIES)) { |
| 414 VLOG(1) << "Installing/updating App Launcher without binaries."; | 428 VLOG(1) << "Installing/updating App Launcher without binaries."; |
| 415 } else { | 429 } else { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 433 // A product other than Chrome is being installed in multi-install mode, | 447 // A product other than Chrome is being installed in multi-install mode, |
| 434 // and Chrome is already present. Add Chrome to the set of products | 448 // and Chrome is already present. Add Chrome to the set of products |
| 435 // (making it multi-install in the process) so that it is updated, too. | 449 // (making it multi-install in the process) so that it is updated, too. |
| 436 scoped_ptr<Product> multi_chrome(new Product( | 450 scoped_ptr<Product> multi_chrome(new Product( |
| 437 BrowserDistribution::GetSpecificDistribution( | 451 BrowserDistribution::GetSpecificDistribution( |
| 438 BrowserDistribution::CHROME_BROWSER))); | 452 BrowserDistribution::CHROME_BROWSER))); |
| 439 multi_chrome->SetOption(installer::kOptionMultiInstall, true); | 453 multi_chrome->SetOption(installer::kOptionMultiInstall, true); |
| 440 chrome = installer_state->AddProduct(&multi_chrome); | 454 chrome = installer_state->AddProduct(&multi_chrome); |
| 441 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode."; | 455 VLOG(1) << "Upgrading existing Chrome browser in multi-install mode."; |
| 442 } | 456 } |
| 457 |
| 458 // Fail if we're installing Chrome Frame when a single-install of it is |
| 459 // already installed. |
| 460 if (chrome_frame && cf_state && !cf_state->is_multi_install()) { |
| 461 LOG(ERROR) << "Cannot migrate existing Chrome Frame installation to " |
| 462 << "multi-install."; |
| 463 *status = installer::NON_MULTI_INSTALLATION_EXISTS; |
| 464 installer_state->WriteInstallerResult(*status, |
| 465 IDS_INSTALL_NON_MULTI_INSTALLATION_EXISTS_BASE, NULL); |
| 466 return false; |
| 467 } |
| 443 } else { | 468 } else { |
| 444 // This is a non-multi installation. | 469 // This is a non-multi installation. |
| 445 | 470 |
| 446 // Check for an existing installation of the product. | 471 // Check for an existing installation of the product. |
| 447 const ProductState* product_state = original_state.GetProductState( | 472 const ProductState* product_state = original_state.GetProductState( |
| 448 system_level, products[0]->distribution()->GetType()); | 473 system_level, products[0]->distribution()->GetType()); |
| 449 if (product_state != NULL) { | 474 if (product_state != NULL) { |
| 450 // Block downgrades from multi-install to single-install. | 475 // Block downgrades from multi-install to single-install. |
| 451 if (product_state->is_multi_install()) { | 476 if (product_state->is_multi_install()) { |
| 452 LOG(ERROR) << "Multi-install " | 477 LOG(ERROR) << "Multi-install " |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 *exit_code = installer::CourgettePatchFiles(input_file, | 1224 *exit_code = installer::CourgettePatchFiles(input_file, |
| 1200 patch_file, | 1225 patch_file, |
| 1201 output_file); | 1226 output_file); |
| 1202 } else if (patch_type_str == installer::kBsdiff) { | 1227 } else if (patch_type_str == installer::kBsdiff) { |
| 1203 *exit_code = installer::BsdiffPatchFiles(input_file, | 1228 *exit_code = installer::BsdiffPatchFiles(input_file, |
| 1204 patch_file, | 1229 patch_file, |
| 1205 output_file); | 1230 output_file); |
| 1206 } else { | 1231 } else { |
| 1207 *exit_code = installer::PATCH_INVALID_ARGUMENTS; | 1232 *exit_code = installer::PATCH_INVALID_ARGUMENTS; |
| 1208 } | 1233 } |
| 1234 } else if (cmd_line.HasSwitch(installer::switches::kMigrateChromeFrame)) { |
| 1235 *exit_code = MigrateChromeFrame(original_state, installer_state); |
| 1209 } else { | 1236 } else { |
| 1210 handled = false; | 1237 handled = false; |
| 1211 } | 1238 } |
| 1212 | 1239 |
| 1213 return handled; | 1240 return handled; |
| 1214 } | 1241 } |
| 1215 | 1242 |
| 1216 bool ShowRebootDialog() { | 1243 bool ShowRebootDialog() { |
| 1217 // Get a token for this process. | 1244 // Get a token for this process. |
| 1218 HANDLE token; | 1245 HANDLE token; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 << product.distribution()->GetDisplayName() | 1537 << product.distribution()->GetDisplayName() |
| 1511 << " is already installed."; | 1538 << " is already installed."; |
| 1512 higher_products |= (1 << product.distribution()->GetType()); | 1539 higher_products |= (1 << product.distribution()->GetType()); |
| 1513 } | 1540 } |
| 1514 } | 1541 } |
| 1515 | 1542 |
| 1516 if (higher_products != 0) { | 1543 if (higher_products != 0) { |
| 1517 COMPILE_ASSERT(BrowserDistribution::NUM_TYPES == 4, | 1544 COMPILE_ASSERT(BrowserDistribution::NUM_TYPES == 4, |
| 1518 add_support_for_new_products_here_); | 1545 add_support_for_new_products_here_); |
| 1519 const uint32 kBrowserBit = 1 << BrowserDistribution::CHROME_BROWSER; | 1546 const uint32 kBrowserBit = 1 << BrowserDistribution::CHROME_BROWSER; |
| 1547 const uint32 kGCFBit = 1 << BrowserDistribution::CHROME_FRAME; |
| 1520 const uint32 kAppHostBit = 1 << BrowserDistribution::CHROME_APP_HOST; | 1548 const uint32 kAppHostBit = 1 << BrowserDistribution::CHROME_APP_HOST; |
| 1521 int message_id = 0; | 1549 int message_id = 0; |
| 1522 | 1550 |
| 1523 proceed_with_installation = false; | 1551 proceed_with_installation = false; |
| 1524 install_status = HIGHER_VERSION_EXISTS; | 1552 install_status = HIGHER_VERSION_EXISTS; |
| 1525 switch (higher_products) { | 1553 switch (higher_products) { |
| 1526 case kBrowserBit: | 1554 case kBrowserBit: |
| 1527 message_id = IDS_INSTALL_HIGHER_VERSION_BASE; | 1555 message_id = IDS_INSTALL_HIGHER_VERSION_BASE; |
| 1528 break; | 1556 break; |
| 1557 case kGCFBit: |
| 1558 message_id = IDS_INSTALL_HIGHER_VERSION_CF_BASE; |
| 1559 break; |
| 1560 case kGCFBit | kBrowserBit: |
| 1561 message_id = IDS_INSTALL_HIGHER_VERSION_CB_CF_BASE; |
| 1562 break; |
| 1529 default: | 1563 default: |
| 1530 message_id = IDS_INSTALL_HIGHER_VERSION_APP_LAUNCHER_BASE; | 1564 message_id = IDS_INSTALL_HIGHER_VERSION_APP_LAUNCHER_BASE; |
| 1531 break; | 1565 break; |
| 1532 } | 1566 } |
| 1533 | 1567 |
| 1534 installer_state.WriteInstallerResult(install_status, message_id, NULL); | 1568 installer_state.WriteInstallerResult(install_status, message_id, NULL); |
| 1535 } | 1569 } |
| 1536 | 1570 |
| 1537 proceed_with_installation = | 1571 proceed_with_installation = |
| 1538 proceed_with_installation && | 1572 proceed_with_installation && |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1560 switches::kInstallerData)); | 1594 switches::kInstallerData)); |
| 1561 install_status = InstallOrUpdateProduct( | 1595 install_status = InstallOrUpdateProduct( |
| 1562 original_state, installer_state, cmd_line.GetProgram(), | 1596 original_state, installer_state, cmd_line.GetProgram(), |
| 1563 uncompressed_archive, temp_path.path(), src_path, prefs_source_path, | 1597 uncompressed_archive, temp_path.path(), src_path, prefs_source_path, |
| 1564 prefs, *installer_version); | 1598 prefs, *installer_version); |
| 1565 | 1599 |
| 1566 int install_msg_base = IDS_INSTALL_FAILED_BASE; | 1600 int install_msg_base = IDS_INSTALL_FAILED_BASE; |
| 1567 base::string16 chrome_exe; | 1601 base::string16 chrome_exe; |
| 1568 base::string16 quoted_chrome_exe; | 1602 base::string16 quoted_chrome_exe; |
| 1569 if (install_status == SAME_VERSION_REPAIR_FAILED) { | 1603 if (install_status == SAME_VERSION_REPAIR_FAILED) { |
| 1570 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; | 1604 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { |
| 1605 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_CF_BASE; |
| 1606 } else { |
| 1607 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; |
| 1608 } |
| 1571 } else if (install_status != INSTALL_FAILED) { | 1609 } else if (install_status != INSTALL_FAILED) { |
| 1572 if (installer_state.target_path().empty()) { | 1610 if (installer_state.target_path().empty()) { |
| 1573 // If we failed to construct install path, it means the OS call to | 1611 // If we failed to construct install path, it means the OS call to |
| 1574 // get %ProgramFiles% or %AppData% failed. Report this as failure. | 1612 // get %ProgramFiles% or %AppData% failed. Report this as failure. |
| 1575 install_msg_base = IDS_INSTALL_OS_ERROR_BASE; | 1613 install_msg_base = IDS_INSTALL_OS_ERROR_BASE; |
| 1576 install_status = OS_ERROR; | 1614 install_status = OS_ERROR; |
| 1577 } else { | 1615 } else { |
| 1578 chrome_exe = installer_state.target_path().Append(kChromeExe).value(); | 1616 chrome_exe = installer_state.target_path().Append(kChromeExe).value(); |
| 1579 quoted_chrome_exe = L"\"" + chrome_exe + L"\""; | 1617 quoted_chrome_exe = L"\"" + chrome_exe + L"\""; |
| 1580 install_msg_base = 0; | 1618 install_msg_base = 0; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 cmd_line.HasSwitch(installer::switches::kForceUninstall) || | 1768 cmd_line.HasSwitch(installer::switches::kForceUninstall) || |
| 1731 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || | 1769 cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || |
| 1732 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || | 1770 cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || |
| 1733 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || | 1771 cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || |
| 1734 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || | 1772 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || |
| 1735 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1773 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
| 1736 return installer::SXS_OPTION_NOT_SUPPORTED; | 1774 return installer::SXS_OPTION_NOT_SUPPORTED; |
| 1737 } | 1775 } |
| 1738 } | 1776 } |
| 1739 | 1777 |
| 1740 // Some command line options are no longer supported and must error out. | |
| 1741 if (installer::ContainsUnsupportedSwitch(cmd_line)) | |
| 1742 return installer::UNSUPPORTED_OPTION; | |
| 1743 | |
| 1744 int exit_code = 0; | 1778 int exit_code = 0; |
| 1745 if (HandleNonInstallCmdLineOptions( | 1779 if (HandleNonInstallCmdLineOptions( |
| 1746 original_state, cmd_line, &installer_state, &exit_code)) { | 1780 original_state, cmd_line, &installer_state, &exit_code)) { |
| 1747 return exit_code; | 1781 return exit_code; |
| 1748 } | 1782 } |
| 1749 | 1783 |
| 1750 if (system_install && !IsUserAnAdmin()) { | 1784 if (system_install && !IsUserAnAdmin()) { |
| 1751 if (base::win::GetVersion() >= base::win::VERSION_VISTA && | 1785 if (base::win::GetVersion() >= base::win::VERSION_VISTA && |
| 1752 !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { | 1786 !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { |
| 1753 CommandLine new_cmd(CommandLine::NO_PROGRAM); | 1787 CommandLine new_cmd(CommandLine::NO_PROGRAM); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 | 1824 |
| 1791 // Validate that the machine is now in a good state following the operation. | 1825 // Validate that the machine is now in a good state following the operation. |
| 1792 // TODO(grt): change this to log at DFATAL once we're convinced that the | 1826 // TODO(grt): change this to log at DFATAL once we're convinced that the |
| 1793 // validator handles all cases properly. | 1827 // validator handles all cases properly. |
| 1794 InstallationValidator::InstallationType installation_type = | 1828 InstallationValidator::InstallationType installation_type = |
| 1795 InstallationValidator::NO_PRODUCTS; | 1829 InstallationValidator::NO_PRODUCTS; |
| 1796 LOG_IF(ERROR, | 1830 LOG_IF(ERROR, |
| 1797 !InstallationValidator::ValidateInstallationType(system_install, | 1831 !InstallationValidator::ValidateInstallationType(system_install, |
| 1798 &installation_type)); | 1832 &installation_type)); |
| 1799 | 1833 |
| 1834 const Product* cf_install = |
| 1835 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME); |
| 1836 if (cf_install && |
| 1837 !cmd_line.HasSwitch(installer::switches::kForceUninstall)) { |
| 1838 if (install_status == installer::UNINSTALL_REQUIRES_REBOOT) { |
| 1839 ShowRebootDialog(); |
| 1840 } else if (is_uninstall) { |
| 1841 // Only show the message box if Chrome Frame was the only product being |
| 1842 // uninstalled. |
| 1843 const Products& products = installer_state.products(); |
| 1844 int num_products = 0; |
| 1845 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 1846 ++it) { |
| 1847 if (!(*it)->is_chrome_binaries()) |
| 1848 ++num_products; |
| 1849 } |
| 1850 if (num_products == 1U) { |
| 1851 ::MessageBoxW(NULL, |
| 1852 installer::GetLocalizedString( |
| 1853 IDS_UNINSTALL_COMPLETE_BASE).c_str(), |
| 1854 cf_install->distribution()->GetDisplayName().c_str(), |
| 1855 MB_OK); |
| 1856 } |
| 1857 } |
| 1858 } |
| 1859 |
| 1800 int return_code = 0; | 1860 int return_code = 0; |
| 1801 // MSI demands that custom actions always return 0 (ERROR_SUCCESS) or it will | 1861 // MSI demands that custom actions always return 0 (ERROR_SUCCESS) or it will |
| 1802 // rollback the action. If we're uninstalling we want to avoid this, so always | 1862 // rollback the action. If we're uninstalling we want to avoid this, so always |
| 1803 // report success, squashing any more informative return codes. | 1863 // report success, squashing any more informative return codes. |
| 1804 if (!(installer_state.is_msi() && is_uninstall)) { | 1864 if (!(installer_state.is_msi() && is_uninstall)) { |
| 1805 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1865 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1806 // to pass through, since this is only returned on uninstall which is | 1866 // to pass through, since this is only returned on uninstall which is |
| 1807 // never invoked directly by Google Update. | 1867 // never invoked directly by Google Update. |
| 1808 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1868 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1809 } | 1869 } |
| 1810 | 1870 |
| 1871 // Reinitialize original_state to make sure it reflects the now-current |
| 1872 // state of the system. |
| 1873 original_state.Initialize(); |
| 1874 |
| 1875 // If multi Chrome Frame was just updated, migrate the installation to a SxS |
| 1876 // install. Do this right before quitting. |
| 1877 const ProductState* chrome_frame_state = |
| 1878 original_state.GetProductState(system_install, |
| 1879 BrowserDistribution::CHROME_FRAME); |
| 1880 if ((install_status == installer::NEW_VERSION_UPDATED || |
| 1881 install_status == installer::IN_USE_UPDATED) && |
| 1882 chrome_frame_state && |
| 1883 installer_state.operation() == InstallerState::MULTI_UPDATE) { |
| 1884 // Call the newly updated setup.exe with kUncompressedArchive and |
| 1885 // kMigrateChromeFrame to perform the migration. |
| 1886 LaunchChromeFrameMigrationProcess(*chrome_frame_state, cmd_line, |
| 1887 installer_directory, system_install); |
| 1888 } |
| 1889 |
| 1811 VLOG(1) << "Installation complete, returning: " << return_code; | 1890 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1812 | 1891 |
| 1813 return return_code; | 1892 return return_code; |
| 1814 } | 1893 } |
| OLD | NEW |