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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( | 82 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( |
83 MiniDumpWithProcessThreadData | // Get PEB and TEB. | 83 MiniDumpWithProcessThreadData | // Get PEB and TEB. |
84 MiniDumpWithUnloadedModules | // Get unloaded modules when available. | 84 MiniDumpWithUnloadedModules | // Get unloaded modules when available. |
85 MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by stack. | 85 MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by stack. |
86 | 86 |
87 namespace { | 87 namespace { |
88 | 88 |
89 // Returns NULL if no compressed archive is available for processing, otherwise | 89 // Returns NULL if no compressed archive is available for processing, otherwise |
90 // returns a patch helper configured to uncompress and patch. | 90 // returns a patch helper configured to uncompress and patch. |
91 scoped_ptr<installer::ArchivePatchHelper> CreateChromeArchiveHelper( | 91 scoped_ptr<installer::ArchivePatchHelper> CreateChromeArchiveHelper( |
| 92 const base::FilePath& setup_exe, |
92 const CommandLine& command_line, | 93 const CommandLine& command_line, |
93 const installer::InstallerState& installer_state, | 94 const installer::InstallerState& installer_state, |
94 const base::FilePath& working_directory) { | 95 const base::FilePath& working_directory) { |
95 // A compressed archive is ordinarily given on the command line by the mini | 96 // A compressed archive is ordinarily given on the command line by the mini |
96 // installer. If one was not given, look for chrome.packed.7z next to the | 97 // installer. If one was not given, look for chrome.packed.7z next to the |
97 // running program. | 98 // running program. |
98 base::FilePath compressed_archive( | 99 base::FilePath compressed_archive( |
99 command_line.GetSwitchValuePath(installer::switches::kInstallArchive)); | 100 command_line.GetSwitchValuePath(installer::switches::kInstallArchive)); |
100 bool compressed_archive_specified = !compressed_archive.empty(); | 101 bool compressed_archive_specified = !compressed_archive.empty(); |
101 if (!compressed_archive_specified) { | 102 if (!compressed_archive_specified) { |
102 compressed_archive = | 103 compressed_archive = setup_exe.DirName().Append( |
103 command_line.GetProgram().DirName().Append( | 104 installer::kChromeCompressedArchive); |
104 installer::kChromeCompressedArchive); | |
105 } | 105 } |
106 | 106 |
107 // Fail if no compressed archive is found. | 107 // Fail if no compressed archive is found. |
108 if (!base::PathExists(compressed_archive)) { | 108 if (!base::PathExists(compressed_archive)) { |
109 if (compressed_archive_specified) { | 109 if (compressed_archive_specified) { |
110 LOG(ERROR) << installer::switches::kInstallArchive << "=" | 110 LOG(ERROR) << installer::switches::kInstallArchive << "=" |
111 << compressed_archive.value() << " not found."; | 111 << compressed_archive.value() << " not found."; |
112 } | 112 } |
113 return scoped_ptr<installer::ArchivePatchHelper>(); | 113 return scoped_ptr<installer::ArchivePatchHelper>(); |
114 } | 114 } |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 PLOG(ERROR) << "Could not create temporary path for unpacked archive."; | 628 PLOG(ERROR) << "Could not create temporary path for unpacked archive."; |
629 return false; | 629 return false; |
630 } | 630 } |
631 | 631 |
632 return true; | 632 return true; |
633 } | 633 } |
634 | 634 |
635 installer::InstallStatus UninstallProduct( | 635 installer::InstallStatus UninstallProduct( |
636 const InstallationState& original_state, | 636 const InstallationState& original_state, |
637 const InstallerState& installer_state, | 637 const InstallerState& installer_state, |
| 638 const base::FilePath& setup_exe, |
638 const CommandLine& cmd_line, | 639 const CommandLine& cmd_line, |
639 bool remove_all, | 640 bool remove_all, |
640 bool force_uninstall, | 641 bool force_uninstall, |
641 const Product& product) { | 642 const Product& product) { |
642 const ProductState* product_state = | 643 const ProductState* product_state = |
643 original_state.GetProductState(installer_state.system_install(), | 644 original_state.GetProductState(installer_state.system_install(), |
644 product.distribution()->GetType()); | 645 product.distribution()->GetType()); |
645 if (product_state != NULL) { | 646 if (product_state != NULL) { |
646 VLOG(1) << "version on the system: " | 647 VLOG(1) << "version on the system: " |
647 << product_state->version().GetString(); | 648 << product_state->version().GetString(); |
648 } else if (!force_uninstall) { | 649 } else if (!force_uninstall) { |
649 LOG(ERROR) << product.distribution()->GetDisplayName() | 650 LOG(ERROR) << product.distribution()->GetDisplayName() |
650 << " not found for uninstall."; | 651 << " not found for uninstall."; |
651 return installer::CHROME_NOT_INSTALLED; | 652 return installer::CHROME_NOT_INSTALLED; |
652 } | 653 } |
653 | 654 |
654 return installer::UninstallProduct( | 655 return installer::UninstallProduct( |
655 original_state, installer_state, cmd_line.GetProgram(), product, | 656 original_state, installer_state, setup_exe, product, remove_all, |
656 remove_all, force_uninstall, cmd_line); | 657 force_uninstall, cmd_line); |
657 } | 658 } |
658 | 659 |
659 installer::InstallStatus UninstallProducts( | 660 installer::InstallStatus UninstallProducts( |
660 const InstallationState& original_state, | 661 const InstallationState& original_state, |
661 const InstallerState& installer_state, | 662 const InstallerState& installer_state, |
| 663 const base::FilePath& setup_exe, |
662 const CommandLine& cmd_line) { | 664 const CommandLine& cmd_line) { |
663 const Products& products = installer_state.products(); | 665 const Products& products = installer_state.products(); |
664 | 666 |
665 // Decide whether Active Setup should be triggered and/or system-level Chrome | 667 // Decide whether Active Setup should be triggered and/or system-level Chrome |
666 // should be launched post-uninstall. This needs to be done outside the | 668 // should be launched post-uninstall. This needs to be done outside the |
667 // UninstallProduct calls as some of them might terminate the processes | 669 // UninstallProduct calls as some of them might terminate the processes |
668 // launched by a previous one otherwise... | 670 // launched by a previous one otherwise... |
669 bool trigger_active_setup = false; | 671 bool trigger_active_setup = false; |
670 // System-level Chrome will be launched via this command if its program gets | 672 // System-level Chrome will be launched via this command if its program gets |
671 // set below. | 673 // set below. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 710 |
709 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL; | 711 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL; |
710 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS; | 712 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS; |
711 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); | 713 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); |
712 const bool remove_all = !cmd_line.HasSwitch( | 714 const bool remove_all = !cmd_line.HasSwitch( |
713 installer::switches::kDoNotRemoveSharedItems); | 715 installer::switches::kDoNotRemoveSharedItems); |
714 | 716 |
715 for (Products::const_iterator it = products.begin(); | 717 for (Products::const_iterator it = products.begin(); |
716 install_status != installer::UNINSTALL_CANCELLED && it < products.end(); | 718 install_status != installer::UNINSTALL_CANCELLED && it < products.end(); |
717 ++it) { | 719 ++it) { |
718 prod_status = UninstallProduct(original_state, installer_state, | 720 prod_status = UninstallProduct(original_state, installer_state, setup_exe, |
719 cmd_line, remove_all, force, **it); | 721 cmd_line, remove_all, force, **it); |
720 if (prod_status != installer::UNINSTALL_SUCCESSFUL) | 722 if (prod_status != installer::UNINSTALL_SUCCESSFUL) |
721 install_status = prod_status; | 723 install_status = prod_status; |
722 } | 724 } |
723 | 725 |
724 installer::CleanUpInstallationDirectoryAfterUninstall( | 726 installer::CleanUpInstallationDirectoryAfterUninstall( |
725 original_state, installer_state, cmd_line, &install_status); | 727 original_state, installer_state, setup_exe, &install_status); |
726 | 728 |
727 // The app and vendor dirs may now be empty. Make a last-ditch attempt to | 729 // The app and vendor dirs may now be empty. Make a last-ditch attempt to |
728 // delete them. | 730 // delete them. |
729 installer::DeleteChromeDirectoriesIfEmpty(installer_state.target_path()); | 731 installer::DeleteChromeDirectoriesIfEmpty(installer_state.target_path()); |
730 | 732 |
731 if (trigger_active_setup) | 733 if (trigger_active_setup) |
732 InstallUtil::TriggerActiveSetupCommand(); | 734 InstallUtil::TriggerActiveSetupCommand(); |
733 | 735 |
734 if (!system_level_cmd.GetProgram().empty()) | 736 if (!system_level_cmd.GetProgram().empty()) |
735 base::LaunchProcess(system_level_cmd, base::LaunchOptions(), NULL); | 737 base::LaunchProcess(system_level_cmd, base::LaunchOptions(), NULL); |
(...skipping 23 matching lines...) Expand all Loading... |
759 | 761 |
760 // Simulate the uninstall as coming from the installed version. | 762 // Simulate the uninstall as coming from the installed version. |
761 const ProductState* binaries_state = | 763 const ProductState* binaries_state = |
762 original_state.GetProductState(installer_state.system_install(), | 764 original_state.GetProductState(installer_state.system_install(), |
763 BrowserDistribution::CHROME_BINARIES); | 765 BrowserDistribution::CHROME_BINARIES); |
764 const CommandLine& uninstall_cmd(binaries_state->uninstall_command()); | 766 const CommandLine& uninstall_cmd(binaries_state->uninstall_command()); |
765 MasterPreferences uninstall_prefs(uninstall_cmd); | 767 MasterPreferences uninstall_prefs(uninstall_cmd); |
766 InstallerState uninstall_state; | 768 InstallerState uninstall_state; |
767 uninstall_state.Initialize(uninstall_cmd, uninstall_prefs, original_state); | 769 uninstall_state.Initialize(uninstall_cmd, uninstall_prefs, original_state); |
768 | 770 |
769 *install_status = | 771 *install_status = UninstallProducts(original_state, uninstall_state, |
770 UninstallProducts(original_state, uninstall_state, uninstall_cmd); | 772 uninstall_cmd.GetProgram(), |
| 773 uninstall_cmd); |
771 | 774 |
772 // Report that the binaries were uninstalled if they were. This translates | 775 // Report that the binaries were uninstalled if they were. This translates |
773 // into a successful install return code. | 776 // into a successful install return code. |
774 if (IsUninstallSuccess(*install_status)) { | 777 if (IsUninstallSuccess(*install_status)) { |
775 *install_status = installer::UNUSED_BINARIES_UNINSTALLED; | 778 *install_status = installer::UNUSED_BINARIES_UNINSTALLED; |
776 installer_state.WriteInstallerResult(*install_status, 0, NULL); | 779 installer_state.WriteInstallerResult(*install_status, 0, NULL); |
777 } | 780 } |
778 } | 781 } |
779 | 782 |
780 installer::InstallStatus InstallProducts( | 783 installer::InstallStatus InstallProducts( |
781 const InstallationState& original_state, | 784 const InstallationState& original_state, |
| 785 const base::FilePath& setup_exe, |
782 const CommandLine& cmd_line, | 786 const CommandLine& cmd_line, |
783 const MasterPreferences& prefs, | 787 const MasterPreferences& prefs, |
784 InstallerState* installer_state, | 788 InstallerState* installer_state, |
785 base::FilePath* installer_directory) { | 789 base::FilePath* installer_directory) { |
786 DCHECK(installer_state); | 790 DCHECK(installer_state); |
787 const bool system_install = installer_state->system_install(); | 791 const bool system_install = installer_state->system_install(); |
788 installer::InstallStatus install_status = installer::UNKNOWN_STATUS; | 792 installer::InstallStatus install_status = installer::UNKNOWN_STATUS; |
789 installer::ArchiveType archive_type = installer::UNKNOWN_ARCHIVE_TYPE; | 793 installer::ArchiveType archive_type = installer::UNKNOWN_ARCHIVE_TYPE; |
790 bool delegated_to_existing = false; | 794 bool delegated_to_existing = false; |
791 installer_state->UpdateStage(installer::PRECONDITIONS); | 795 installer_state->UpdateStage(installer::PRECONDITIONS); |
792 // The stage provides more fine-grained information than -multifail, so remove | 796 // The stage provides more fine-grained information than -multifail, so remove |
793 // the -multifail suffix from the Google Update "ap" value. | 797 // the -multifail suffix from the Google Update "ap" value. |
794 BrowserDistribution::GetSpecificDistribution(installer_state->state_type())-> | 798 BrowserDistribution::GetSpecificDistribution(installer_state->state_type())-> |
795 UpdateInstallStatus(system_install, archive_type, install_status); | 799 UpdateInstallStatus(system_install, archive_type, install_status); |
796 if (CheckPreInstallConditions(original_state, installer_state, | 800 if (CheckPreInstallConditions(original_state, installer_state, |
797 &install_status)) { | 801 &install_status)) { |
798 VLOG(1) << "Installing to " << installer_state->target_path().value(); | 802 VLOG(1) << "Installing to " << installer_state->target_path().value(); |
799 install_status = InstallProductsHelper( | 803 install_status = InstallProductsHelper( |
800 original_state, cmd_line, prefs, *installer_state, | 804 original_state, setup_exe, cmd_line, prefs, *installer_state, |
801 installer_directory, &archive_type, &delegated_to_existing); | 805 installer_directory, &archive_type, &delegated_to_existing); |
802 } else { | 806 } else { |
803 // CheckPreInstallConditions must set the status on failure. | 807 // CheckPreInstallConditions must set the status on failure. |
804 DCHECK_NE(install_status, installer::UNKNOWN_STATUS); | 808 DCHECK_NE(install_status, installer::UNKNOWN_STATUS); |
805 } | 809 } |
806 | 810 |
807 // Delete the master preferences file if present. Note that we do not care | 811 // Delete the master preferences file if present. Note that we do not care |
808 // about rollback here and we schedule for deletion on reboot if the delete | 812 // about rollback here and we schedule for deletion on reboot if the delete |
809 // fails. As such, we do not use DeleteTreeWorkItem. | 813 // fails. As such, we do not use DeleteTreeWorkItem. |
810 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { | 814 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 app_model_id.c_str(), L"open", AO_NONE, &pid); | 894 app_model_id.c_str(), L"open", AO_NONE, &pid); |
891 } | 895 } |
892 | 896 |
893 LOG_IF(ERROR, FAILED(hr)) << "Tried and failed to launch Metro Chrome. " | 897 LOG_IF(ERROR, FAILED(hr)) << "Tried and failed to launch Metro Chrome. " |
894 << "hr=" << std::hex << hr; | 898 << "hr=" << std::hex << hr; |
895 } | 899 } |
896 | 900 |
897 installer::InstallStatus RegisterDevChrome( | 901 installer::InstallStatus RegisterDevChrome( |
898 const InstallationState& original_state, | 902 const InstallationState& original_state, |
899 const InstallerState& installer_state, | 903 const InstallerState& installer_state, |
| 904 const base::FilePath& setup_exe, |
900 const CommandLine& cmd_line) { | 905 const CommandLine& cmd_line) { |
901 BrowserDistribution* chrome_dist = | 906 BrowserDistribution* chrome_dist = |
902 BrowserDistribution::GetSpecificDistribution( | 907 BrowserDistribution::GetSpecificDistribution( |
903 BrowserDistribution::CHROME_BROWSER); | 908 BrowserDistribution::CHROME_BROWSER); |
904 | 909 |
905 // Only proceed with registering a dev chrome if no real Chrome installation | 910 // Only proceed with registering a dev chrome if no real Chrome installation |
906 // of the same distribution are present on this system. | 911 // of the same distribution are present on this system. |
907 const ProductState* existing_chrome = | 912 const ProductState* existing_chrome = |
908 original_state.GetProductState(false, | 913 original_state.GetProductState(false, |
909 BrowserDistribution::CHROME_BROWSER); | 914 BrowserDistribution::CHROME_BROWSER); |
(...skipping 13 matching lines...) Expand all Loading... |
923 << " was found, as a last resort (if the product is not present " | 928 << " was found, as a last resort (if the product is not present " |
924 "in Add/Remove Programs), try executing: " | 929 "in Add/Remove Programs), try executing: " |
925 << existing_chrome->uninstall_command().GetCommandLineString(); | 930 << existing_chrome->uninstall_command().GetCommandLineString(); |
926 MessageBox(NULL, message.c_str(), NULL, MB_ICONERROR); | 931 MessageBox(NULL, message.c_str(), NULL, MB_ICONERROR); |
927 return installer::INSTALL_FAILED; | 932 return installer::INSTALL_FAILED; |
928 } | 933 } |
929 | 934 |
930 base::FilePath chrome_exe( | 935 base::FilePath chrome_exe( |
931 cmd_line.GetSwitchValuePath(installer::switches::kRegisterDevChrome)); | 936 cmd_line.GetSwitchValuePath(installer::switches::kRegisterDevChrome)); |
932 if (chrome_exe.empty()) | 937 if (chrome_exe.empty()) |
933 chrome_exe = cmd_line.GetProgram().DirName().Append(installer::kChromeExe); | 938 chrome_exe = setup_exe.DirName().Append(installer::kChromeExe); |
934 if (!chrome_exe.IsAbsolute()) | 939 if (!chrome_exe.IsAbsolute()) |
935 chrome_exe = base::MakeAbsoluteFilePath(chrome_exe); | 940 chrome_exe = base::MakeAbsoluteFilePath(chrome_exe); |
936 | 941 |
937 installer::InstallStatus status = installer::FIRST_INSTALL_SUCCESS; | 942 installer::InstallStatus status = installer::FIRST_INSTALL_SUCCESS; |
938 if (base::PathExists(chrome_exe)) { | 943 if (base::PathExists(chrome_exe)) { |
939 Product chrome(chrome_dist); | 944 Product chrome(chrome_dist); |
940 | 945 |
941 // Create the Start menu shortcut and pin it to the taskbar. | 946 // Create the Start menu shortcut and pin it to the taskbar. |
942 ShellUtil::ShortcutProperties shortcut_properties(ShellUtil::CURRENT_USER); | 947 ShellUtil::ShortcutProperties shortcut_properties(ShellUtil::CURRENT_USER); |
943 chrome.AddDefaultShortcutProperties(chrome_exe, &shortcut_properties); | 948 chrome.AddDefaultShortcutProperties(chrome_exe, &shortcut_properties); |
(...skipping 21 matching lines...) Expand all Loading... |
965 status = installer::INSTALL_FAILED; | 970 status = installer::INSTALL_FAILED; |
966 } | 971 } |
967 return status; | 972 return status; |
968 } | 973 } |
969 | 974 |
970 // This method processes any command line options that make setup.exe do | 975 // This method processes any command line options that make setup.exe do |
971 // various tasks other than installation (renaming chrome.exe, showing eula | 976 // various tasks other than installation (renaming chrome.exe, showing eula |
972 // among others). This function returns true if any such command line option | 977 // among others). This function returns true if any such command line option |
973 // has been found and processed (so setup.exe should exit at that point). | 978 // has been found and processed (so setup.exe should exit at that point). |
974 bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, | 979 bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
| 980 const base::FilePath& setup_exe, |
975 const CommandLine& cmd_line, | 981 const CommandLine& cmd_line, |
976 InstallerState* installer_state, | 982 InstallerState* installer_state, |
977 int* exit_code) { | 983 int* exit_code) { |
978 // TODO(gab): Add a local |status| variable which each block below sets; | 984 // TODO(gab): Add a local |status| variable which each block below sets; |
979 // only determine the |exit_code| from |status| at the end (this will allow | 985 // only determine the |exit_code| from |status| at the end (this will allow |
980 // this method to validate that | 986 // this method to validate that |
981 // (!handled || status != installer::UNKNOWN_STATUS)). | 987 // (!handled || status != installer::UNKNOWN_STATUS)). |
982 bool handled = true; | 988 bool handled = true; |
983 // TODO(tommi): Split these checks up into functions and use a data driven | 989 // TODO(tommi): Split these checks up into functions and use a data driven |
984 // map of switch->function. | 990 // map of switch->function. |
985 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { | 991 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { |
986 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; | 992 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; |
987 // If --update-setup-exe command line option is given, we apply the given | 993 // If --update-setup-exe command line option is given, we apply the given |
988 // patch to current exe, and store the resulting binary in the path | 994 // patch to current exe, and store the resulting binary in the path |
989 // specified by --new-setup-exe. But we need to first unpack the file | 995 // specified by --new-setup-exe. But we need to first unpack the file |
990 // given in --update-setup-exe. | 996 // given in --update-setup-exe. |
991 base::ScopedTempDir temp_path; | 997 base::ScopedTempDir temp_path; |
992 if (!temp_path.CreateUniqueTempDir()) { | 998 if (!temp_path.CreateUniqueTempDir()) { |
993 PLOG(ERROR) << "Could not create temporary path."; | 999 PLOG(ERROR) << "Could not create temporary path."; |
994 } else { | 1000 } else { |
995 base::FilePath compressed_archive(cmd_line.GetSwitchValuePath( | 1001 base::FilePath compressed_archive(cmd_line.GetSwitchValuePath( |
996 installer::switches::kUpdateSetupExe)); | 1002 installer::switches::kUpdateSetupExe)); |
997 VLOG(1) << "Opening archive " << compressed_archive.value(); | 1003 VLOG(1) << "Opening archive " << compressed_archive.value(); |
998 if (installer::ArchivePatchHelper::UncompressAndPatch( | 1004 if (installer::ArchivePatchHelper::UncompressAndPatch( |
999 temp_path.path(), | 1005 temp_path.path(), |
1000 compressed_archive, | 1006 compressed_archive, |
1001 cmd_line.GetProgram(), | 1007 setup_exe, |
1002 cmd_line.GetSwitchValuePath(installer::switches::kNewSetupExe))) { | 1008 cmd_line.GetSwitchValuePath(installer::switches::kNewSetupExe))) { |
1003 status = installer::NEW_VERSION_UPDATED; | 1009 status = installer::NEW_VERSION_UPDATED; |
1004 } | 1010 } |
1005 if (!temp_path.Delete()) { | 1011 if (!temp_path.Delete()) { |
1006 // PLOG would be nice, but Delete() doesn't leave a meaningful value in | 1012 // PLOG would be nice, but Delete() doesn't leave a meaningful value in |
1007 // the Windows last-error code. | 1013 // the Windows last-error code. |
1008 LOG(WARNING) << "Scheduling temporary path " << temp_path.path().value() | 1014 LOG(WARNING) << "Scheduling temporary path " << temp_path.path().value() |
1009 << " for deletion at reboot."; | 1015 << " for deletion at reboot."; |
1010 ScheduleDirectoryForDeletion(temp_path.path()); | 1016 ScheduleDirectoryForDeletion(temp_path.path()); |
1011 } | 1017 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 installer::HandleActiveSetupForBrowser(installer_state->target_path(), | 1054 installer::HandleActiveSetupForBrowser(installer_state->target_path(), |
1049 *chrome_install, force); | 1055 *chrome_install, force); |
1050 status = installer::INSTALL_REPAIRED; | 1056 status = installer::INSTALL_REPAIRED; |
1051 } else { | 1057 } else { |
1052 LOG(DFATAL) << "chrome_install:" << chrome_install | 1058 LOG(DFATAL) << "chrome_install:" << chrome_install |
1053 << ", system_install:" << installer_state->system_install(); | 1059 << ", system_install:" << installer_state->system_install(); |
1054 } | 1060 } |
1055 *exit_code = InstallUtil::GetInstallReturnCode(status); | 1061 *exit_code = InstallUtil::GetInstallReturnCode(status); |
1056 } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) { | 1062 } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) { |
1057 installer::InstallStatus status = RegisterDevChrome( | 1063 installer::InstallStatus status = RegisterDevChrome( |
1058 original_state, *installer_state, cmd_line); | 1064 original_state, *installer_state, setup_exe, cmd_line); |
1059 *exit_code = InstallUtil::GetInstallReturnCode(status); | 1065 *exit_code = InstallUtil::GetInstallReturnCode(status); |
1060 } else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) { | 1066 } else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) { |
1061 installer::InstallStatus status = installer::UNKNOWN_STATUS; | 1067 installer::InstallStatus status = installer::UNKNOWN_STATUS; |
1062 const Product* chrome_install = | 1068 const Product* chrome_install = |
1063 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); | 1069 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); |
1064 if (chrome_install) { | 1070 if (chrome_install) { |
1065 // If --register-chrome-browser option is specified, register all | 1071 // If --register-chrome-browser option is specified, register all |
1066 // Chrome protocol/file associations, as well as register it as a valid | 1072 // Chrome protocol/file associations, as well as register it as a valid |
1067 // browser for Start Menu->Internet shortcut. This switch will also | 1073 // browser for Start Menu->Internet shortcut. This switch will also |
1068 // register Chrome as a valid handler for a set of URL protocols that | 1074 // register Chrome as a valid handler for a set of URL protocols that |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 // We started as system-level and have been re-launched as user level | 1181 // We started as system-level and have been re-launched as user level |
1176 // to continue with the toast experiment. | 1182 // to continue with the toast experiment. |
1177 Version installed_version; | 1183 Version installed_version; |
1178 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); | 1184 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); |
1179 if (!installed_version.IsValid()) { | 1185 if (!installed_version.IsValid()) { |
1180 LOG(ERROR) << "No installation of " | 1186 LOG(ERROR) << "No installation of " |
1181 << browser_dist->GetDisplayName() | 1187 << browser_dist->GetDisplayName() |
1182 << " found for system-level toast."; | 1188 << " found for system-level toast."; |
1183 } else { | 1189 } else { |
1184 product.LaunchUserExperiment( | 1190 product.LaunchUserExperiment( |
1185 cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE, true); | 1191 setup_exe, installer::REENTRY_SYS_UPDATE, true); |
1186 } | 1192 } |
1187 } | 1193 } |
1188 } else if (cmd_line.HasSwitch(installer::switches::kPatch)) { | 1194 } else if (cmd_line.HasSwitch(installer::switches::kPatch)) { |
1189 const std::string patch_type_str( | 1195 const std::string patch_type_str( |
1190 cmd_line.GetSwitchValueASCII(installer::switches::kPatch)); | 1196 cmd_line.GetSwitchValueASCII(installer::switches::kPatch)); |
1191 const base::FilePath input_file( | 1197 const base::FilePath input_file( |
1192 cmd_line.GetSwitchValuePath(installer::switches::kInputFile)); | 1198 cmd_line.GetSwitchValuePath(installer::switches::kInputFile)); |
1193 const base::FilePath patch_file( | 1199 const base::FilePath patch_file( |
1194 cmd_line.GetSwitchValuePath(installer::switches::kPatchFile)); | 1200 cmd_line.GetSwitchValuePath(installer::switches::kPatchFile)); |
1195 const base::FilePath output_file( | 1201 const base::FilePath output_file( |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 original_state->Initialize(); | 1376 original_state->Initialize(); |
1371 installer_state->Initialize(cmd_line, prefs, *original_state); | 1377 installer_state->Initialize(cmd_line, prefs, *original_state); |
1372 } | 1378 } |
1373 | 1379 |
1374 } // namespace | 1380 } // namespace |
1375 | 1381 |
1376 namespace installer { | 1382 namespace installer { |
1377 | 1383 |
1378 InstallStatus InstallProductsHelper( | 1384 InstallStatus InstallProductsHelper( |
1379 const InstallationState& original_state, | 1385 const InstallationState& original_state, |
| 1386 const base::FilePath& setup_exe, |
1380 const CommandLine& cmd_line, | 1387 const CommandLine& cmd_line, |
1381 const MasterPreferences& prefs, | 1388 const MasterPreferences& prefs, |
1382 const InstallerState& installer_state, | 1389 const InstallerState& installer_state, |
1383 base::FilePath* installer_directory, | 1390 base::FilePath* installer_directory, |
1384 ArchiveType* archive_type, | 1391 ArchiveType* archive_type, |
1385 bool* delegated_to_existing) { | 1392 bool* delegated_to_existing) { |
1386 DCHECK(archive_type); | 1393 DCHECK(archive_type); |
1387 DCHECK(delegated_to_existing); | 1394 DCHECK(delegated_to_existing); |
1388 const bool system_install = installer_state.system_install(); | 1395 const bool system_install = installer_state.system_install(); |
1389 InstallStatus install_status = UNKNOWN_STATUS; | 1396 InstallStatus install_status = UNKNOWN_STATUS; |
(...skipping 15 matching lines...) Expand all Loading... |
1405 return TEMP_DIR_FAILED; | 1412 return TEMP_DIR_FAILED; |
1406 } | 1413 } |
1407 | 1414 |
1408 // Uncompress and optionally patch the archive if an uncompressed archive was | 1415 // Uncompress and optionally patch the archive if an uncompressed archive was |
1409 // not specified on the command line and a compressed archive is found. | 1416 // not specified on the command line and a compressed archive is found. |
1410 *archive_type = UNKNOWN_ARCHIVE_TYPE; | 1417 *archive_type = UNKNOWN_ARCHIVE_TYPE; |
1411 base::FilePath uncompressed_archive(cmd_line.GetSwitchValuePath( | 1418 base::FilePath uncompressed_archive(cmd_line.GetSwitchValuePath( |
1412 switches::kUncompressedArchive)); | 1419 switches::kUncompressedArchive)); |
1413 if (uncompressed_archive.empty()) { | 1420 if (uncompressed_archive.empty()) { |
1414 scoped_ptr<ArchivePatchHelper> archive_helper( | 1421 scoped_ptr<ArchivePatchHelper> archive_helper( |
1415 CreateChromeArchiveHelper(cmd_line, installer_state, unpack_path)); | 1422 CreateChromeArchiveHelper(setup_exe, cmd_line, installer_state, |
| 1423 unpack_path)); |
1416 if (archive_helper) { | 1424 if (archive_helper) { |
1417 VLOG(1) << "Installing Chrome from compressed archive " | 1425 VLOG(1) << "Installing Chrome from compressed archive " |
1418 << archive_helper->compressed_archive().value(); | 1426 << archive_helper->compressed_archive().value(); |
1419 if (!UncompressAndPatchChromeArchive(original_state, | 1427 if (!UncompressAndPatchChromeArchive(original_state, |
1420 installer_state, | 1428 installer_state, |
1421 archive_helper.get(), | 1429 archive_helper.get(), |
1422 archive_type, | 1430 archive_type, |
1423 &install_status)) { | 1431 &install_status)) { |
1424 DCHECK_NE(install_status, UNKNOWN_STATUS); | 1432 DCHECK_NE(install_status, UNKNOWN_STATUS); |
1425 return install_status; | 1433 return install_status; |
1426 } | 1434 } |
1427 uncompressed_archive = archive_helper->target(); | 1435 uncompressed_archive = archive_helper->target(); |
1428 DCHECK(!uncompressed_archive.empty()); | 1436 DCHECK(!uncompressed_archive.empty()); |
1429 } | 1437 } |
1430 } | 1438 } |
1431 | 1439 |
1432 // Check for an uncompressed archive alongside the current executable if one | 1440 // Check for an uncompressed archive alongside the current executable if one |
1433 // was not given or generated. | 1441 // was not given or generated. |
1434 if (uncompressed_archive.empty()) { | 1442 if (uncompressed_archive.empty()) |
1435 uncompressed_archive = | 1443 uncompressed_archive = setup_exe.DirName().Append(kChromeArchive); |
1436 cmd_line.GetProgram().DirName().Append(kChromeArchive); | |
1437 } | |
1438 | 1444 |
1439 if (*archive_type == UNKNOWN_ARCHIVE_TYPE) { | 1445 if (*archive_type == UNKNOWN_ARCHIVE_TYPE) { |
1440 // An archive was not uncompressed or patched above. | 1446 // An archive was not uncompressed or patched above. |
1441 if (uncompressed_archive.empty() || | 1447 if (uncompressed_archive.empty() || |
1442 !base::PathExists(uncompressed_archive)) { | 1448 !base::PathExists(uncompressed_archive)) { |
1443 LOG(ERROR) << "Cannot install Chrome without an uncompressed archive."; | 1449 LOG(ERROR) << "Cannot install Chrome without an uncompressed archive."; |
1444 installer_state.WriteInstallerResult( | 1450 installer_state.WriteInstallerResult( |
1445 INVALID_ARCHIVE, IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); | 1451 INVALID_ARCHIVE, IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); |
1446 return INVALID_ARCHIVE; | 1452 return INVALID_ARCHIVE; |
1447 } | 1453 } |
(...skipping 24 matching lines...) Expand all Loading... |
1472 } else { | 1478 } else { |
1473 VLOG(1) << "version to install: " << installer_version->GetString(); | 1479 VLOG(1) << "version to install: " << installer_version->GetString(); |
1474 bool proceed_with_installation = true; | 1480 bool proceed_with_installation = true; |
1475 | 1481 |
1476 if (installer_state.operation() == InstallerState::MULTI_INSTALL) { | 1482 if (installer_state.operation() == InstallerState::MULTI_INSTALL) { |
1477 // This is a new install of a multi-install product. Rather than give up | 1483 // This is a new install of a multi-install product. Rather than give up |
1478 // in case a higher version of the binaries (including a single-install | 1484 // in case a higher version of the binaries (including a single-install |
1479 // of Chrome, which can safely be migrated to multi-install by way of | 1485 // of Chrome, which can safely be migrated to multi-install by way of |
1480 // CheckMultiInstallConditions) is already installed, delegate to the | 1486 // CheckMultiInstallConditions) is already installed, delegate to the |
1481 // installed setup.exe to install the product at hand. | 1487 // installed setup.exe to install the product at hand. |
1482 base::FilePath setup_exe; | 1488 base::FilePath existing_setup_exe; |
1483 if (GetExistingHigherInstaller(original_state, system_install, | 1489 if (GetExistingHigherInstaller(original_state, system_install, |
1484 *installer_version, &setup_exe)) { | 1490 *installer_version, &existing_setup_exe)) { |
1485 VLOG(1) << "Deferring to existing installer."; | 1491 VLOG(1) << "Deferring to existing installer."; |
1486 installer_state.UpdateStage(DEFERRING_TO_HIGHER_VERSION); | 1492 installer_state.UpdateStage(DEFERRING_TO_HIGHER_VERSION); |
1487 if (DeferToExistingInstall(setup_exe, cmd_line, installer_state, | 1493 if (DeferToExistingInstall(existing_setup_exe, cmd_line, |
1488 temp_path.path(), &install_status)) { | 1494 installer_state, temp_path.path(), |
| 1495 &install_status)) { |
1489 *delegated_to_existing = true; | 1496 *delegated_to_existing = true; |
1490 return install_status; | 1497 return install_status; |
1491 } | 1498 } |
1492 } | 1499 } |
1493 } | 1500 } |
1494 | 1501 |
1495 uint32 higher_products = 0; | 1502 uint32 higher_products = 0; |
1496 COMPILE_ASSERT( | 1503 COMPILE_ASSERT( |
1497 sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES, | 1504 sizeof(higher_products) * 8 > BrowserDistribution::NUM_TYPES, |
1498 too_many_distribution_types_); | 1505 too_many_distribution_types_); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 installer_state.WriteInstallerResult(install_status, 0, NULL); | 1558 installer_state.WriteInstallerResult(install_status, 0, NULL); |
1552 } | 1559 } |
1553 } | 1560 } |
1554 | 1561 |
1555 } | 1562 } |
1556 | 1563 |
1557 if (proceed_with_installation) { | 1564 if (proceed_with_installation) { |
1558 base::FilePath prefs_source_path(cmd_line.GetSwitchValueNative( | 1565 base::FilePath prefs_source_path(cmd_line.GetSwitchValueNative( |
1559 switches::kInstallerData)); | 1566 switches::kInstallerData)); |
1560 install_status = InstallOrUpdateProduct( | 1567 install_status = InstallOrUpdateProduct( |
1561 original_state, installer_state, cmd_line.GetProgram(), | 1568 original_state, installer_state, setup_exe, uncompressed_archive, |
1562 uncompressed_archive, temp_path.path(), src_path, prefs_source_path, | 1569 temp_path.path(), src_path, prefs_source_path, prefs, |
1563 prefs, *installer_version); | 1570 *installer_version); |
1564 | 1571 |
1565 int install_msg_base = IDS_INSTALL_FAILED_BASE; | 1572 int install_msg_base = IDS_INSTALL_FAILED_BASE; |
1566 base::string16 chrome_exe; | 1573 base::string16 chrome_exe; |
1567 base::string16 quoted_chrome_exe; | 1574 base::string16 quoted_chrome_exe; |
1568 if (install_status == SAME_VERSION_REPAIR_FAILED) { | 1575 if (install_status == SAME_VERSION_REPAIR_FAILED) { |
1569 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; | 1576 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; |
1570 } else if (install_status != INSTALL_FAILED) { | 1577 } else if (install_status != INSTALL_FAILED) { |
1571 if (installer_state.target_path().empty()) { | 1578 if (installer_state.target_path().empty()) { |
1572 // If we failed to construct install path, it means the OS call to | 1579 // If we failed to construct install path, it means the OS call to |
1573 // get %ProgramFiles% or %AppData% failed. Report this as failure. | 1580 // get %ProgramFiles% or %AppData% failed. Report this as failure. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 // There might be an experiment (for upgrade usually) that needs to happen. | 1646 // There might be an experiment (for upgrade usually) that needs to happen. |
1640 // An experiment's outcome can include chrome's uninstallation. If that is | 1647 // An experiment's outcome can include chrome's uninstallation. If that is |
1641 // the case we would not do that directly at this point but in another | 1648 // the case we would not do that directly at this point but in another |
1642 // instance of setup.exe | 1649 // instance of setup.exe |
1643 // | 1650 // |
1644 // There is another way to reach this same function if this is a system | 1651 // There is another way to reach this same function if this is a system |
1645 // level install. See HandleNonInstallCmdLineOptions(). | 1652 // level install. See HandleNonInstallCmdLineOptions(). |
1646 { | 1653 { |
1647 // If installation failed, use the path to the currently running setup. | 1654 // If installation failed, use the path to the currently running setup. |
1648 // If installation succeeded, use the path to setup in the installer dir. | 1655 // If installation succeeded, use the path to setup in the installer dir. |
1649 base::FilePath setup_path(cmd_line.GetProgram()); | 1656 base::FilePath setup_path(setup_exe); |
1650 if (InstallUtil::GetInstallReturnCode(install_status) == 0) { | 1657 if (InstallUtil::GetInstallReturnCode(install_status) == 0) { |
1651 setup_path = installer_state.GetInstallerDirectory(*installer_version) | 1658 setup_path = installer_state.GetInstallerDirectory(*installer_version) |
1652 .Append(setup_path.BaseName()); | 1659 .Append(setup_path.BaseName()); |
1653 } | 1660 } |
1654 const Products& products = installer_state.products(); | 1661 const Products& products = installer_state.products(); |
1655 for (Products::const_iterator it = products.begin(); it < products.end(); | 1662 for (Products::const_iterator it = products.begin(); it < products.end(); |
1656 ++it) { | 1663 ++it) { |
1657 const Product& product = **it; | 1664 const Product& product = **it; |
1658 product.LaunchUserExperiment(setup_path, install_status, | 1665 product.LaunchUserExperiment(setup_path, install_status, system_install); |
1659 system_install); | |
1660 } | 1666 } |
1661 } | 1667 } |
1662 | 1668 |
1663 // If installation completed successfully, return the path to the directory | 1669 // If installation completed successfully, return the path to the directory |
1664 // containing the newly installed setup.exe and uncompressed archive if the | 1670 // containing the newly installed setup.exe and uncompressed archive if the |
1665 // caller requested it. | 1671 // caller requested it. |
1666 if (installer_directory && | 1672 if (installer_directory && |
1667 InstallUtil::GetInstallReturnCode(install_status) == 0) { | 1673 InstallUtil::GetInstallReturnCode(install_status) == 0) { |
1668 *installer_directory = | 1674 *installer_directory = |
1669 installer_state.GetInstallerDirectory(*installer_version); | 1675 installer_state.GetInstallerDirectory(*installer_version); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || | 1739 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || |
1734 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1740 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
1735 return installer::SXS_OPTION_NOT_SUPPORTED; | 1741 return installer::SXS_OPTION_NOT_SUPPORTED; |
1736 } | 1742 } |
1737 } | 1743 } |
1738 | 1744 |
1739 // Some command line options are no longer supported and must error out. | 1745 // Some command line options are no longer supported and must error out. |
1740 if (installer::ContainsUnsupportedSwitch(cmd_line)) | 1746 if (installer::ContainsUnsupportedSwitch(cmd_line)) |
1741 return installer::UNSUPPORTED_OPTION; | 1747 return installer::UNSUPPORTED_OPTION; |
1742 | 1748 |
| 1749 // A variety of installer operations require the path to the current |
| 1750 // executable. Get it once here for use throughout these operations. Note that |
| 1751 // the path service is the authoritative source for this path. One might think |
| 1752 // that CommandLine::GetProgram would suffice, but it won't since |
| 1753 // CreateProcess may have been called with a command line that is somewhat |
| 1754 // ambiguous (e.g., an unquoted path with spaces, or a path lacking the file |
| 1755 // extension), in which case CommandLineToArgv will not yield an argv with the |
| 1756 // true path to the program at position 0. |
| 1757 base::FilePath setup_exe; |
| 1758 if (!PathService::Get(base::FILE_EXE, &setup_exe)) { |
| 1759 NOTREACHED(); |
| 1760 return installer::OS_ERROR; |
| 1761 } |
| 1762 |
1743 int exit_code = 0; | 1763 int exit_code = 0; |
1744 if (HandleNonInstallCmdLineOptions( | 1764 if (HandleNonInstallCmdLineOptions( |
1745 original_state, cmd_line, &installer_state, &exit_code)) { | 1765 original_state, setup_exe, cmd_line, &installer_state, &exit_code)) { |
1746 return exit_code; | 1766 return exit_code; |
1747 } | 1767 } |
1748 | 1768 |
1749 if (system_install && !IsUserAnAdmin()) { | 1769 if (system_install && !IsUserAnAdmin()) { |
1750 if (base::win::GetVersion() >= base::win::VERSION_VISTA && | 1770 if (base::win::GetVersion() >= base::win::VERSION_VISTA && |
1751 !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { | 1771 !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { |
1752 CommandLine new_cmd(CommandLine::NO_PROGRAM); | 1772 CommandLine new_cmd(CommandLine::NO_PROGRAM); |
1753 new_cmd.AppendArguments(cmd_line, true); | 1773 new_cmd.AppendArguments(cmd_line, true); |
1754 // Append --run-as-admin flag to let the new instance of setup.exe know | 1774 // Append --run-as-admin flag to let the new instance of setup.exe know |
1755 // that we already tried to launch ourselves as admin. | 1775 // that we already tried to launch ourselves as admin. |
(...skipping 16 matching lines...) Expand all Loading... |
1772 } | 1792 } |
1773 | 1793 |
1774 UninstallMultiChromeFrameIfPresent(cmd_line, prefs, | 1794 UninstallMultiChromeFrameIfPresent(cmd_line, prefs, |
1775 &original_state, &installer_state); | 1795 &original_state, &installer_state); |
1776 | 1796 |
1777 base::FilePath installer_directory; | 1797 base::FilePath installer_directory; |
1778 installer::InstallStatus install_status = installer::UNKNOWN_STATUS; | 1798 installer::InstallStatus install_status = installer::UNKNOWN_STATUS; |
1779 // If --uninstall option is given, uninstall the identified product(s) | 1799 // If --uninstall option is given, uninstall the identified product(s) |
1780 if (is_uninstall) { | 1800 if (is_uninstall) { |
1781 install_status = | 1801 install_status = |
1782 UninstallProducts(original_state, installer_state, cmd_line); | 1802 UninstallProducts(original_state, installer_state, setup_exe, cmd_line); |
1783 } else { | 1803 } else { |
1784 // If --uninstall option is not specified, we assume it is install case. | 1804 // If --uninstall option is not specified, we assume it is install case. |
1785 install_status = | 1805 install_status = |
1786 InstallProducts(original_state, cmd_line, prefs, &installer_state, | 1806 InstallProducts(original_state, setup_exe, cmd_line, prefs, |
1787 &installer_directory); | 1807 &installer_state, &installer_directory); |
1788 } | 1808 } |
1789 | 1809 |
1790 // Validate that the machine is now in a good state following the operation. | 1810 // Validate that the machine is now in a good state following the operation. |
1791 // TODO(grt): change this to log at DFATAL once we're convinced that the | 1811 // TODO(grt): change this to log at DFATAL once we're convinced that the |
1792 // validator handles all cases properly. | 1812 // validator handles all cases properly. |
1793 InstallationValidator::InstallationType installation_type = | 1813 InstallationValidator::InstallationType installation_type = |
1794 InstallationValidator::NO_PRODUCTS; | 1814 InstallationValidator::NO_PRODUCTS; |
1795 LOG_IF(ERROR, | 1815 LOG_IF(ERROR, |
1796 !InstallationValidator::ValidateInstallationType(system_install, | 1816 !InstallationValidator::ValidateInstallationType(system_install, |
1797 &installation_type)); | 1817 &installation_type)); |
1798 | 1818 |
1799 int return_code = 0; | 1819 int return_code = 0; |
1800 // MSI demands that custom actions always return 0 (ERROR_SUCCESS) or it will | 1820 // MSI demands that custom actions always return 0 (ERROR_SUCCESS) or it will |
1801 // rollback the action. If we're uninstalling we want to avoid this, so always | 1821 // rollback the action. If we're uninstalling we want to avoid this, so always |
1802 // report success, squashing any more informative return codes. | 1822 // report success, squashing any more informative return codes. |
1803 if (!(installer_state.is_msi() && is_uninstall)) { | 1823 if (!(installer_state.is_msi() && is_uninstall)) { |
1804 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1824 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1805 // to pass through, since this is only returned on uninstall which is | 1825 // to pass through, since this is only returned on uninstall which is |
1806 // never invoked directly by Google Update. | 1826 // never invoked directly by Google Update. |
1807 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1827 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1808 } | 1828 } |
1809 | 1829 |
1810 VLOG(1) << "Installation complete, returning: " << return_code; | 1830 VLOG(1) << "Installation complete, returning: " << return_code; |
1811 | 1831 |
1812 return return_code; | 1832 return return_code; |
1813 } | 1833 } |
OLD | NEW |