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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 WorkItemList* work_item_list) { | 207 WorkItemList* work_item_list) { |
208 DCHECK(command_key); | 208 DCHECK(command_key); |
209 DCHECK(app); | 209 DCHECK(app); |
210 DCHECK(command_with_parameter); | 210 DCHECK(command_with_parameter); |
211 DCHECK(work_item_list); | 211 DCHECK(work_item_list); |
212 | 212 |
213 base::string16 full_cmd_key( | 213 base::string16 full_cmd_key( |
214 GetRegCommandKey(product.distribution(), command_key)); | 214 GetRegCommandKey(product.distribution(), command_key)); |
215 | 215 |
216 if (installer_state.operation() == InstallerState::UNINSTALL) { | 216 if (installer_state.operation() == InstallerState::UNINSTALL) { |
217 work_item_list->AddDeleteRegKeyWorkItem( | 217 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
218 installer_state.root_key(), full_cmd_key)->set_log_message( | 218 full_cmd_key, |
219 "removing " + base::UTF16ToASCII(command_key) + " command"); | 219 WorkItem::kWow64Default) |
220 ->set_log_message("removing " + base::UTF16ToASCII(command_key) + | |
221 " command"); | |
220 } else { | 222 } else { |
221 CommandLine cmd_line(installer_state.target_path().Append(app)); | 223 CommandLine cmd_line(installer_state.target_path().Append(app)); |
222 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); | 224 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); |
223 | 225 |
224 AppCommand cmd(cmd_line.GetCommandLineString()); | 226 AppCommand cmd(cmd_line.GetCommandLineString()); |
225 cmd.set_sends_pings(true); | 227 cmd.set_sends_pings(true); |
226 cmd.set_is_web_accessible(true); | 228 cmd.set_is_web_accessible(true); |
227 cmd.set_is_run_as_user(true); | 229 cmd.set_is_run_as_user(true); |
228 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); | 230 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); |
229 } | 231 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 const base::FilePath& temp_path, | 435 const base::FilePath& temp_path, |
434 WorkItemList* work_item_list) { | 436 WorkItemList* work_item_list) { |
435 DCHECK(installer_state.is_msi()) | 437 DCHECK(installer_state.is_msi()) |
436 << "This must only be called for MSI installations!"; | 438 << "This must only be called for MSI installations!"; |
437 | 439 |
438 // First attempt to delete the old installation's ARP dialog entry. | 440 // First attempt to delete the old installation's ARP dialog entry. |
439 HKEY reg_root = installer_state.root_key(); | 441 HKEY reg_root = installer_state.root_key(); |
440 base::string16 uninstall_reg(product.distribution()->GetUninstallRegPath()); | 442 base::string16 uninstall_reg(product.distribution()->GetUninstallRegPath()); |
441 | 443 |
442 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( | 444 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( |
443 reg_root, uninstall_reg); | 445 reg_root, uninstall_reg, WorkItem::kWow64Default); |
444 delete_reg_key->set_ignore_failure(true); | 446 delete_reg_key->set_ignore_failure(true); |
445 | 447 |
446 // Then attempt to delete the old installation's start menu shortcut. | 448 // Then attempt to delete the old installation's start menu shortcut. |
447 base::FilePath uninstall_link; | 449 base::FilePath uninstall_link; |
448 if (installer_state.system_install()) { | 450 if (installer_state.system_install()) { |
449 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link); | 451 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link); |
450 } else { | 452 } else { |
451 PathService::Get(base::DIR_START_MENU, &uninstall_link); | 453 PathService::Get(base::DIR_START_MENU, &uninstall_link); |
452 } | 454 } |
453 | 455 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 | 604 |
603 return true; | 605 return true; |
604 } | 606 } |
605 | 607 |
606 void AddUninstallDelegateExecuteWorkItems( | 608 void AddUninstallDelegateExecuteWorkItems( |
607 HKEY root, | 609 HKEY root, |
608 const base::string16& delegate_execute_path, | 610 const base::string16& delegate_execute_path, |
609 WorkItemList* list) { | 611 WorkItemList* list) { |
610 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler in " | 612 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler in " |
611 << root; | 613 << root; |
612 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path); | 614 list->AddDeleteRegKeyWorkItem(root, |
615 delegate_execute_path, | |
616 WorkItem::kWow64Default); | |
613 | 617 |
614 // In the past, the ICommandExecuteImpl interface and a TypeLib were both | 618 // In the past, the ICommandExecuteImpl interface and a TypeLib were both |
615 // registered. Remove these since this operation may be updating a machine | 619 // registered. Remove these since this operation may be updating a machine |
616 // that had the old registrations. | 620 // that had the old registrations. |
617 list->AddDeleteRegKeyWorkItem(root, | 621 list->AddDeleteRegKeyWorkItem(root, |
618 L"Software\\Classes\\Interface\\" | 622 L"Software\\Classes\\Interface\\" |
619 L"{0BA0D4E9-2259-4963-B9AE-A839F7CB7544}"); | 623 L"{0BA0D4E9-2259-4963-B9AE-A839F7CB7544}", |
624 WorkItem::kWow64Default); | |
620 list->AddDeleteRegKeyWorkItem(root, | 625 list->AddDeleteRegKeyWorkItem(root, |
621 L"Software\\Classes\\TypeLib\\" | 626 L"Software\\Classes\\TypeLib\\" |
622 #if defined(GOOGLE_CHROME_BUILD) | 627 #if defined(GOOGLE_CHROME_BUILD) |
623 L"{4E805ED8-EBA0-4601-9681-12815A56EBFD}" | 628 L"{4E805ED8-EBA0-4601-9681-12815A56EBFD}", |
624 #else | 629 #else |
625 L"{7779FB70-B399-454A-AA1A-BAA850032B10}" | 630 L"{7779FB70-B399-454A-AA1A-BAA850032B10}", |
626 #endif | 631 #endif |
627 ); | 632 WorkItem::kWow64Default); |
628 } | 633 } |
629 | 634 |
630 // Google Chrome Canary, between 20.0.1101.0 (crrev.com/132190) and 20.0.1106.0 | 635 // Google Chrome Canary, between 20.0.1101.0 (crrev.com/132190) and 20.0.1106.0 |
631 // (exclusively -- crrev.com/132596), registered a DelegateExecute class by | 636 // (exclusively -- crrev.com/132596), registered a DelegateExecute class by |
632 // mistake (with the same GUID as Chrome). The fix stopped registering the bad | 637 // mistake (with the same GUID as Chrome). The fix stopped registering the bad |
633 // value, but didn't delete it. This is a problem for users who had installed | 638 // value, but didn't delete it. This is a problem for users who had installed |
634 // Canary before 20.0.1106.0 and now have a system-level Chrome, as the | 639 // Canary before 20.0.1106.0 and now have a system-level Chrome, as the |
635 // left-behind Canary registrations in HKCU mask the HKLM registrations for the | 640 // left-behind Canary registrations in HKCU mask the HKLM registrations for the |
636 // same GUID. Cleanup those registrations if they still exist and belong to this | 641 // same GUID. Cleanup those registrations if they still exist and belong to this |
637 // Canary (i.e., the registered delegate_execute's path is under |target_path|). | 642 // Canary (i.e., the registered delegate_execute's path is under |target_path|). |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 base::FilePath install_path(installer_state.target_path()); | 691 base::FilePath install_path(installer_state.target_path()); |
687 base::FilePath installer_path( | 692 base::FilePath installer_path( |
688 installer_state.GetInstallerDirectory(new_version)); | 693 installer_state.GetInstallerDirectory(new_version)); |
689 installer_path = installer_path.Append(setup_path.BaseName()); | 694 installer_path = installer_path.Append(setup_path.BaseName()); |
690 | 695 |
691 CommandLine uninstall_arguments(CommandLine::NO_PROGRAM); | 696 CommandLine uninstall_arguments(CommandLine::NO_PROGRAM); |
692 AppendUninstallCommandLineFlags(installer_state, product, | 697 AppendUninstallCommandLineFlags(installer_state, product, |
693 &uninstall_arguments); | 698 &uninstall_arguments); |
694 | 699 |
695 base::string16 update_state_key(browser_dist->GetStateKey()); | 700 base::string16 update_state_key(browser_dist->GetStateKey()); |
696 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); | 701 install_list->AddCreateRegKeyWorkItem( |
697 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 702 reg_root, update_state_key, WorkItem::kWow64Default); |
698 installer::kUninstallStringField, installer_path.value(), true); | 703 install_list->AddSetRegValueWorkItem(reg_root, |
699 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 704 update_state_key, |
705 installer::kUninstallStringField, | |
706 installer_path.value(), | |
707 true, | |
708 WorkItem::kWow64Default); | |
709 install_list->AddSetRegValueWorkItem( | |
710 reg_root, | |
711 update_state_key, | |
700 installer::kUninstallArgumentsField, | 712 installer::kUninstallArgumentsField, |
701 uninstall_arguments.GetCommandLineString(), true); | 713 uninstall_arguments.GetCommandLineString(), |
714 true, | |
715 WorkItem::kWow64Default); | |
702 | 716 |
703 // MSI installations will manage their own uninstall shortcuts. | 717 // MSI installations will manage their own uninstall shortcuts. |
704 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { | 718 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { |
705 // We need to quote the command line for the Add/Remove Programs dialog. | 719 // We need to quote the command line for the Add/Remove Programs dialog. |
706 CommandLine quoted_uninstall_cmd(installer_path); | 720 CommandLine quoted_uninstall_cmd(installer_path); |
707 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); | 721 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); |
708 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); | 722 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); |
709 | 723 |
710 base::string16 uninstall_reg = browser_dist->GetUninstallRegPath(); | 724 base::string16 uninstall_reg = browser_dist->GetUninstallRegPath(); |
711 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); | 725 install_list->AddCreateRegKeyWorkItem( |
712 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 726 reg_root, uninstall_reg, WorkItem::kWow64Default); |
713 installer::kUninstallDisplayNameField, browser_dist->GetDisplayName(), | |
714 true); | |
715 install_list->AddSetRegValueWorkItem(reg_root, | 727 install_list->AddSetRegValueWorkItem(reg_root, |
716 uninstall_reg, installer::kUninstallStringField, | 728 uninstall_reg, |
717 quoted_uninstall_cmd.GetCommandLineString(), true); | 729 installer::kUninstallDisplayNameField, |
730 browser_dist->GetDisplayName(), | |
731 true, | |
732 WorkItem::kWow64Default); | |
733 install_list->AddSetRegValueWorkItem( | |
734 reg_root, | |
735 uninstall_reg, | |
736 installer::kUninstallStringField, | |
737 quoted_uninstall_cmd.GetCommandLineString(), | |
738 true, | |
739 WorkItem::kWow64Default); | |
718 install_list->AddSetRegValueWorkItem(reg_root, | 740 install_list->AddSetRegValueWorkItem(reg_root, |
719 uninstall_reg, | 741 uninstall_reg, |
720 L"InstallLocation", | 742 L"InstallLocation", |
721 install_path.value(), | 743 install_path.value(), |
722 true); | 744 true, |
745 WorkItem::kWow64Default); | |
723 | 746 |
724 BrowserDistribution* dist = product.distribution(); | 747 BrowserDistribution* dist = product.distribution(); |
725 base::string16 chrome_icon = ShellUtil::FormatIconLocation( | 748 base::string16 chrome_icon = ShellUtil::FormatIconLocation( |
726 install_path.Append(dist->GetIconFilename()).value(), | 749 install_path.Append(dist->GetIconFilename()).value(), |
727 dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); | 750 dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); |
728 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 751 install_list->AddSetRegValueWorkItem(reg_root, |
729 L"DisplayIcon", chrome_icon, true); | 752 uninstall_reg, |
730 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 753 L"DisplayIcon", |
731 L"NoModify", static_cast<DWORD>(1), | 754 chrome_icon, |
732 true); | 755 true, |
733 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 756 WorkItem::kWow64Default); |
734 L"NoRepair", static_cast<DWORD>(1), | 757 install_list->AddSetRegValueWorkItem(reg_root, |
735 true); | 758 uninstall_reg, |
759 L"NoModify", | |
760 static_cast<DWORD>(1), | |
761 true, | |
762 WorkItem::kWow64Default); | |
763 install_list->AddSetRegValueWorkItem(reg_root, | |
764 uninstall_reg, | |
765 L"NoRepair", | |
766 static_cast<DWORD>(1), | |
767 true, | |
768 WorkItem::kWow64Default); | |
736 | 769 |
737 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 770 install_list->AddSetRegValueWorkItem(reg_root, |
771 uninstall_reg, | |
738 L"Publisher", | 772 L"Publisher", |
739 browser_dist->GetPublisherName(), | 773 browser_dist->GetPublisherName(), |
740 true); | 774 true, |
741 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 775 WorkItem::kWow64Default); |
776 install_list->AddSetRegValueWorkItem(reg_root, | |
777 uninstall_reg, | |
742 L"Version", | 778 L"Version", |
743 ASCIIToWide(new_version.GetString()), | 779 ASCIIToWide(new_version.GetString()), |
744 true); | 780 true, |
745 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 781 WorkItem::kWow64Default); |
782 install_list->AddSetRegValueWorkItem(reg_root, | |
783 uninstall_reg, | |
746 L"DisplayVersion", | 784 L"DisplayVersion", |
747 ASCIIToWide(new_version.GetString()), | 785 ASCIIToWide(new_version.GetString()), |
748 true); | 786 true, |
749 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 787 WorkItem::kWow64Default); |
788 install_list->AddSetRegValueWorkItem(reg_root, | |
789 uninstall_reg, | |
750 L"InstallDate", | 790 L"InstallDate", |
751 InstallUtil::GetCurrentDate(), | 791 InstallUtil::GetCurrentDate(), |
752 false); | 792 false, |
793 WorkItem::kWow64Default); | |
753 | 794 |
754 const std::vector<uint16>& version_components = new_version.components(); | 795 const std::vector<uint16>& version_components = new_version.components(); |
755 if (version_components.size() == 4) { | 796 if (version_components.size() == 4) { |
756 // Our version should be in major.minor.build.rev. | 797 // Our version should be in major.minor.build.rev. |
757 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 798 install_list->AddSetRegValueWorkItem( |
758 L"VersionMajor", static_cast<DWORD>(version_components[2]), true); | 799 reg_root, |
759 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 800 uninstall_reg, |
760 L"VersionMinor", static_cast<DWORD>(version_components[3]), true); | 801 L"VersionMajor", |
802 static_cast<DWORD>(version_components[2]), | |
803 true, | |
804 WorkItem::kWow64Default); | |
805 install_list->AddSetRegValueWorkItem( | |
806 reg_root, | |
807 uninstall_reg, | |
808 L"VersionMinor", | |
809 static_cast<DWORD>(version_components[3]), | |
810 true, | |
811 WorkItem::kWow64Default); | |
761 } | 812 } |
762 } | 813 } |
763 } | 814 } |
764 | 815 |
765 // Create Version key for a product (if not already present) and sets the new | 816 // Create Version key for a product (if not already present) and sets the new |
766 // product version as the last step. | 817 // product version as the last step. |
767 void AddVersionKeyWorkItems(HKEY root, | 818 void AddVersionKeyWorkItems(HKEY root, |
768 BrowserDistribution* dist, | 819 BrowserDistribution* dist, |
769 const Version& new_version, | 820 const Version& new_version, |
770 bool add_language_identifier, | 821 bool add_language_identifier, |
771 WorkItemList* list) { | 822 WorkItemList* list) { |
772 // Create Version key for each distribution (if not already present) and set | 823 // Create Version key for each distribution (if not already present) and set |
773 // the new product version as the last step. | 824 // the new product version as the last step. |
774 base::string16 version_key(dist->GetVersionKey()); | 825 base::string16 version_key(dist->GetVersionKey()); |
775 list->AddCreateRegKeyWorkItem(root, version_key); | 826 list->AddCreateRegKeyWorkItem(root, version_key, WorkItem::kWow64Default); |
776 | 827 |
777 base::string16 product_name(dist->GetDisplayName()); | 828 base::string16 product_name(dist->GetDisplayName()); |
778 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, | 829 list->AddSetRegValueWorkItem(root, |
779 product_name, true); // overwrite name also | 830 version_key, |
780 list->AddSetRegValueWorkItem(root, version_key, | 831 google_update::kRegNameField, |
832 product_name, | |
833 true, // overwrite name also | |
834 WorkItem::kWow64Default); | |
835 list->AddSetRegValueWorkItem(root, | |
836 version_key, | |
781 google_update::kRegOopcrashesField, | 837 google_update::kRegOopcrashesField, |
782 static_cast<DWORD>(1), | 838 static_cast<DWORD>(1), |
783 false); // set during first install | 839 false, // set during first install |
840 WorkItem::kWow64Default); | |
784 if (add_language_identifier) { | 841 if (add_language_identifier) { |
785 // Write the language identifier of the current translation. Omaha's set of | 842 // Write the language identifier of the current translation. Omaha's set of |
786 // languages is a superset of Chrome's set of translations with this one | 843 // languages is a superset of Chrome's set of translations with this one |
787 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. | 844 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. |
788 base::string16 language(GetCurrentTranslation()); | 845 base::string16 language(GetCurrentTranslation()); |
789 if (LowerCaseEqualsASCII(language, "en-us")) | 846 if (LowerCaseEqualsASCII(language, "en-us")) |
790 language.resize(2); | 847 language.resize(2); |
791 list->AddSetRegValueWorkItem(root, version_key, | 848 list->AddSetRegValueWorkItem(root, |
792 google_update::kRegLangField, language, | 849 version_key, |
793 false); // do not overwrite language | 850 google_update::kRegLangField, |
851 language, | |
852 false, // do not overwrite language | |
853 WorkItem::kWow64Default); | |
794 } | 854 } |
795 list->AddSetRegValueWorkItem(root, version_key, | 855 list->AddSetRegValueWorkItem(root, |
856 version_key, | |
796 google_update::kRegVersionField, | 857 google_update::kRegVersionField, |
797 ASCIIToWide(new_version.GetString()), | 858 ASCIIToWide(new_version.GetString()), |
798 true); // overwrite version | 859 true, // overwrite version |
860 WorkItem::kWow64Default); | |
799 } | 861 } |
800 | 862 |
801 // Mirror oeminstall the first time anything is installed multi. There is no | 863 // Mirror oeminstall the first time anything is installed multi. There is no |
802 // need to update the value on future install/update runs since this value never | 864 // need to update the value on future install/update runs since this value never |
803 // changes. Note that the value is removed by Google Update after EULA | 865 // changes. Note that the value is removed by Google Update after EULA |
804 // acceptance is processed. | 866 // acceptance is processed. |
805 void AddOemInstallWorkItems(const InstallationState& original_state, | 867 void AddOemInstallWorkItems(const InstallationState& original_state, |
806 const InstallerState& installer_state, | 868 const InstallerState& installer_state, |
807 WorkItemList* install_list) { | 869 WorkItemList* install_list) { |
808 DCHECK(installer_state.is_multi_install()); | 870 DCHECK(installer_state.is_multi_install()); |
(...skipping 18 matching lines...) Expand all Loading... | |
827 return; | 889 return; |
828 } | 890 } |
829 const ProductState* source_product = | 891 const ProductState* source_product = |
830 original_state.GetNonVersionedProductState(system_install, source_type); | 892 original_state.GetNonVersionedProductState(system_install, source_type); |
831 | 893 |
832 base::string16 oem_install; | 894 base::string16 oem_install; |
833 if (source_product->GetOemInstall(&oem_install)) { | 895 if (source_product->GetOemInstall(&oem_install)) { |
834 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " | 896 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " |
835 << BrowserDistribution::GetSpecificDistribution(source_type)-> | 897 << BrowserDistribution::GetSpecificDistribution(source_type)-> |
836 GetDisplayName(); | 898 GetDisplayName(); |
837 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 899 install_list->AddCreateRegKeyWorkItem( |
900 root_key, multi_key, WorkItem::kWow64Default); | |
838 // Always overwrite an old value. | 901 // Always overwrite an old value. |
839 install_list->AddSetRegValueWorkItem(root_key, multi_key, | 902 install_list->AddSetRegValueWorkItem(root_key, |
903 multi_key, | |
840 google_update::kRegOemInstallField, | 904 google_update::kRegOemInstallField, |
841 oem_install, true); | 905 oem_install, |
906 true, | |
907 WorkItem::kWow64Default); | |
842 } else { | 908 } else { |
843 // Clear any old value. | 909 // Clear any old value. |
844 install_list->AddDeleteRegValueWorkItem( | 910 install_list->AddDeleteRegValueWorkItem( |
845 root_key, multi_key, google_update::kRegOemInstallField); | 911 root_key, |
912 multi_key, | |
913 google_update::kRegOemInstallField, | |
914 WorkItem::kWow64Default); | |
846 } | 915 } |
847 } | 916 } |
848 } | 917 } |
849 | 918 |
850 // Mirror eulaaccepted the first time anything is installed multi. There is no | 919 // Mirror eulaaccepted the first time anything is installed multi. There is no |
851 // need to update the value on future install/update runs since | 920 // need to update the value on future install/update runs since |
852 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the | 921 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the |
853 // relevant product and for the binaries. | 922 // relevant product and for the binaries. |
854 void AddEulaAcceptedWorkItems(const InstallationState& original_state, | 923 void AddEulaAcceptedWorkItems(const InstallationState& original_state, |
855 const InstallerState& installer_state, | 924 const InstallerState& installer_state, |
(...skipping 26 matching lines...) Expand all Loading... | |
882 have_eula_accepted = true; | 951 have_eula_accepted = true; |
883 eula_accepted = dword_value; | 952 eula_accepted = dword_value; |
884 product_type = this_type; | 953 product_type = this_type; |
885 } | 954 } |
886 } | 955 } |
887 | 956 |
888 if (have_eula_accepted) { | 957 if (have_eula_accepted) { |
889 VLOG(1) << "Mirroring eulaaccepted=" << eula_accepted << " from " | 958 VLOG(1) << "Mirroring eulaaccepted=" << eula_accepted << " from " |
890 << BrowserDistribution::GetSpecificDistribution(product_type)-> | 959 << BrowserDistribution::GetSpecificDistribution(product_type)-> |
891 GetDisplayName(); | 960 GetDisplayName(); |
892 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 961 install_list->AddCreateRegKeyWorkItem( |
893 install_list->AddSetRegValueWorkItem( | 962 root_key, multi_key, WorkItem::kWow64Default); |
894 root_key, multi_key, google_update::kRegEULAAceptedField, | 963 install_list->AddSetRegValueWorkItem(root_key, |
895 eula_accepted, true); | 964 multi_key, |
965 google_update::kRegEULAAceptedField, | |
966 eula_accepted, | |
967 true, | |
968 WorkItem::kWow64Default); | |
896 } else { | 969 } else { |
897 // Clear any old value. | 970 // Clear any old value. |
898 install_list->AddDeleteRegValueWorkItem( | 971 install_list->AddDeleteRegValueWorkItem( |
899 root_key, multi_key, google_update::kRegEULAAceptedField); | 972 root_key, |
973 multi_key, | |
974 google_update::kRegEULAAceptedField, | |
975 WorkItem::kWow64Default); | |
900 } | 976 } |
901 } | 977 } |
902 } | 978 } |
903 | 979 |
904 // Adds work items that make registry adjustments for Google Update. | 980 // Adds work items that make registry adjustments for Google Update. |
905 void AddGoogleUpdateWorkItems(const InstallationState& original_state, | 981 void AddGoogleUpdateWorkItems(const InstallationState& original_state, |
906 const InstallerState& installer_state, | 982 const InstallerState& installer_state, |
907 WorkItemList* install_list) { | 983 WorkItemList* install_list) { |
908 // Is a multi-install product being installed or over-installed? | 984 // Is a multi-install product being installed or over-installed? |
909 if (installer_state.operation() != InstallerState::MULTI_INSTALL && | 985 if (installer_state.operation() != InstallerState::MULTI_INSTALL && |
910 installer_state.operation() != InstallerState::MULTI_UPDATE) { | 986 installer_state.operation() != InstallerState::MULTI_UPDATE) { |
911 VLOG(1) << "AddGoogleUpdateWorkItems noop: " << installer_state.operation(); | 987 VLOG(1) << "AddGoogleUpdateWorkItems noop: " << installer_state.operation(); |
912 return; | 988 return; |
913 } | 989 } |
914 | 990 |
915 const bool system_install = installer_state.system_install(); | 991 const bool system_install = installer_state.system_install(); |
916 const HKEY root_key = installer_state.root_key(); | 992 const HKEY root_key = installer_state.root_key(); |
917 base::string16 multi_key( | 993 base::string16 multi_key( |
918 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 994 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
919 | 995 |
920 // For system-level installs, make sure the ClientStateMedium key for the | 996 // For system-level installs, make sure the ClientStateMedium key for the |
921 // binaries exists. | 997 // binaries exists. |
922 if (system_install) { | 998 if (system_install) { |
923 install_list->AddCreateRegKeyWorkItem( | 999 install_list->AddCreateRegKeyWorkItem( |
924 root_key, | 1000 root_key, |
925 installer_state.multi_package_binaries_distribution()-> | 1001 installer_state.multi_package_binaries_distribution() |
926 GetStateMediumKey().c_str()); | 1002 ->GetStateMediumKey() |
1003 .c_str(), | |
grt (UTC plus 2)
2014/05/21 16:41:05
please move this up to the previous line. i think
Will Harris
2014/05/21 23:23:16
Done.
| |
1004 WorkItem::kWow64Default); | |
927 } | 1005 } |
928 | 1006 |
929 // Creating the ClientState key for binaries, if we're migrating to multi then | 1007 // Creating the ClientState key for binaries, if we're migrating to multi then |
930 // copy over Chrome's brand code if it has one. | 1008 // copy over Chrome's brand code if it has one. |
931 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { | 1009 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { |
932 const ProductState* chrome_product_state = | 1010 const ProductState* chrome_product_state = |
933 original_state.GetNonVersionedProductState( | 1011 original_state.GetNonVersionedProductState( |
934 system_install, BrowserDistribution::CHROME_BROWSER); | 1012 system_install, BrowserDistribution::CHROME_BROWSER); |
935 | 1013 |
936 const base::string16& brand(chrome_product_state->brand()); | 1014 const base::string16& brand(chrome_product_state->brand()); |
937 if (!brand.empty()) { | 1015 if (!brand.empty()) { |
938 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 1016 install_list->AddCreateRegKeyWorkItem( |
1017 root_key, multi_key, WorkItem::kWow64Default); | |
939 // Write Chrome's brand code to the multi key. Never overwrite the value | 1018 // Write Chrome's brand code to the multi key. Never overwrite the value |
940 // if one is already present (although this shouldn't happen). | 1019 // if one is already present (although this shouldn't happen). |
941 install_list->AddSetRegValueWorkItem(root_key, | 1020 install_list->AddSetRegValueWorkItem(root_key, |
942 multi_key, | 1021 multi_key, |
943 google_update::kRegBrandField, | 1022 google_update::kRegBrandField, |
944 brand, | 1023 brand, |
945 false); | 1024 false, |
1025 WorkItem::kWow64Default); | |
946 } | 1026 } |
947 } | 1027 } |
948 | 1028 |
949 AddOemInstallWorkItems(original_state, installer_state, install_list); | 1029 AddOemInstallWorkItems(original_state, installer_state, install_list); |
950 AddEulaAcceptedWorkItems(original_state, installer_state, install_list); | 1030 AddEulaAcceptedWorkItems(original_state, installer_state, install_list); |
951 AddUsageStatsWorkItems(original_state, installer_state, install_list); | 1031 AddUsageStatsWorkItems(original_state, installer_state, install_list); |
952 | 1032 |
953 // TODO(grt): check for other keys/values we should put in the package's | 1033 // TODO(grt): check for other keys/values we should put in the package's |
954 // ClientState and/or Clients key. | 1034 // ClientState and/or Clients key. |
955 } | 1035 } |
(...skipping 19 matching lines...) Expand all Loading... | |
975 original_state.GetNonVersionedProductState( | 1055 original_state.GetNonVersionedProductState( |
976 installer_state.system_install(), dist->GetType()); | 1056 installer_state.system_install(), dist->GetType()); |
977 value_found = product_state->GetUsageStats(&usagestats); | 1057 value_found = product_state->GetUsageStats(&usagestats); |
978 } | 1058 } |
979 | 1059 |
980 // If a value was found, write it in the appropriate location for the | 1060 // If a value was found, write it in the appropriate location for the |
981 // binaries and remove all values from the products. | 1061 // binaries and remove all values from the products. |
982 if (value_found) { | 1062 if (value_found) { |
983 base::string16 state_key( | 1063 base::string16 state_key( |
984 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 1064 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
985 install_list->AddCreateRegKeyWorkItem(root_key, state_key); | 1065 install_list->AddCreateRegKeyWorkItem( |
1066 root_key, state_key, WorkItem::kWow64Default); | |
986 // Overwrite any existing value so that overinstalls (where Omaha writes a | 1067 // Overwrite any existing value so that overinstalls (where Omaha writes a |
987 // new value into a product's state key) pick up the correct value. | 1068 // new value into a product's state key) pick up the correct value. |
988 install_list->AddSetRegValueWorkItem(root_key, state_key, | 1069 install_list->AddSetRegValueWorkItem(root_key, |
1070 state_key, | |
989 google_update::kRegUsageStatsField, | 1071 google_update::kRegUsageStatsField, |
990 usagestats, true); | 1072 usagestats, |
1073 true, | |
1074 WorkItem::kWow64Default); | |
991 | 1075 |
992 for (Products::const_iterator scan = products.begin(), end = products.end(); | 1076 for (Products::const_iterator scan = products.begin(), end = products.end(); |
993 scan != end; ++scan) { | 1077 scan != end; ++scan) { |
994 if ((*scan)->is_chrome_binaries()) | 1078 if ((*scan)->is_chrome_binaries()) |
995 continue; | 1079 continue; |
996 BrowserDistribution* dist = (*scan)->distribution(); | 1080 BrowserDistribution* dist = (*scan)->distribution(); |
997 if (installer_state.system_install()) { | 1081 if (installer_state.system_install()) { |
998 install_list->AddDeleteRegValueWorkItem( | 1082 install_list->AddDeleteRegValueWorkItem( |
999 root_key, dist->GetStateMediumKey(), | 1083 root_key, |
1000 google_update::kRegUsageStatsField); | 1084 dist->GetStateMediumKey(), |
1085 google_update::kRegUsageStatsField, | |
1086 WorkItem::kWow64Default); | |
1001 // Previous versions of Chrome also wrote a value in HKCU even for | 1087 // Previous versions of Chrome also wrote a value in HKCU even for |
1002 // system-level installs, so clean that up. | 1088 // system-level installs, so clean that up. |
1003 install_list->AddDeleteRegValueWorkItem( | 1089 install_list->AddDeleteRegValueWorkItem( |
1004 HKEY_CURRENT_USER, dist->GetStateKey(), | 1090 HKEY_CURRENT_USER, |
1005 google_update::kRegUsageStatsField); | 1091 dist->GetStateKey(), |
1092 google_update::kRegUsageStatsField, | |
1093 WorkItem::kWow64Default); | |
1006 } | 1094 } |
1007 install_list->AddDeleteRegValueWorkItem( | 1095 install_list->AddDeleteRegValueWorkItem( |
1008 root_key, dist->GetStateKey(), google_update::kRegUsageStatsField); | 1096 root_key, |
1097 dist->GetStateKey(), | |
1098 google_update::kRegUsageStatsField, | |
1099 WorkItem::kWow64Default); | |
1009 } | 1100 } |
1010 } | 1101 } |
1011 } | 1102 } |
1012 | 1103 |
1013 bool AppendPostInstallTasks(const InstallerState& installer_state, | 1104 bool AppendPostInstallTasks(const InstallerState& installer_state, |
1014 const base::FilePath& setup_path, | 1105 const base::FilePath& setup_path, |
1015 const Version* current_version, | 1106 const Version* current_version, |
1016 const Version& new_version, | 1107 const Version& new_version, |
1017 const base::FilePath& temp_path, | 1108 const base::FilePath& temp_path, |
1018 WorkItemList* post_install_task_list) { | 1109 WorkItemList* post_install_task_list) { |
(...skipping 29 matching lines...) Expand all Loading... | |
1048 | 1139 |
1049 if (installer_state.verbose_logging()) | 1140 if (installer_state.verbose_logging()) |
1050 rename.AppendSwitch(switches::kVerboseLogging); | 1141 rename.AppendSwitch(switches::kVerboseLogging); |
1051 | 1142 |
1052 base::string16 version_key; | 1143 base::string16 version_key; |
1053 for (size_t i = 0; i < products.size(); ++i) { | 1144 for (size_t i = 0; i < products.size(); ++i) { |
1054 BrowserDistribution* dist = products[i]->distribution(); | 1145 BrowserDistribution* dist = products[i]->distribution(); |
1055 version_key = dist->GetVersionKey(); | 1146 version_key = dist->GetVersionKey(); |
1056 | 1147 |
1057 if (current_version) { | 1148 if (current_version) { |
1058 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 1149 in_use_update_work_items->AddSetRegValueWorkItem( |
1150 root, | |
1151 version_key, | |
1059 google_update::kRegOldVersionField, | 1152 google_update::kRegOldVersionField, |
1060 ASCIIToWide(current_version->GetString()), true); | 1153 ASCIIToWide(current_version->GetString()), |
1154 true, | |
1155 WorkItem::kWow64Default); | |
1061 } | 1156 } |
1062 if (critical_version.IsValid()) { | 1157 if (critical_version.IsValid()) { |
1063 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 1158 in_use_update_work_items->AddSetRegValueWorkItem( |
1159 root, | |
1160 version_key, | |
1064 google_update::kRegCriticalVersionField, | 1161 google_update::kRegCriticalVersionField, |
1065 ASCIIToWide(critical_version.GetString()), true); | 1162 ASCIIToWide(critical_version.GetString()), |
1163 true, | |
1164 WorkItem::kWow64Default); | |
1066 } else { | 1165 } else { |
1067 in_use_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1166 in_use_update_work_items->AddDeleteRegValueWorkItem( |
1068 google_update::kRegCriticalVersionField); | 1167 root, |
1168 version_key, | |
1169 google_update::kRegCriticalVersionField, | |
1170 WorkItem::kWow64Default); | |
1069 } | 1171 } |
1070 | 1172 |
1071 // Adding this registry entry for all products (but the binaries) is | 1173 // Adding this registry entry for all products (but the binaries) is |
1072 // overkill. However, as it stands, we don't have a way to know which | 1174 // overkill. However, as it stands, we don't have a way to know which |
1073 // product will check the key and run the command, so we add it for all. | 1175 // product will check the key and run the command, so we add it for all. |
1074 // The first to run it will perform the operation and clean up the other | 1176 // The first to run it will perform the operation and clean up the other |
1075 // values. | 1177 // values. |
1076 if (dist->GetType() != BrowserDistribution::CHROME_BINARIES) { | 1178 if (dist->GetType() != BrowserDistribution::CHROME_BINARIES) { |
1077 CommandLine product_rename_cmd(rename); | 1179 CommandLine product_rename_cmd(rename); |
1078 products[i]->AppendRenameFlags(&product_rename_cmd); | 1180 products[i]->AppendRenameFlags(&product_rename_cmd); |
1079 in_use_update_work_items->AddSetRegValueWorkItem( | 1181 in_use_update_work_items->AddSetRegValueWorkItem( |
1080 root, version_key, google_update::kRegRenameCmdField, | 1182 root, |
1081 product_rename_cmd.GetCommandLineString(), true); | 1183 version_key, |
1184 google_update::kRegRenameCmdField, | |
1185 product_rename_cmd.GetCommandLineString(), | |
1186 true, | |
1187 WorkItem::kWow64Default); | |
1082 } | 1188 } |
1083 } | 1189 } |
1084 | 1190 |
1085 post_install_task_list->AddWorkItem(in_use_update_work_items.release()); | 1191 post_install_task_list->AddWorkItem(in_use_update_work_items.release()); |
1086 } | 1192 } |
1087 | 1193 |
1088 // Append work items that will be executed if this was NOT an in-use update. | 1194 // Append work items that will be executed if this was NOT an in-use update. |
1089 { | 1195 { |
1090 scoped_ptr<WorkItemList> regular_update_work_items( | 1196 scoped_ptr<WorkItemList> regular_update_work_items( |
1091 WorkItem::CreateConditionalWorkItemList( | 1197 WorkItem::CreateConditionalWorkItemList( |
1092 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); | 1198 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); |
1093 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); | 1199 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); |
1094 | 1200 |
1095 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. | 1201 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. |
1096 for (size_t i = 0; i < products.size(); ++i) { | 1202 for (size_t i = 0; i < products.size(); ++i) { |
1097 BrowserDistribution* dist = products[i]->distribution(); | 1203 BrowserDistribution* dist = products[i]->distribution(); |
1098 base::string16 version_key(dist->GetVersionKey()); | 1204 base::string16 version_key(dist->GetVersionKey()); |
1099 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1205 regular_update_work_items->AddDeleteRegValueWorkItem( |
1100 google_update::kRegOldVersionField); | 1206 root, |
1101 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1207 version_key, |
1102 google_update::kRegCriticalVersionField); | 1208 google_update::kRegOldVersionField, |
1103 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1209 WorkItem::kWow64Default); |
1104 google_update::kRegRenameCmdField); | 1210 regular_update_work_items->AddDeleteRegValueWorkItem( |
1211 root, | |
1212 version_key, | |
1213 google_update::kRegCriticalVersionField, | |
1214 WorkItem::kWow64Default); | |
1215 regular_update_work_items->AddDeleteRegValueWorkItem( | |
1216 root, | |
1217 version_key, | |
1218 google_update::kRegRenameCmdField, | |
1219 WorkItem::kWow64Default); | |
1105 } | 1220 } |
1106 | 1221 |
1107 post_install_task_list->AddWorkItem(regular_update_work_items.release()); | 1222 post_install_task_list->AddWorkItem(regular_update_work_items.release()); |
1108 } | 1223 } |
1109 | 1224 |
1110 AddRegisterComDllWorkItemsForPackage(installer_state, current_version, | 1225 AddRegisterComDllWorkItemsForPackage(installer_state, current_version, |
1111 new_version, post_install_task_list); | 1226 new_version, post_install_task_list); |
1112 | 1227 |
1113 // If we're told that we're an MSI install, make sure to set the marker | 1228 // If we're told that we're an MSI install, make sure to set the marker |
1114 // in the client state key so that future updates do the right thing. | 1229 // in the client state key so that future updates do the right thing. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1255 } | 1370 } |
1256 } | 1371 } |
1257 } | 1372 } |
1258 | 1373 |
1259 void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, | 1374 void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, |
1260 BrowserDistribution* dist, | 1375 BrowserDistribution* dist, |
1261 bool set, | 1376 bool set, |
1262 WorkItemList* work_item_list) { | 1377 WorkItemList* work_item_list) { |
1263 DCHECK(work_item_list); | 1378 DCHECK(work_item_list); |
1264 DWORD msi_value = set ? 1 : 0; | 1379 DWORD msi_value = set ? 1 : 0; |
1265 WorkItem* set_msi_work_item = work_item_list->AddSetRegValueWorkItem( | 1380 WorkItem* set_msi_work_item = |
1266 installer_state.root_key(), dist->GetStateKey(), | 1381 work_item_list->AddSetRegValueWorkItem(installer_state.root_key(), |
1267 google_update::kRegMSIField, msi_value, true); | 1382 dist->GetStateKey(), |
1383 google_update::kRegMSIField, | |
1384 msi_value, | |
1385 true, | |
1386 WorkItem::kWow64Default); | |
1268 DCHECK(set_msi_work_item); | 1387 DCHECK(set_msi_work_item); |
1269 set_msi_work_item->set_ignore_failure(true); | 1388 set_msi_work_item->set_ignore_failure(true); |
1270 set_msi_work_item->set_log_message("Could not write MSI marker!"); | 1389 set_msi_work_item->set_log_message("Could not write MSI marker!"); |
1271 } | 1390 } |
1272 | 1391 |
1273 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, | 1392 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, |
1274 const base::FilePath& target_path, | 1393 const base::FilePath& target_path, |
1275 const Version& new_version, | 1394 const Version& new_version, |
1276 const Product& product, | 1395 const Product& product, |
1277 WorkItemList* list) { | 1396 WorkItemList* list) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1310 base::FilePath delegate_execute(target_path); | 1429 base::FilePath delegate_execute(target_path); |
1311 if (new_version.IsValid()) | 1430 if (new_version.IsValid()) |
1312 delegate_execute = delegate_execute.AppendASCII(new_version.GetString()); | 1431 delegate_execute = delegate_execute.AppendASCII(new_version.GetString()); |
1313 delegate_execute = delegate_execute.Append(kDelegateExecuteExe); | 1432 delegate_execute = delegate_execute.Append(kDelegateExecuteExe); |
1314 | 1433 |
1315 // Command-line featuring the quoted path to the exe. | 1434 // Command-line featuring the quoted path to the exe. |
1316 base::string16 command(1, L'"'); | 1435 base::string16 command(1, L'"'); |
1317 command.append(delegate_execute.value()).append(1, L'"'); | 1436 command.append(delegate_execute.value()).append(1, L'"'); |
1318 | 1437 |
1319 // Register the CommandExecuteImpl class in Software\Classes\CLSID\... | 1438 // Register the CommandExecuteImpl class in Software\Classes\CLSID\... |
1320 list->AddCreateRegKeyWorkItem(root, delegate_execute_path); | 1439 list->AddCreateRegKeyWorkItem( |
1321 list->AddSetRegValueWorkItem(root, delegate_execute_path, L"", | 1440 root, delegate_execute_path, WorkItem::kWow64Default); |
1322 L"CommandExecuteImpl Class", true); | 1441 list->AddSetRegValueWorkItem(root, |
1442 delegate_execute_path, | |
1443 L"", | |
1444 L"CommandExecuteImpl Class", | |
1445 true, | |
1446 WorkItem::kWow64Default); | |
1323 base::string16 subkey(delegate_execute_path); | 1447 base::string16 subkey(delegate_execute_path); |
1324 subkey.append(L"\\LocalServer32"); | 1448 subkey.append(L"\\LocalServer32"); |
1325 list->AddCreateRegKeyWorkItem(root, subkey); | 1449 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default); |
1326 list->AddSetRegValueWorkItem(root, subkey, L"", command, true); | 1450 list->AddSetRegValueWorkItem( |
1327 list->AddSetRegValueWorkItem(root, subkey, L"ServerExecutable", | 1451 root, subkey, L"", command, true, WorkItem::kWow64Default); |
1328 delegate_execute.value(), true); | 1452 list->AddSetRegValueWorkItem(root, |
1453 subkey, | |
1454 L"ServerExecutable", | |
1455 delegate_execute.value(), | |
1456 true, | |
1457 WorkItem::kWow64Default); | |
1329 | 1458 |
1330 subkey.assign(delegate_execute_path).append(L"\\Programmable"); | 1459 subkey.assign(delegate_execute_path).append(L"\\Programmable"); |
1331 list->AddCreateRegKeyWorkItem(root, subkey); | 1460 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default); |
1332 } | 1461 } |
1333 } | 1462 } |
1334 | 1463 |
1335 void AddActiveSetupWorkItems(const InstallerState& installer_state, | 1464 void AddActiveSetupWorkItems(const InstallerState& installer_state, |
1336 const base::FilePath& setup_path, | 1465 const base::FilePath& setup_path, |
1337 const Version& new_version, | 1466 const Version& new_version, |
1338 const Product& product, | 1467 const Product& product, |
1339 WorkItemList* list) { | 1468 WorkItemList* list) { |
1340 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); | 1469 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); |
1341 BrowserDistribution* dist = product.distribution(); | 1470 BrowserDistribution* dist = product.distribution(); |
1342 | 1471 |
1343 if (!product.is_chrome() || !installer_state.system_install()) { | 1472 if (!product.is_chrome() || !installer_state.system_install()) { |
1344 const char* install_level = | 1473 const char* install_level = |
1345 installer_state.system_install() ? "system" : "user"; | 1474 installer_state.system_install() ? "system" : "user"; |
1346 VLOG(1) << "No Active Setup processing to do for " << install_level | 1475 VLOG(1) << "No Active Setup processing to do for " << install_level |
1347 << "-level " << dist->GetDisplayName(); | 1476 << "-level " << dist->GetDisplayName(); |
1348 return; | 1477 return; |
1349 } | 1478 } |
1350 DCHECK(installer_state.RequiresActiveSetup()); | 1479 DCHECK(installer_state.RequiresActiveSetup()); |
1351 | 1480 |
1352 const HKEY root = HKEY_LOCAL_MACHINE; | 1481 const HKEY root = HKEY_LOCAL_MACHINE; |
1353 const base::string16 active_setup_path(InstallUtil::GetActiveSetupPath(dist)); | 1482 const base::string16 active_setup_path(InstallUtil::GetActiveSetupPath(dist)); |
1354 | 1483 |
1355 VLOG(1) << "Adding registration items for Active Setup."; | 1484 VLOG(1) << "Adding registration items for Active Setup."; |
1356 list->AddCreateRegKeyWorkItem(root, active_setup_path); | 1485 list->AddCreateRegKeyWorkItem( |
1357 list->AddSetRegValueWorkItem(root, active_setup_path, L"", | 1486 root, active_setup_path, WorkItem::kWow64Default); |
1358 dist->GetDisplayName(), true); | 1487 list->AddSetRegValueWorkItem(root, |
1488 active_setup_path, | |
1489 L"", | |
1490 dist->GetDisplayName(), | |
1491 true, | |
1492 WorkItem::kWow64Default); | |
1359 | 1493 |
1360 base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( | 1494 base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( |
1361 new_version).Append(kActiveSetupExe)); | 1495 new_version).Append(kActiveSetupExe)); |
1362 CommandLine cmd(active_setup_exe); | 1496 CommandLine cmd(active_setup_exe); |
1363 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); | 1497 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); |
1364 cmd.AppendSwitch(installer::switches::kVerboseLogging); | 1498 cmd.AppendSwitch(installer::switches::kVerboseLogging); |
1365 cmd.AppendSwitch(installer::switches::kSystemLevel); | 1499 cmd.AppendSwitch(installer::switches::kSystemLevel); |
1366 product.AppendProductFlags(&cmd); | 1500 product.AppendProductFlags(&cmd); |
1367 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", | 1501 list->AddSetRegValueWorkItem(root, |
1368 cmd.GetCommandLineString(), true); | 1502 active_setup_path, |
1503 L"StubPath", | |
1504 cmd.GetCommandLineString(), | |
1505 true, | |
1506 WorkItem::kWow64Default); | |
1369 | 1507 |
1370 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 1508 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
1371 // resource. | 1509 // resource. |
1372 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", | 1510 list->AddSetRegValueWorkItem(root, |
1373 dist->GetDisplayName(), true); | 1511 active_setup_path, |
1512 L"Localized Name", | |
1513 dist->GetDisplayName(), | |
1514 true, | |
1515 WorkItem::kWow64Default); | |
1374 | 1516 |
1375 list->AddSetRegValueWorkItem(root, active_setup_path, L"IsInstalled", | 1517 list->AddSetRegValueWorkItem(root, |
1376 static_cast<DWORD>(1U), true); | 1518 active_setup_path, |
1519 L"IsInstalled", | |
1520 static_cast<DWORD>(1U), | |
1521 true, | |
1522 WorkItem::kWow64Default); | |
1377 | 1523 |
1378 list->AddSetRegValueWorkItem(root, active_setup_path, L"Version", | 1524 list->AddSetRegValueWorkItem(root, |
1379 kActiveSetupVersion, true); | 1525 active_setup_path, |
1526 L"Version", | |
1527 kActiveSetupVersion, | |
1528 true, | |
1529 WorkItem::kWow64Default); | |
1380 } | 1530 } |
1381 | 1531 |
1382 void AddDeleteOldIELowRightsPolicyWorkItems( | 1532 void AddDeleteOldIELowRightsPolicyWorkItems( |
1383 const InstallerState& installer_state, | 1533 const InstallerState& installer_state, |
1384 WorkItemList* install_list) { | 1534 WorkItemList* install_list) { |
1385 DCHECK(install_list); | 1535 DCHECK(install_list); |
1386 | 1536 |
1387 base::string16 key_path; | 1537 base::string16 key_path; |
1388 GetOldIELowRightsElevationPolicyKeyPath(&key_path); | 1538 GetOldIELowRightsElevationPolicyKeyPath(&key_path); |
1389 install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path); | 1539 install_list->AddDeleteRegKeyWorkItem( |
1540 installer_state.root_key(), key_path, WorkItem::kWow64Default); | |
1390 } | 1541 } |
1391 | 1542 |
1392 void AppendUninstallCommandLineFlags(const InstallerState& installer_state, | 1543 void AppendUninstallCommandLineFlags(const InstallerState& installer_state, |
1393 const Product& product, | 1544 const Product& product, |
1394 CommandLine* uninstall_cmd) { | 1545 CommandLine* uninstall_cmd) { |
1395 DCHECK(uninstall_cmd); | 1546 DCHECK(uninstall_cmd); |
1396 | 1547 |
1397 uninstall_cmd->AppendSwitch(installer::switches::kUninstall); | 1548 uninstall_cmd->AppendSwitch(installer::switches::kUninstall); |
1398 | 1549 |
1399 // Append the product-specific uninstall flags. | 1550 // Append the product-specific uninstall flags. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1431 void AddOsUpgradeWorkItems(const InstallerState& installer_state, | 1582 void AddOsUpgradeWorkItems(const InstallerState& installer_state, |
1432 const base::FilePath& setup_path, | 1583 const base::FilePath& setup_path, |
1433 const Version& new_version, | 1584 const Version& new_version, |
1434 const Product& product, | 1585 const Product& product, |
1435 WorkItemList* install_list) { | 1586 WorkItemList* install_list) { |
1436 const HKEY root_key = installer_state.root_key(); | 1587 const HKEY root_key = installer_state.root_key(); |
1437 base::string16 cmd_key( | 1588 base::string16 cmd_key( |
1438 GetRegCommandKey(product.distribution(), kCmdOnOsUpgrade)); | 1589 GetRegCommandKey(product.distribution(), kCmdOnOsUpgrade)); |
1439 | 1590 |
1440 if (installer_state.operation() == InstallerState::UNINSTALL) { | 1591 if (installer_state.operation() == InstallerState::UNINSTALL) { |
1441 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key)-> | 1592 install_list->AddDeleteRegKeyWorkItem( |
1442 set_log_message("Removing OS upgrade command"); | 1593 root_key, cmd_key, WorkItem::kWow64Default) |
1594 ->set_log_message("Removing OS upgrade command"); | |
1443 } else { | 1595 } else { |
1444 // Register with Google Update to have setup.exe --on-os-upgrade called on | 1596 // Register with Google Update to have setup.exe --on-os-upgrade called on |
1445 // OS upgrade. | 1597 // OS upgrade. |
1446 CommandLine cmd_line(installer_state | 1598 CommandLine cmd_line(installer_state |
1447 .GetInstallerDirectory(new_version) | 1599 .GetInstallerDirectory(new_version) |
1448 .Append(setup_path.BaseName())); | 1600 .Append(setup_path.BaseName())); |
1449 // Add the main option to indicate OS upgrade flow. | 1601 // Add the main option to indicate OS upgrade flow. |
1450 cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade); | 1602 cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade); |
1451 // Add product-specific options. | 1603 // Add product-specific options. |
1452 product.AppendProductFlags(&cmd_line); | 1604 product.AppendProductFlags(&cmd_line); |
(...skipping 10 matching lines...) Expand all Loading... | |
1463 | 1615 |
1464 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state, | 1616 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state, |
1465 const base::FilePath& setup_path, | 1617 const base::FilePath& setup_path, |
1466 const Version& new_version, | 1618 const Version& new_version, |
1467 const Product& product, | 1619 const Product& product, |
1468 WorkItemList* work_item_list) { | 1620 WorkItemList* work_item_list) { |
1469 const HKEY root_key = installer_state.root_key(); | 1621 const HKEY root_key = installer_state.root_key(); |
1470 base::string16 cmd_key( | 1622 base::string16 cmd_key( |
1471 GetRegCommandKey(product.distribution(), kCmdQueryEULAAcceptance)); | 1623 GetRegCommandKey(product.distribution(), kCmdQueryEULAAcceptance)); |
1472 if (installer_state.operation() == InstallerState::UNINSTALL) { | 1624 if (installer_state.operation() == InstallerState::UNINSTALL) { |
1473 work_item_list->AddDeleteRegKeyWorkItem(root_key, cmd_key)-> | 1625 work_item_list->AddDeleteRegKeyWorkItem( |
1474 set_log_message("Removing query EULA acceptance command"); | 1626 root_key, cmd_key, WorkItem::kWow64Default) |
1627 ->set_log_message("Removing query EULA acceptance command"); | |
1475 } else { | 1628 } else { |
1476 CommandLine cmd_line(installer_state | 1629 CommandLine cmd_line(installer_state |
1477 .GetInstallerDirectory(new_version) | 1630 .GetInstallerDirectory(new_version) |
1478 .Append(setup_path.BaseName())); | 1631 .Append(setup_path.BaseName())); |
1479 cmd_line.AppendSwitch(switches::kQueryEULAAcceptance); | 1632 cmd_line.AppendSwitch(switches::kQueryEULAAcceptance); |
1480 if (installer_state.system_install()) | 1633 if (installer_state.system_install()) |
1481 cmd_line.AppendSwitch(installer::switches::kSystemLevel); | 1634 cmd_line.AppendSwitch(installer::switches::kSystemLevel); |
1482 if (installer_state.verbose_logging()) | 1635 if (installer_state.verbose_logging()) |
1483 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | 1636 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
1484 AppCommand cmd(cmd_line.GetCommandLineString()); | 1637 AppCommand cmd(cmd_line.GetCommandLineString()); |
1485 cmd.set_is_web_accessible(true); | 1638 cmd.set_is_web_accessible(true); |
1486 cmd.set_is_run_as_user(true); | 1639 cmd.set_is_run_as_user(true); |
1487 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 1640 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
1488 } | 1641 } |
1489 } | 1642 } |
1490 | 1643 |
1491 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state, | 1644 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state, |
1492 WorkItemList* work_item_list) { | 1645 WorkItemList* work_item_list) { |
1493 DCHECK(work_item_list); | 1646 DCHECK(work_item_list); |
1494 | 1647 |
1495 base::string16 cmd_key( | 1648 base::string16 cmd_key( |
1496 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution( | 1649 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution( |
1497 BrowserDistribution::CHROME_BINARIES), | 1650 BrowserDistribution::CHROME_BINARIES), |
1498 kCmdQuickEnableCf)); | 1651 kCmdQuickEnableCf)); |
1499 | 1652 |
1500 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1653 // Unconditionally remove the legacy Quick Enable command from the binaries. |
1501 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1654 // Do this even if multi-install Chrome isn't installed to ensure that it is |
1502 // not left behind in any case. | 1655 // not left behind in any case. |
1503 work_item_list->AddDeleteRegKeyWorkItem( | 1656 work_item_list->AddDeleteRegKeyWorkItem( |
1504 installer_state.root_key(), cmd_key)->set_log_message( | 1657 installer_state.root_key(), cmd_key, WorkItem::kWow64Default) |
1505 "removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + " command"); | 1658 ->set_log_message("removing " + |
1506 | 1659 base::UTF16ToASCII(kCmdQuickEnableCf) + " command"); |
1507 } | 1660 } |
1508 | 1661 |
1509 } // namespace installer | 1662 } // namespace installer |
OLD | NEW |