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 <windows.h> | 5 #include <windows.h> |
6 #include <msi.h> | 6 #include <msi.h> |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 | 9 |
10 #include <string> | |
11 | |
12 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
13 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
14 #include "base/command_line.h" | 12 #include "base/command_line.h" |
15 #include "base/file_util.h" | 13 #include "base/file_util.h" |
16 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
17 #include "base/path_service.h" | 15 #include "base/path_service.h" |
18 #include "base/process_util.h" | 16 #include "base/process_util.h" |
19 #include "base/scoped_temp_dir.h" | 17 #include "base/scoped_temp_dir.h" |
18 #include "base/string16.h" | |
20 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
21 #include "base/string_util.h" | 20 #include "base/string_util.h" |
22 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
23 #include "base/values.h" | 22 #include "base/values.h" |
24 #include "base/win/registry.h" | 23 #include "base/win/registry.h" |
25 #include "base/win/scoped_handle.h" | 24 #include "base/win/scoped_handle.h" |
26 #include "base/win/win_util.h" | 25 #include "base/win/win_util.h" |
27 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
28 #include "breakpad/src/client/windows/handler/exception_handler.h" | 27 #include "breakpad/src/client/windows/handler/exception_handler.h" |
29 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 const FilePath& temp_path, | 91 const FilePath& temp_path, |
93 const FilePath& output_directory, | 92 const FilePath& output_directory, |
94 installer::ArchiveType* archive_type) { | 93 installer::ArchiveType* archive_type) { |
95 DCHECK(archive_type); | 94 DCHECK(archive_type); |
96 | 95 |
97 installer_state.UpdateStage(installer::UNCOMPRESSING); | 96 installer_state.UpdateStage(installer::UNCOMPRESSING); |
98 | 97 |
99 // First uncompress the payload. This could be a differential | 98 // First uncompress the payload. This could be a differential |
100 // update (patch.7z) or full archive (chrome.7z). If this uncompress fails | 99 // update (patch.7z) or full archive (chrome.7z). If this uncompress fails |
101 // return with error. | 100 // return with error. |
102 std::wstring unpacked_file; | 101 string16 unpacked_file; |
103 int32 ret = LzmaUtil::UnPackArchive(archive.value(), temp_path.value(), | 102 int32 ret = LzmaUtil::UnPackArchive(archive.value(), temp_path.value(), |
104 &unpacked_file); | 103 &unpacked_file); |
105 if (ret != NO_ERROR) | 104 if (ret != NO_ERROR) |
106 return ret; | 105 return ret; |
107 | 106 |
108 FilePath uncompressed_archive(temp_path.Append(installer::kChromeArchive)); | 107 FilePath uncompressed_archive(temp_path.Append(installer::kChromeArchive)); |
109 scoped_ptr<Version> archive_version( | 108 scoped_ptr<Version> archive_version( |
110 installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); | 109 installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); |
111 | 110 |
112 // Check if this is differential update and if it is, patch it to the | 111 // Check if this is differential update and if it is, patch it to the |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 // Next, add all products we're operating on. std::transform can handily do | 226 // Next, add all products we're operating on. std::transform can handily do |
228 // this for us, but this is discouraged as being too tricky. | 227 // this for us, but this is discouraged as being too tricky. |
229 const Products& products = installer_state->products(); | 228 const Products& products = installer_state->products(); |
230 for (Products::size_type i = 0; i < products.size(); ++i) { | 229 for (Products::size_type i = 0; i < products.size(); ++i) { |
231 dists[num_dists++] = products[i]->distribution(); | 230 dists[num_dists++] = products[i]->distribution(); |
232 } | 231 } |
233 | 232 |
234 // Add work items to delete the "opv", "cpv", and "cmd" values from all | 233 // Add work items to delete the "opv", "cpv", and "cmd" values from all |
235 // distributions. | 234 // distributions. |
236 HKEY reg_root = installer_state->root_key(); | 235 HKEY reg_root = installer_state->root_key(); |
237 std::wstring version_key; | 236 string16 version_key; |
238 for (int i = 0; i < num_dists; ++i) { | 237 for (int i = 0; i < num_dists; ++i) { |
239 version_key = dists[i]->GetVersionKey(); | 238 version_key = dists[i]->GetVersionKey(); |
240 install_list->AddDeleteRegValueWorkItem( | 239 install_list->AddDeleteRegValueWorkItem( |
241 reg_root, version_key, google_update::kRegOldVersionField); | 240 reg_root, version_key, google_update::kRegOldVersionField); |
242 install_list->AddDeleteRegValueWorkItem( | 241 install_list->AddDeleteRegValueWorkItem( |
243 reg_root, version_key, google_update::kRegCriticalVersionField); | 242 reg_root, version_key, google_update::kRegCriticalVersionField); |
244 install_list->AddDeleteRegValueWorkItem( | 243 install_list->AddDeleteRegValueWorkItem( |
245 reg_root, version_key, google_update::kRegRenameCmdField); | 244 reg_root, version_key, google_update::kRegRenameCmdField); |
246 } | 245 } |
247 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; | 246 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
656 // uncompressing and binary patching. Get the location for this file. | 655 // uncompressing and binary patching. Get the location for this file. |
657 FilePath archive_to_copy( | 656 FilePath archive_to_copy( |
658 temp_path.path().Append(installer::kChromeArchive)); | 657 temp_path.path().Append(installer::kChromeArchive)); |
659 FilePath prefs_source_path(cmd_line.GetSwitchValueNative( | 658 FilePath prefs_source_path(cmd_line.GetSwitchValueNative( |
660 installer::switches::kInstallerData)); | 659 installer::switches::kInstallerData)); |
661 install_status = installer::InstallOrUpdateProduct(original_state, | 660 install_status = installer::InstallOrUpdateProduct(original_state, |
662 installer_state, cmd_line.GetProgram(), archive_to_copy, | 661 installer_state, cmd_line.GetProgram(), archive_to_copy, |
663 temp_path.path(), prefs_source_path, prefs, *installer_version); | 662 temp_path.path(), prefs_source_path, prefs, *installer_version); |
664 | 663 |
665 int install_msg_base = IDS_INSTALL_FAILED_BASE; | 664 int install_msg_base = IDS_INSTALL_FAILED_BASE; |
666 std::wstring chrome_exe; | 665 string16 chrome_exe; |
666 string16 quoted_chrome_exe; | |
667 if (install_status == installer::SAME_VERSION_REPAIR_FAILED) { | 667 if (install_status == installer::SAME_VERSION_REPAIR_FAILED) { |
668 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { | 668 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { |
669 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_CF_BASE; | 669 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_CF_BASE; |
670 } else { | 670 } else { |
671 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; | 671 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; |
672 } | 672 } |
673 } else if (install_status != installer::INSTALL_FAILED) { | 673 } else if (install_status != installer::INSTALL_FAILED) { |
674 if (installer_state.target_path().empty()) { | 674 if (installer_state.target_path().empty()) { |
675 // If we failed to construct install path, it means the OS call to | 675 // If we failed to construct install path, it means the OS call to |
676 // get %ProgramFiles% or %AppData% failed. Report this as failure. | 676 // get %ProgramFiles% or %AppData% failed. Report this as failure. |
677 install_msg_base = IDS_INSTALL_OS_ERROR_BASE; | 677 install_msg_base = IDS_INSTALL_OS_ERROR_BASE; |
678 install_status = installer::OS_ERROR; | 678 install_status = installer::OS_ERROR; |
679 } else { | 679 } else { |
680 chrome_exe = installer_state.target_path() | 680 chrome_exe = installer_state.target_path() |
681 .Append(installer::kChromeExe).value(); | 681 .Append(installer::kChromeExe).value(); |
682 chrome_exe = L"\"" + chrome_exe + L"\""; | 682 quoted_chrome_exe = L"\"" + chrome_exe + L"\""; |
683 install_msg_base = 0; | 683 install_msg_base = 0; |
684 } | 684 } |
685 } | 685 } |
686 | 686 |
687 installer_state.UpdateStage(installer::FINISHING); | 687 installer_state.UpdateStage(installer::FINISHING); |
688 | 688 |
689 // Only do Chrome-specific stuff (like launching the browser) if | 689 // Only do Chrome-specific stuff (like launching the browser) if |
690 // Chrome was specifically requested (rather than being upgraded as | 690 // Chrome was specifically requested (rather than being upgraded as |
691 // part of a multi-install). | 691 // part of a multi-install). |
692 const Product* chrome_install = prefs.install_chrome() ? | 692 const Product* chrome_install = prefs.install_chrome() ? |
693 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) : | 693 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) : |
694 NULL; | 694 NULL; |
695 | 695 |
696 bool do_not_register_for_update_launch = false; | 696 bool do_not_register_for_update_launch = false; |
697 if (chrome_install) { | 697 if (chrome_install) { |
698 prefs.GetBool( | 698 prefs.GetBool( |
699 installer::master_preferences::kDoNotRegisterForUpdateLaunch, | 699 installer::master_preferences::kDoNotRegisterForUpdateLaunch, |
700 &do_not_register_for_update_launch); | 700 &do_not_register_for_update_launch); |
701 } else { | 701 } else { |
702 do_not_register_for_update_launch = true; // Never register. | 702 do_not_register_for_update_launch = true; // Never register. |
703 } | 703 } |
704 | 704 |
705 bool write_chrome_launch_string = | 705 bool write_chrome_launch_string = |
706 (!do_not_register_for_update_launch && | 706 (!do_not_register_for_update_launch && |
707 install_status != installer::IN_USE_UPDATED); | 707 install_status != installer::IN_USE_UPDATED); |
708 | 708 |
709 installer_state.WriteInstallerResult(install_status, install_msg_base, | 709 installer_state.WriteInstallerResult(install_status, install_msg_base, |
710 write_chrome_launch_string ? &chrome_exe : NULL); | 710 write_chrome_launch_string ? "ed_chrome_exe : NULL); |
711 | 711 |
712 if (install_status == installer::FIRST_INSTALL_SUCCESS) { | 712 if (install_status == installer::FIRST_INSTALL_SUCCESS) { |
713 VLOG(1) << "First install successful."; | 713 VLOG(1) << "First install successful."; |
714 if (chrome_install) { | 714 if (chrome_install) { |
715 // We never want to launch Chrome in system level install mode. | 715 // We never want to launch Chrome in system level install mode. |
716 bool do_not_launch_chrome = false; | 716 bool do_not_launch_chrome = false; |
717 prefs.GetBool( | 717 prefs.GetBool( |
718 installer::master_preferences::kDoNotLaunchChrome, | 718 installer::master_preferences::kDoNotLaunchChrome, |
719 &do_not_launch_chrome); | 719 &do_not_launch_chrome); |
720 if (!system_install && !do_not_launch_chrome) | 720 if (!system_install && !do_not_launch_chrome) |
721 chrome_install->LaunchChrome(installer_state.target_path()); | 721 chrome_install->LaunchChrome(installer_state.target_path()); |
722 } | 722 } |
723 } else if ((install_status == installer::NEW_VERSION_UPDATED) || | 723 } else if ((install_status == installer::NEW_VERSION_UPDATED) || |
724 (install_status == installer::IN_USE_UPDATED)) { | 724 (install_status == installer::IN_USE_UPDATED)) { |
725 const Product* chrome = installer_state.FindProduct( | 725 const Product* chrome = installer_state.FindProduct( |
726 BrowserDistribution::CHROME_BROWSER); | 726 BrowserDistribution::CHROME_BROWSER); |
727 if (chrome != NULL) | 727 if (chrome != NULL) { |
728 installer::RemoveChromeLegacyRegistryKeys(chrome->distribution()); | 728 installer::RemoveChromeLegacyRegistryKeys(chrome->distribution(), |
grt (UTC plus 2)
2012/06/11 17:28:57
since chrome_exe is set deep in conditionals up ab
gab
2012/06/11 19:29:39
Done.
| |
729 chrome_exe); | |
730 } | |
729 } | 731 } |
730 } | 732 } |
731 } | 733 } |
732 | 734 |
733 // There might be an experiment (for upgrade usually) that needs to happen. | 735 // There might be an experiment (for upgrade usually) that needs to happen. |
734 // An experiment's outcome can include chrome's uninstallation. If that is | 736 // An experiment's outcome can include chrome's uninstallation. If that is |
735 // the case we would not do that directly at this point but in another | 737 // the case we would not do that directly at this point but in another |
736 // instance of setup.exe | 738 // instance of setup.exe |
737 // | 739 // |
738 // There is another way to reach this same function if this is a system | 740 // There is another way to reach this same function if this is a system |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
894 cmd_line, remove_all, force, *products[i]); | 896 cmd_line, remove_all, force, *products[i]); |
895 if (prod_status != installer::UNINSTALL_SUCCESSFUL) | 897 if (prod_status != installer::UNINSTALL_SUCCESSFUL) |
896 install_status = prod_status; | 898 install_status = prod_status; |
897 } | 899 } |
898 | 900 |
899 UninstallGoogleUpdate(installer_state.system_install()); | 901 UninstallGoogleUpdate(installer_state.system_install()); |
900 | 902 |
901 return install_status; | 903 return install_status; |
902 } | 904 } |
903 | 905 |
904 installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) { | 906 installer::InstallStatus ShowEULADialog(const string16& inner_frame) { |
905 VLOG(1) << "About to show EULA"; | 907 VLOG(1) << "About to show EULA"; |
906 std::wstring eula_path = installer::GetLocalizedEulaResource(); | 908 string16 eula_path = installer::GetLocalizedEulaResource(); |
907 if (eula_path.empty()) { | 909 if (eula_path.empty()) { |
908 LOG(ERROR) << "No EULA path available"; | 910 LOG(ERROR) << "No EULA path available"; |
909 return installer::EULA_REJECTED; | 911 return installer::EULA_REJECTED; |
910 } | 912 } |
911 // Newer versions of the caller pass an inner frame parameter that must | 913 // Newer versions of the caller pass an inner frame parameter that must |
912 // be given to the html page being launched. | 914 // be given to the html page being launched. |
913 installer::EulaHTMLDialog dlg(eula_path, inner_frame); | 915 installer::EulaHTMLDialog dlg(eula_path, inner_frame); |
914 installer::EulaHTMLDialog::Outcome outcome = dlg.ShowModal(); | 916 installer::EulaHTMLDialog::Outcome outcome = dlg.ShowModal(); |
915 if (installer::EulaHTMLDialog::REJECTED == outcome) { | 917 if (installer::EulaHTMLDialog::REJECTED == outcome) { |
916 LOG(ERROR) << "EULA rejected or EULA failure"; | 918 LOG(ERROR) << "EULA rejected or EULA failure"; |
(...skipping 21 matching lines...) Expand all Loading... | |
938 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { | 940 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { |
939 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; | 941 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; |
940 // If --update-setup-exe command line option is given, we apply the given | 942 // If --update-setup-exe command line option is given, we apply the given |
941 // patch to current exe, and store the resulting binary in the path | 943 // patch to current exe, and store the resulting binary in the path |
942 // specified by --new-setup-exe. But we need to first unpack the file | 944 // specified by --new-setup-exe. But we need to first unpack the file |
943 // given in --update-setup-exe. | 945 // given in --update-setup-exe. |
944 ScopedTempDir temp_path; | 946 ScopedTempDir temp_path; |
945 if (!temp_path.CreateUniqueTempDir()) { | 947 if (!temp_path.CreateUniqueTempDir()) { |
946 PLOG(ERROR) << "Could not create temporary path."; | 948 PLOG(ERROR) << "Could not create temporary path."; |
947 } else { | 949 } else { |
948 std::wstring setup_patch = cmd_line.GetSwitchValueNative( | 950 string16 setup_patch = cmd_line.GetSwitchValueNative( |
949 installer::switches::kUpdateSetupExe); | 951 installer::switches::kUpdateSetupExe); |
950 VLOG(1) << "Opening archive " << setup_patch; | 952 VLOG(1) << "Opening archive " << setup_patch; |
951 std::wstring uncompressed_patch; | 953 string16 uncompressed_patch; |
952 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.path().value(), | 954 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.path().value(), |
953 &uncompressed_patch) == NO_ERROR) { | 955 &uncompressed_patch) == NO_ERROR) { |
954 FilePath old_setup_exe = cmd_line.GetProgram(); | 956 FilePath old_setup_exe = cmd_line.GetProgram(); |
955 FilePath new_setup_exe = cmd_line.GetSwitchValuePath( | 957 FilePath new_setup_exe = cmd_line.GetSwitchValuePath( |
956 installer::switches::kNewSetupExe); | 958 installer::switches::kNewSetupExe); |
957 if (!installer::ApplyDiffPatch(old_setup_exe, | 959 if (!installer::ApplyDiffPatch(old_setup_exe, |
958 FilePath(uncompressed_patch), | 960 FilePath(uncompressed_patch), |
959 new_setup_exe, | 961 new_setup_exe, |
960 installer_state)) | 962 installer_state)) |
961 status = installer::NEW_VERSION_UPDATED; | 963 status = installer::NEW_VERSION_UPDATED; |
(...skipping 11 matching lines...) Expand all Loading... | |
973 if (*exit_code) { | 975 if (*exit_code) { |
974 LOG(WARNING) << "setup.exe patching failed."; | 976 LOG(WARNING) << "setup.exe patching failed."; |
975 installer_state->WriteInstallerResult(status, IDS_SETUP_PATCH_FAILED_BASE, | 977 installer_state->WriteInstallerResult(status, IDS_SETUP_PATCH_FAILED_BASE, |
976 NULL); | 978 NULL); |
977 } | 979 } |
978 // We will be exiting normally, so clear the stage indicator. | 980 // We will be exiting normally, so clear the stage indicator. |
979 installer_state->UpdateStage(installer::NO_STAGE); | 981 installer_state->UpdateStage(installer::NO_STAGE); |
980 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { | 982 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { |
981 // Check if we need to show the EULA. If it is passed as a command line | 983 // Check if we need to show the EULA. If it is passed as a command line |
982 // then the dialog is shown and regardless of the outcome setup exits here. | 984 // then the dialog is shown and regardless of the outcome setup exits here. |
983 std::wstring inner_frame = | 985 string16 inner_frame = |
984 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); | 986 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); |
985 *exit_code = ShowEULADialog(inner_frame); | 987 *exit_code = ShowEULADialog(inner_frame); |
986 if (installer::EULA_REJECTED != *exit_code) { | 988 if (installer::EULA_REJECTED != *exit_code) { |
987 GoogleUpdateSettings::SetEULAConsent( | 989 GoogleUpdateSettings::SetEULAConsent( |
988 original_state, BrowserDistribution::GetDistribution(), true); | 990 original_state, BrowserDistribution::GetDistribution(), true); |
989 } | 991 } |
990 } else if (cmd_line.HasSwitch( | 992 } else if (cmd_line.HasSwitch( |
991 installer::switches::kRegisterChromeBrowser)) { | 993 installer::switches::kRegisterChromeBrowser)) { |
992 installer::InstallStatus status = installer::UNKNOWN_STATUS; | 994 installer::InstallStatus status = installer::UNKNOWN_STATUS; |
993 const Product* chrome_install = | 995 const Product* chrome_install = |
994 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); | 996 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); |
995 if (chrome_install) { | 997 if (chrome_install) { |
996 // If --register-chrome-browser option is specified, register all | 998 // If --register-chrome-browser option is specified, register all |
997 // Chrome protocol/file associations, as well as register it as a valid | 999 // Chrome protocol/file associations, as well as register it as a valid |
998 // browser for Start Menu->Internet shortcut. This switch will also | 1000 // browser for Start Menu->Internet shortcut. This switch will also |
999 // register Chrome as a valid handler for a set of URL protocols that | 1001 // register Chrome as a valid handler for a set of URL protocols that |
1000 // Chrome may become the default handler for, either by the user marking | 1002 // Chrome may become the default handler for, either by the user marking |
1001 // Chrome as the default browser, through the Windows Default Programs | 1003 // Chrome as the default browser, through the Windows Default Programs |
1002 // control panel settings, or through website use of | 1004 // control panel settings, or through website use of |
1003 // registerProtocolHandler. These protocols are found in | 1005 // registerProtocolHandler. These protocols are found in |
1004 // ShellUtil::kPotentialProtocolAssociations. | 1006 // ShellUtil::kPotentialProtocolAssociations. |
1005 // The --register-url-protocol will additionally register Chrome as a | 1007 // The --register-url-protocol will additionally register Chrome as a |
1006 // potential handler for the supplied protocol, and is used if a website | 1008 // potential handler for the supplied protocol, and is used if a website |
1007 // registers a handler for a protocol not found in | 1009 // registers a handler for a protocol not found in |
1008 // ShellUtil::kPotentialProtocolAssociations. | 1010 // ShellUtil::kPotentialProtocolAssociations. |
1009 // These options should only be used when setup.exe is launched with admin | 1011 // These options should only be used when setup.exe is launched with admin |
1010 // rights. We do not make any user specific changes with this option. | 1012 // rights. We do not make any user specific changes with this option. |
1011 DCHECK(IsUserAnAdmin()); | 1013 DCHECK(IsUserAnAdmin()); |
1012 std::wstring chrome_exe(cmd_line.GetSwitchValueNative( | 1014 string16 chrome_exe(cmd_line.GetSwitchValueNative( |
1013 installer::switches::kRegisterChromeBrowser)); | 1015 installer::switches::kRegisterChromeBrowser)); |
1014 std::wstring suffix; | 1016 string16 suffix; |
1015 if (cmd_line.HasSwitch( | 1017 if (cmd_line.HasSwitch( |
1016 installer::switches::kRegisterChromeBrowserSuffix)) { | 1018 installer::switches::kRegisterChromeBrowserSuffix)) { |
1017 suffix = cmd_line.GetSwitchValueNative( | 1019 suffix = cmd_line.GetSwitchValueNative( |
1018 installer::switches::kRegisterChromeBrowserSuffix); | 1020 installer::switches::kRegisterChromeBrowserSuffix); |
1019 } | 1021 } |
1020 if (cmd_line.HasSwitch( | 1022 if (cmd_line.HasSwitch( |
1021 installer::switches::kRegisterURLProtocol)) { | 1023 installer::switches::kRegisterURLProtocol)) { |
1022 std::wstring protocol = cmd_line.GetSwitchValueNative( | 1024 string16 protocol = cmd_line.GetSwitchValueNative( |
1023 installer::switches::kRegisterURLProtocol); | 1025 installer::switches::kRegisterURLProtocol); |
1024 // ShellUtil::RegisterChromeForProtocol performs all registration | 1026 // ShellUtil::RegisterChromeForProtocol performs all registration |
1025 // done by ShellUtil::RegisterChromeBrowser, as well as registering | 1027 // done by ShellUtil::RegisterChromeBrowser, as well as registering |
1026 // with Windows as capable of handling the supplied protocol. | 1028 // with Windows as capable of handling the supplied protocol. |
1027 if (ShellUtil::RegisterChromeForProtocol(chrome_install->distribution(), | 1029 if (ShellUtil::RegisterChromeForProtocol(chrome_install->distribution(), |
1028 chrome_exe, suffix, protocol, false)) | 1030 chrome_exe, suffix, protocol, false)) |
1029 status = installer::IN_USE_UPDATED; | 1031 status = installer::IN_USE_UPDATED; |
1030 } else { | 1032 } else { |
1031 if (ShellUtil::RegisterChromeBrowser(chrome_install->distribution(), | 1033 if (ShellUtil::RegisterChromeBrowser(chrome_install->distribution(), |
1032 chrome_exe, suffix, false)) | 1034 chrome_exe, suffix, false)) |
1033 status = installer::IN_USE_UPDATED; | 1035 status = installer::IN_USE_UPDATED; |
1034 } | 1036 } |
1035 } else { | 1037 } else { |
1036 LOG(DFATAL) << "Can't register browser - Chrome distribution not found"; | 1038 LOG(DFATAL) << "Can't register browser - Chrome distribution not found"; |
1037 } | 1039 } |
1038 *exit_code = InstallUtil::GetInstallReturnCode(status); | 1040 *exit_code = InstallUtil::GetInstallReturnCode(status); |
1039 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { | 1041 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { |
1040 // If --rename-chrome-exe is specified, we want to rename the executables | 1042 // If --rename-chrome-exe is specified, we want to rename the executables |
1041 // and exit. | 1043 // and exit. |
1042 *exit_code = RenameChromeExecutables(original_state, installer_state); | 1044 *exit_code = RenameChromeExecutables(original_state, installer_state); |
1043 } else if (cmd_line.HasSwitch( | 1045 } else if (cmd_line.HasSwitch( |
1044 installer::switches::kRemoveChromeRegistration)) { | 1046 installer::switches::kRemoveChromeRegistration)) { |
1045 // This is almost reverse of --register-chrome-browser option above. | 1047 // This is almost reverse of --register-chrome-browser option above. |
1046 // Here we delete Chrome browser registration. This option should only | 1048 // Here we delete Chrome browser registration. This option should only |
1047 // be used when setup.exe is launched with admin rights. We do not | 1049 // be used when setup.exe is launched with admin rights. We do not |
1048 // make any user specific changes in this option. | 1050 // make any user specific changes in this option. |
1049 std::wstring suffix; | 1051 string16 suffix; |
1050 if (cmd_line.HasSwitch( | 1052 if (cmd_line.HasSwitch( |
1051 installer::switches::kRegisterChromeBrowserSuffix)) { | 1053 installer::switches::kRegisterChromeBrowserSuffix)) { |
1052 suffix = cmd_line.GetSwitchValueNative( | 1054 suffix = cmd_line.GetSwitchValueNative( |
1053 installer::switches::kRegisterChromeBrowserSuffix); | 1055 installer::switches::kRegisterChromeBrowserSuffix); |
1054 } | 1056 } |
1055 installer::InstallStatus tmp = installer::UNKNOWN_STATUS; | 1057 installer::InstallStatus tmp = installer::UNKNOWN_STATUS; |
1056 const Product* chrome_install = | 1058 const Product* chrome_install = |
1057 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); | 1059 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); |
1058 DCHECK(chrome_install); | 1060 DCHECK(chrome_install); |
1059 if (chrome_install) { | 1061 if (chrome_install) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1174 return true; | 1176 return true; |
1175 } | 1177 } |
1176 | 1178 |
1177 private: | 1179 private: |
1178 bool initialized_; | 1180 bool initialized_; |
1179 }; | 1181 }; |
1180 | 1182 |
1181 // Returns the Custom information for the client identified by the exe path | 1183 // Returns the Custom information for the client identified by the exe path |
1182 // passed in. This information is used for crash reporting. | 1184 // passed in. This information is used for crash reporting. |
1183 google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* exe_path) { | 1185 google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* exe_path) { |
1184 std::wstring product; | 1186 string16 product; |
1185 std::wstring version; | 1187 string16 version; |
1186 scoped_ptr<FileVersionInfo> | 1188 scoped_ptr<FileVersionInfo> |
1187 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); | 1189 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); |
1188 if (version_info.get()) { | 1190 if (version_info.get()) { |
1189 version = version_info->product_version(); | 1191 version = version_info->product_version(); |
1190 product = version_info->product_short_name(); | 1192 product = version_info->product_short_name(); |
1191 } | 1193 } |
1192 | 1194 |
1193 if (version.empty()) | 1195 if (version.empty()) |
1194 version = L"0.1.0.0"; | 1196 version = L"0.1.0.0"; |
1195 | 1197 |
(...skipping 24 matching lines...) Expand all Loading... | |
1220 FilePath temp_directory; | 1222 FilePath temp_directory; |
1221 if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) | 1223 if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) |
1222 return NULL; | 1224 return NULL; |
1223 | 1225 |
1224 wchar_t exe_path[MAX_PATH * 2] = {0}; | 1226 wchar_t exe_path[MAX_PATH * 2] = {0}; |
1225 GetModuleFileName(NULL, exe_path, arraysize(exe_path)); | 1227 GetModuleFileName(NULL, exe_path, arraysize(exe_path)); |
1226 | 1228 |
1227 // Build the pipe name. It can be either: | 1229 // Build the pipe name. It can be either: |
1228 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18" | 1230 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18" |
1229 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>" | 1231 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>" |
1230 std::wstring user_sid = kSystemPrincipalSid; | 1232 string16 user_sid = kSystemPrincipalSid; |
1231 | 1233 |
1232 if (!system_install) { | 1234 if (!system_install) { |
1233 if (!base::win::GetUserSidString(&user_sid)) { | 1235 if (!base::win::GetUserSidString(&user_sid)) { |
1234 return NULL; | 1236 return NULL; |
1235 } | 1237 } |
1236 } | 1238 } |
1237 | 1239 |
1238 std::wstring pipe_name = kGoogleUpdatePipeName; | 1240 string16 pipe_name = kGoogleUpdatePipeName; |
1239 pipe_name += user_sid; | 1241 pipe_name += user_sid; |
1240 | 1242 |
1241 google_breakpad::ExceptionHandler* breakpad = | 1243 google_breakpad::ExceptionHandler* breakpad = |
1242 new google_breakpad::ExceptionHandler( | 1244 new google_breakpad::ExceptionHandler( |
1243 temp_directory.value(), NULL, NULL, NULL, | 1245 temp_directory.value(), NULL, NULL, NULL, |
1244 google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType, | 1246 google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType, |
1245 pipe_name.c_str(), GetCustomInfo(exe_path)); | 1247 pipe_name.c_str(), GetCustomInfo(exe_path)); |
1246 return breakpad; | 1248 return breakpad; |
1247 } | 1249 } |
1248 | 1250 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1384 if (!(installer_state.is_msi() && is_uninstall)) | 1386 if (!(installer_state.is_msi() && is_uninstall)) |
1385 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1387 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1386 // to pass through, since this is only returned on uninstall which is | 1388 // to pass through, since this is only returned on uninstall which is |
1387 // never invoked directly by Google Update. | 1389 // never invoked directly by Google Update. |
1388 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1390 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1389 | 1391 |
1390 VLOG(1) << "Installation complete, returning: " << return_code; | 1392 VLOG(1) << "Installation complete, returning: " << return_code; |
1391 | 1393 |
1392 return return_code; | 1394 return return_code; |
1393 } | 1395 } |
OLD | NEW |