Chromium Code Reviews| 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 // This file contains the definitions of the installer functions that build | 5 // This file contains the definitions of the installer functions that build |
| 6 // the WorkItemList used to install the application. | 6 // the WorkItemList used to install the application. |
| 7 | 7 |
| 8 #include "chrome/installer/setup/install_worker.h" | 8 #include "chrome/installer/setup/install_worker.h" |
| 9 | 9 |
| 10 #include <oaidl.h> | 10 #include <oaidl.h> |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 const HKEY root_key = installer_state.root_key(); | 375 const HKEY root_key = installer_state.root_key(); |
| 376 std::wstring multi_key( | 376 std::wstring multi_key( |
| 377 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 377 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
| 378 | 378 |
| 379 // Copy the value from the product with the greatest value. | 379 // Copy the value from the product with the greatest value. |
| 380 bool have_eula_accepted = false; | 380 bool have_eula_accepted = false; |
| 381 BrowserDistribution::Type product_type; | 381 BrowserDistribution::Type product_type; |
| 382 DWORD eula_accepted; | 382 DWORD eula_accepted; |
| 383 const Products& products = installer_state.products(); | 383 const Products& products = installer_state.products(); |
| 384 for (size_t i = 0, count = products.size(); i != count; ++i) { | 384 for (size_t i = 0, count = products.size(); i != count; ++i) { |
| 385 if (products[i]->is_chrome_binaries()) | |
|
grt (UTC plus 2)
2012/07/24 15:02:03
values are copied from products into the binaries,
| |
| 386 continue; | |
| 385 DWORD dword_value = 0; | 387 DWORD dword_value = 0; |
| 386 BrowserDistribution::Type this_type = | 388 BrowserDistribution::Type this_type = |
| 387 products[i]->distribution()->GetType(); | 389 products[i]->distribution()->GetType(); |
| 388 const ProductState* product_state = | 390 const ProductState* product_state = |
| 389 original_state.GetNonVersionedProductState( | 391 original_state.GetNonVersionedProductState( |
| 390 system_install, this_type); | 392 system_install, this_type); |
| 391 if (product_state->GetEulaAccepted(&dword_value) && | 393 if (product_state->GetEulaAccepted(&dword_value) && |
| 392 (!have_eula_accepted || dword_value > eula_accepted)) { | 394 (!have_eula_accepted || dword_value > eula_accepted)) { |
| 393 have_eula_accepted = true; | 395 have_eula_accepted = true; |
| 394 eula_accepted = dword_value; | 396 eula_accepted = dword_value; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 } | 631 } |
| 630 if (critical_version.IsValid()) { | 632 if (critical_version.IsValid()) { |
| 631 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 633 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
| 632 google_update::kRegCriticalVersionField, | 634 google_update::kRegCriticalVersionField, |
| 633 ASCIIToWide(critical_version.GetString()), true); | 635 ASCIIToWide(critical_version.GetString()), true); |
| 634 } else { | 636 } else { |
| 635 in_use_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 637 in_use_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
| 636 google_update::kRegCriticalVersionField); | 638 google_update::kRegCriticalVersionField); |
| 637 } | 639 } |
| 638 | 640 |
| 639 // Adding this registry entry for all products is overkill. | 641 // Adding this registry entry for all products (but the binaries) is |
| 640 // However, as it stands, we don't have a way to know which distribution | 642 // overkill. However, as it stands, we don't have a way to know which |
| 641 // will check the key and run the command, so we add it for all. The | 643 // product will check the key and run the command, so we add it for all. |
| 642 // first to run it will perform the operation and clean up the other | 644 // The first to run it will perform the operation and clean up the other |
| 643 // values. | 645 // values. |
| 644 CommandLine product_rename_cmd(rename); | 646 if (dist->GetType() != BrowserDistribution::CHROME_BINARIES) { |
| 645 products[i]->AppendRenameFlags(&product_rename_cmd); | 647 CommandLine product_rename_cmd(rename); |
| 646 in_use_update_work_items->AddSetRegValueWorkItem( | 648 products[i]->AppendRenameFlags(&product_rename_cmd); |
| 647 root, version_key, google_update::kRegRenameCmdField, | |
| 648 product_rename_cmd.GetCommandLineString(), true); | |
| 649 } | |
| 650 | |
| 651 if (current_version != NULL && installer_state.is_multi_install()) { | |
|
grt (UTC plus 2)
2012/07/24 15:02:03
the binaries are in the set of products now, so th
| |
| 652 BrowserDistribution* dist = | |
| 653 installer_state.multi_package_binaries_distribution(); | |
| 654 version_key = dist->GetVersionKey(); | |
| 655 in_use_update_work_items->AddSetRegValueWorkItem( | |
| 656 root, version_key, google_update::kRegOldVersionField, | |
| 657 ASCIIToWide(current_version->GetString()), true); | |
| 658 if (critical_version.IsValid()) { | |
| 659 in_use_update_work_items->AddSetRegValueWorkItem( | 649 in_use_update_work_items->AddSetRegValueWorkItem( |
| 660 root, version_key, google_update::kRegCriticalVersionField, | 650 root, version_key, google_update::kRegRenameCmdField, |
| 661 ASCIIToWide(critical_version.GetString()), true); | 651 product_rename_cmd.GetCommandLineString(), true); |
| 662 } else { | |
| 663 in_use_update_work_items->AddDeleteRegValueWorkItem( | |
| 664 root, version_key, google_update::kRegCriticalVersionField); | |
| 665 } | 652 } |
| 666 // TODO(tommi): We should move the rename command here. We also need to | |
| 667 // update upgrade_utils::SwapNewChromeExeIfPresent. | |
| 668 } | 653 } |
| 669 | 654 |
| 670 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { | 655 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { |
| 671 AddCopyIELowRightsPolicyWorkItems(installer_state, | 656 AddCopyIELowRightsPolicyWorkItems(installer_state, |
| 672 in_use_update_work_items.get()); | 657 in_use_update_work_items.get()); |
| 673 } | 658 } |
| 674 | 659 |
| 675 post_install_task_list->AddWorkItem(in_use_update_work_items.release()); | 660 post_install_task_list->AddWorkItem(in_use_update_work_items.release()); |
| 676 } | 661 } |
| 677 | 662 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 if (installer_state.is_msi()) { | 695 if (installer_state.is_msi()) { |
| 711 for (size_t i = 0; i < products.size(); ++i) { | 696 for (size_t i = 0; i < products.size(); ++i) { |
| 712 const Product* product = products[i]; | 697 const Product* product = products[i]; |
| 713 AddSetMsiMarkerWorkItem(installer_state, product->distribution(), true, | 698 AddSetMsiMarkerWorkItem(installer_state, product->distribution(), true, |
| 714 post_install_task_list); | 699 post_install_task_list); |
| 715 | 700 |
| 716 // We want MSI installs to take over the Add/Remove Programs shortcut. | 701 // We want MSI installs to take over the Add/Remove Programs shortcut. |
| 717 // Make a best-effort attempt to delete any shortcuts left over from | 702 // Make a best-effort attempt to delete any shortcuts left over from |
| 718 // previous non-MSI installations for the same type of install (system or | 703 // previous non-MSI installations for the same type of install (system or |
| 719 // per user). | 704 // per user). |
| 720 AddDeleteUninstallShortcutsForMSIWorkItems(installer_state, *product, | 705 if (product->ShouldCreateUninstallEntry()) { |
| 721 temp_path, | 706 AddDeleteUninstallShortcutsForMSIWorkItems(installer_state, *product, |
| 722 post_install_task_list); | 707 temp_path, |
| 723 } | 708 post_install_task_list); |
| 724 if (installer_state.is_multi_install()) { | 709 } |
|
grt (UTC plus 2)
2012/07/24 15:02:03
the binaries are in the set of products now, so th
| |
| 725 AddSetMsiMarkerWorkItem(installer_state, | |
| 726 installer_state.multi_package_binaries_distribution(), true, | |
| 727 post_install_task_list); | |
| 728 } | 710 } |
| 729 } | 711 } |
| 730 | 712 |
| 731 return true; | 713 return true; |
| 732 } | 714 } |
| 733 | 715 |
| 734 void AddChromeWorkItems(const InstallationState& original_state, | 716 void AddChromeWorkItems(const InstallationState& original_state, |
| 735 const InstallerState& installer_state, | 717 const InstallerState& installer_state, |
| 736 const FilePath& setup_path, | 718 const FilePath& setup_path, |
| 737 const FilePath& archive_path, | 719 const FilePath& archive_path, |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1591 machine_state, | 1573 machine_state, |
| 1592 setup_path, | 1574 setup_path, |
| 1593 new_version, | 1575 new_version, |
| 1594 work_item_list, | 1576 work_item_list, |
| 1595 false, // have_child_product | 1577 false, // have_child_product |
| 1596 cmd_line, | 1578 cmd_line, |
| 1597 kCmdQuickEnableApplicationHost); | 1579 kCmdQuickEnableApplicationHost); |
| 1598 } | 1580 } |
| 1599 | 1581 |
| 1600 } // namespace installer | 1582 } // namespace installer |
| OLD | NEW |