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