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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 if (installer_state.system_install()) { | 431 if (installer_state.system_install()) { |
| 432 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link); | 432 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link); |
| 433 } else { | 433 } else { |
| 434 PathService::Get(base::DIR_START_MENU, &uninstall_link); | 434 PathService::Get(base::DIR_START_MENU, &uninstall_link); |
| 435 } | 435 } |
| 436 | 436 |
| 437 if (uninstall_link.empty()) { | 437 if (uninstall_link.empty()) { |
| 438 LOG(ERROR) << "Failed to get location for shortcut."; | 438 LOG(ERROR) << "Failed to get location for shortcut."; |
| 439 } else { | 439 } else { |
| 440 uninstall_link = uninstall_link.Append( | 440 uninstall_link = uninstall_link.Append( |
| 441 product.distribution()->GetAppShortCutName()); | 441 product.distribution()-> |
| 442 GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name); | |
|
gab
2013/05/18 23:57:22
This is a case where GetAppShortCutName() was used
calamity
2013/05/24 02:03:11
Done.
| |
| 442 uninstall_link = uninstall_link.Append( | 443 uninstall_link = uninstall_link.Append( |
| 443 product.distribution()->GetUninstallLinkName() + installer::kLnkExt); | 444 product.distribution()->GetUninstallLinkName() + installer::kLnkExt); |
| 444 VLOG(1) << "Deleting old uninstall shortcut (if present): " | 445 VLOG(1) << "Deleting old uninstall shortcut (if present): " |
| 445 << uninstall_link.value(); | 446 << uninstall_link.value(); |
| 446 WorkItem* delete_link = work_item_list->AddDeleteTreeWorkItem( | 447 WorkItem* delete_link = work_item_list->AddDeleteTreeWorkItem( |
| 447 uninstall_link, temp_path); | 448 uninstall_link, temp_path); |
| 448 delete_link->set_ignore_failure(true); | 449 delete_link->set_ignore_failure(true); |
| 449 delete_link->set_log_message( | 450 delete_link->set_log_message( |
| 450 "Failed to delete old uninstall shortcut."); | 451 "Failed to delete old uninstall shortcut."); |
| 451 } | 452 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { | 717 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { |
| 717 // We need to quote the command line for the Add/Remove Programs dialog. | 718 // We need to quote the command line for the Add/Remove Programs dialog. |
| 718 CommandLine quoted_uninstall_cmd(installer_path); | 719 CommandLine quoted_uninstall_cmd(installer_path); |
| 719 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); | 720 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); |
| 720 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); | 721 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); |
| 721 | 722 |
| 722 string16 uninstall_reg = browser_dist->GetUninstallRegPath(); | 723 string16 uninstall_reg = browser_dist->GetUninstallRegPath(); |
| 723 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); | 724 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); |
| 724 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 725 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 725 installer::kUninstallDisplayNameField, | 726 installer::kUninstallDisplayNameField, |
| 726 browser_dist->GetAppShortCutName(), true); | 727 browser_dist-> |
| 728 GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name, | |
| 729 true); | |
| 727 install_list->AddSetRegValueWorkItem(reg_root, | 730 install_list->AddSetRegValueWorkItem(reg_root, |
| 728 uninstall_reg, installer::kUninstallStringField, | 731 uninstall_reg, installer::kUninstallStringField, |
| 729 quoted_uninstall_cmd.GetCommandLineString(), true); | 732 quoted_uninstall_cmd.GetCommandLineString(), true); |
| 730 install_list->AddSetRegValueWorkItem(reg_root, | 733 install_list->AddSetRegValueWorkItem(reg_root, |
| 731 uninstall_reg, | 734 uninstall_reg, |
| 732 L"InstallLocation", | 735 L"InstallLocation", |
| 733 install_path.value(), | 736 install_path.value(), |
| 734 true); | 737 true); |
| 735 | 738 |
| 736 BrowserDistribution* dist = product.distribution(); | 739 BrowserDistribution* dist = product.distribution(); |
| 740 BrowserDistribution::ShortcutInfo shortcut_info = | |
| 741 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME); | |
| 737 string16 chrome_icon = ShellUtil::FormatIconLocation( | 742 string16 chrome_icon = ShellUtil::FormatIconLocation( |
| 738 install_path.Append(dist->GetIconFilename()).value(), | 743 install_path.Append(shortcut_info.icon_file).value(), |
| 739 dist->GetIconIndex()); | 744 shortcut_info.icon_index); |
| 740 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 745 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 741 L"DisplayIcon", chrome_icon, true); | 746 L"DisplayIcon", chrome_icon, true); |
| 742 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 747 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 743 L"NoModify", static_cast<DWORD>(1), | 748 L"NoModify", static_cast<DWORD>(1), |
| 744 true); | 749 true); |
| 745 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 750 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 746 L"NoRepair", static_cast<DWORD>(1), | 751 L"NoRepair", static_cast<DWORD>(1), |
| 747 true); | 752 true); |
| 748 | 753 |
| 749 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 754 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 779 void AddVersionKeyWorkItems(HKEY root, | 784 void AddVersionKeyWorkItems(HKEY root, |
| 780 BrowserDistribution* dist, | 785 BrowserDistribution* dist, |
| 781 const Version& new_version, | 786 const Version& new_version, |
| 782 bool add_language_identifier, | 787 bool add_language_identifier, |
| 783 WorkItemList* list) { | 788 WorkItemList* list) { |
| 784 // Create Version key for each distribution (if not already present) and set | 789 // Create Version key for each distribution (if not already present) and set |
| 785 // the new product version as the last step. | 790 // the new product version as the last step. |
| 786 string16 version_key(dist->GetVersionKey()); | 791 string16 version_key(dist->GetVersionKey()); |
| 787 list->AddCreateRegKeyWorkItem(root, version_key); | 792 list->AddCreateRegKeyWorkItem(root, version_key); |
| 788 | 793 |
| 789 string16 product_name(dist->GetAppShortCutName()); | 794 string16 product_name( |
| 795 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name); | |
| 790 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, | 796 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, |
| 791 product_name, true); // overwrite name also | 797 product_name, true); // overwrite name also |
| 792 list->AddSetRegValueWorkItem(root, version_key, | 798 list->AddSetRegValueWorkItem(root, version_key, |
| 793 google_update::kRegOopcrashesField, | 799 google_update::kRegOopcrashesField, |
| 794 static_cast<DWORD>(1), | 800 static_cast<DWORD>(1), |
| 795 false); // set during first install | 801 false); // set during first install |
| 796 if (add_language_identifier) { | 802 if (add_language_identifier) { |
| 797 // Write the language identifier of the current translation. Omaha's set of | 803 // Write the language identifier of the current translation. Omaha's set of |
| 798 // languages is a superset of Chrome's set of translations with this one | 804 // languages is a superset of Chrome's set of translations with this one |
| 799 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. | 805 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 838 LOG(ERROR) << "No products found in AddOemInstallWorkItems"; | 844 LOG(ERROR) << "No products found in AddOemInstallWorkItems"; |
| 839 return; | 845 return; |
| 840 } | 846 } |
| 841 const ProductState* source_product = | 847 const ProductState* source_product = |
| 842 original_state.GetNonVersionedProductState(system_install, source_type); | 848 original_state.GetNonVersionedProductState(system_install, source_type); |
| 843 | 849 |
| 844 string16 oem_install; | 850 string16 oem_install; |
| 845 if (source_product->GetOemInstall(&oem_install)) { | 851 if (source_product->GetOemInstall(&oem_install)) { |
| 846 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " | 852 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " |
| 847 << BrowserDistribution::GetSpecificDistribution(source_type)-> | 853 << BrowserDistribution::GetSpecificDistribution(source_type)-> |
| 848 GetAppShortCutName(); | 854 GetDisplayName(); |
| 849 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 855 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); |
| 850 // Always overwrite an old value. | 856 // Always overwrite an old value. |
| 851 install_list->AddSetRegValueWorkItem(root_key, multi_key, | 857 install_list->AddSetRegValueWorkItem(root_key, multi_key, |
| 852 google_update::kRegOemInstallField, | 858 google_update::kRegOemInstallField, |
| 853 oem_install, true); | 859 oem_install, true); |
| 854 } else { | 860 } else { |
| 855 // Clear any old value. | 861 // Clear any old value. |
| 856 install_list->AddDeleteRegValueWorkItem( | 862 install_list->AddDeleteRegValueWorkItem( |
| 857 root_key, multi_key, google_update::kRegOemInstallField); | 863 root_key, multi_key, google_update::kRegOemInstallField); |
| 858 } | 864 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 893 (!have_eula_accepted || dword_value > eula_accepted)) { | 899 (!have_eula_accepted || dword_value > eula_accepted)) { |
| 894 have_eula_accepted = true; | 900 have_eula_accepted = true; |
| 895 eula_accepted = dword_value; | 901 eula_accepted = dword_value; |
| 896 product_type = this_type; | 902 product_type = this_type; |
| 897 } | 903 } |
| 898 } | 904 } |
| 899 | 905 |
| 900 if (have_eula_accepted) { | 906 if (have_eula_accepted) { |
| 901 VLOG(1) << "Mirroring eulaaccepted=" << eula_accepted << " from " | 907 VLOG(1) << "Mirroring eulaaccepted=" << eula_accepted << " from " |
| 902 << BrowserDistribution::GetSpecificDistribution(product_type)-> | 908 << BrowserDistribution::GetSpecificDistribution(product_type)-> |
| 903 GetAppShortCutName(); | 909 GetDisplayName(); |
| 904 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 910 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); |
| 905 install_list->AddSetRegValueWorkItem( | 911 install_list->AddSetRegValueWorkItem( |
| 906 root_key, multi_key, google_update::kRegEULAAceptedField, | 912 root_key, multi_key, google_update::kRegEULAAceptedField, |
| 907 eula_accepted, true); | 913 eula_accepted, true); |
| 908 } else { | 914 } else { |
| 909 // Clear any old value. | 915 // Clear any old value. |
| 910 install_list->AddDeleteRegValueWorkItem( | 916 install_list->AddDeleteRegValueWorkItem( |
| 911 root_key, multi_key, google_update::kRegEULAAceptedField); | 917 root_key, multi_key, google_update::kRegEULAAceptedField); |
| 912 } | 918 } |
| 913 } | 919 } |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1432 const Version& new_version, | 1438 const Version& new_version, |
| 1433 const Product& product, | 1439 const Product& product, |
| 1434 WorkItemList* list) { | 1440 WorkItemList* list) { |
| 1435 string16 handler_class_uuid; | 1441 string16 handler_class_uuid; |
| 1436 BrowserDistribution* distribution = product.distribution(); | 1442 BrowserDistribution* distribution = product.distribution(); |
| 1437 if (!distribution->GetCommandExecuteImplClsid(&handler_class_uuid)) { | 1443 if (!distribution->GetCommandExecuteImplClsid(&handler_class_uuid)) { |
| 1438 if (InstallUtil::IsChromeSxSProcess()) { | 1444 if (InstallUtil::IsChromeSxSProcess()) { |
| 1439 CleanupBadCanaryDelegateExecuteRegistration(target_path, list); | 1445 CleanupBadCanaryDelegateExecuteRegistration(target_path, list); |
| 1440 } else { | 1446 } else { |
| 1441 VLOG(1) << "No DelegateExecute verb handler processing to do for " | 1447 VLOG(1) << "No DelegateExecute verb handler processing to do for " |
| 1442 << distribution->GetAppShortCutName(); | 1448 << distribution->GetDisplayName(); |
| 1443 } | 1449 } |
| 1444 return; | 1450 return; |
| 1445 } | 1451 } |
| 1446 | 1452 |
| 1447 HKEY root = installer_state.root_key(); | 1453 HKEY root = installer_state.root_key(); |
| 1448 string16 delegate_execute_path(L"Software\\Classes\\CLSID\\"); | 1454 string16 delegate_execute_path(L"Software\\Classes\\CLSID\\"); |
| 1449 delegate_execute_path.append(handler_class_uuid); | 1455 delegate_execute_path.append(handler_class_uuid); |
| 1450 | 1456 |
| 1451 // Unconditionally remove registration regardless of whether or not it is | 1457 // Unconditionally remove registration regardless of whether or not it is |
| 1452 // needed since builds after r132190 included it when it wasn't strictly | 1458 // needed since builds after r132190 included it when it wasn't strictly |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1494 const Version& new_version, | 1500 const Version& new_version, |
| 1495 const Product& product, | 1501 const Product& product, |
| 1496 WorkItemList* list) { | 1502 WorkItemList* list) { |
| 1497 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); | 1503 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); |
| 1498 BrowserDistribution* distribution = product.distribution(); | 1504 BrowserDistribution* distribution = product.distribution(); |
| 1499 | 1505 |
| 1500 if (!product.is_chrome() || !installer_state.system_install()) { | 1506 if (!product.is_chrome() || !installer_state.system_install()) { |
| 1501 const char* install_level = | 1507 const char* install_level = |
| 1502 installer_state.system_install() ? "system" : "user"; | 1508 installer_state.system_install() ? "system" : "user"; |
| 1503 VLOG(1) << "No Active Setup processing to do for " << install_level | 1509 VLOG(1) << "No Active Setup processing to do for " << install_level |
| 1504 << "-level " << distribution->GetAppShortCutName(); | 1510 << "-level " << distribution->GetDisplayName(); |
| 1505 return; | 1511 return; |
| 1506 } | 1512 } |
| 1507 DCHECK(installer_state.RequiresActiveSetup()); | 1513 DCHECK(installer_state.RequiresActiveSetup()); |
| 1508 | 1514 |
| 1509 const HKEY root = HKEY_LOCAL_MACHINE; | 1515 const HKEY root = HKEY_LOCAL_MACHINE; |
| 1510 const string16 active_setup_path( | 1516 const string16 active_setup_path( |
| 1511 InstallUtil::GetActiveSetupPath(distribution)); | 1517 InstallUtil::GetActiveSetupPath(distribution)); |
| 1512 | 1518 |
| 1513 VLOG(1) << "Adding registration items for Active Setup."; | 1519 VLOG(1) << "Adding registration items for Active Setup."; |
| 1514 list->AddCreateRegKeyWorkItem(root, active_setup_path); | 1520 list->AddCreateRegKeyWorkItem(root, active_setup_path); |
| 1515 list->AddSetRegValueWorkItem(root, active_setup_path, L"", | 1521 list->AddSetRegValueWorkItem(root, active_setup_path, L"", |
| 1516 distribution->GetAppShortCutName(), true); | 1522 distribution->GetDisplayName(), true); |
| 1517 | 1523 |
| 1518 base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( | 1524 base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( |
| 1519 new_version).Append(kActiveSetupExe)); | 1525 new_version).Append(kActiveSetupExe)); |
| 1520 CommandLine cmd(active_setup_exe); | 1526 CommandLine cmd(active_setup_exe); |
| 1521 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); | 1527 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); |
| 1522 cmd.AppendSwitch(installer::switches::kVerboseLogging); | 1528 cmd.AppendSwitch(installer::switches::kVerboseLogging); |
| 1523 cmd.AppendSwitch(installer::switches::kSystemLevel); | 1529 cmd.AppendSwitch(installer::switches::kSystemLevel); |
| 1524 product.AppendProductFlags(&cmd); | 1530 product.AppendProductFlags(&cmd); |
| 1525 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", | 1531 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", |
| 1526 cmd.GetCommandLineString(), true); | 1532 cmd.GetCommandLineString(), true); |
| 1527 | 1533 |
| 1528 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 1534 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
| 1529 // resource. | 1535 // resource. |
| 1530 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", | 1536 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", |
| 1531 distribution->GetAppShortCutName(), true); | 1537 distribution->GetDisplayName(), true); |
| 1532 | 1538 |
| 1533 list->AddSetRegValueWorkItem(root, active_setup_path, L"IsInstalled", | 1539 list->AddSetRegValueWorkItem(root, active_setup_path, L"IsInstalled", |
| 1534 static_cast<DWORD>(1U), true); | 1540 static_cast<DWORD>(1U), true); |
| 1535 | 1541 |
| 1536 list->AddSetRegValueWorkItem(root, active_setup_path, L"Version", | 1542 list->AddSetRegValueWorkItem(root, active_setup_path, L"Version", |
| 1537 kActiveSetupVersion, true); | 1543 kActiveSetupVersion, true); |
| 1538 } | 1544 } |
| 1539 | 1545 |
| 1540 void AddDeleteOldIELowRightsPolicyWorkItems( | 1546 void AddDeleteOldIELowRightsPolicyWorkItems( |
| 1541 const InstallerState& installer_state, | 1547 const InstallerState& installer_state, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1712 if (installer_state.system_install()) | 1718 if (installer_state.system_install()) |
| 1713 cmd_line.AppendSwitch(switches::kSystemLevel); | 1719 cmd_line.AppendSwitch(switches::kSystemLevel); |
| 1714 AppCommand cmd(cmd_line.GetCommandLineString()); | 1720 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 1715 cmd.set_sends_pings(true); | 1721 cmd.set_sends_pings(true); |
| 1716 cmd.set_is_web_accessible(true); | 1722 cmd.set_is_web_accessible(true); |
| 1717 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 1723 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
| 1718 } | 1724 } |
| 1719 } | 1725 } |
| 1720 | 1726 |
| 1721 } // namespace installer | 1727 } // namespace installer |
| OLD | NEW |