Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Side by Side Diff: chrome/installer/setup/setup_main.cc

Issue 10451074: Always suffix ChromeHTML entries on Windows for user-level installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on r142211 Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/shell_integration_win.cc ('k') | chrome/installer/setup/uninstall.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 ? &quoted_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 DCHECK_NE(chrome_exe, string16());
729 installer::RemoveChromeLegacyRegistryKeys(chrome->distribution(),
730 chrome_exe);
731 }
729 } 732 }
730 } 733 }
731 } 734 }
732 735
733 // There might be an experiment (for upgrade usually) that needs to happen. 736 // 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 737 // 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 738 // the case we would not do that directly at this point but in another
736 // instance of setup.exe 739 // instance of setup.exe
737 // 740 //
738 // There is another way to reach this same function if this is a system 741 // 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
894 cmd_line, remove_all, force, *products[i]); 897 cmd_line, remove_all, force, *products[i]);
895 if (prod_status != installer::UNINSTALL_SUCCESSFUL) 898 if (prod_status != installer::UNINSTALL_SUCCESSFUL)
896 install_status = prod_status; 899 install_status = prod_status;
897 } 900 }
898 901
899 UninstallGoogleUpdate(installer_state.system_install()); 902 UninstallGoogleUpdate(installer_state.system_install());
900 903
901 return install_status; 904 return install_status;
902 } 905 }
903 906
904 installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) { 907 installer::InstallStatus ShowEULADialog(const string16& inner_frame) {
905 VLOG(1) << "About to show EULA"; 908 VLOG(1) << "About to show EULA";
906 std::wstring eula_path = installer::GetLocalizedEulaResource(); 909 string16 eula_path = installer::GetLocalizedEulaResource();
907 if (eula_path.empty()) { 910 if (eula_path.empty()) {
908 LOG(ERROR) << "No EULA path available"; 911 LOG(ERROR) << "No EULA path available";
909 return installer::EULA_REJECTED; 912 return installer::EULA_REJECTED;
910 } 913 }
911 // Newer versions of the caller pass an inner frame parameter that must 914 // Newer versions of the caller pass an inner frame parameter that must
912 // be given to the html page being launched. 915 // be given to the html page being launched.
913 installer::EulaHTMLDialog dlg(eula_path, inner_frame); 916 installer::EulaHTMLDialog dlg(eula_path, inner_frame);
914 installer::EulaHTMLDialog::Outcome outcome = dlg.ShowModal(); 917 installer::EulaHTMLDialog::Outcome outcome = dlg.ShowModal();
915 if (installer::EulaHTMLDialog::REJECTED == outcome) { 918 if (installer::EulaHTMLDialog::REJECTED == outcome) {
916 LOG(ERROR) << "EULA rejected or EULA failure"; 919 LOG(ERROR) << "EULA rejected or EULA failure";
(...skipping 21 matching lines...) Expand all
938 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { 941 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) {
939 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; 942 installer::InstallStatus status = installer::SETUP_PATCH_FAILED;
940 // If --update-setup-exe command line option is given, we apply the given 943 // 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 944 // 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 945 // specified by --new-setup-exe. But we need to first unpack the file
943 // given in --update-setup-exe. 946 // given in --update-setup-exe.
944 ScopedTempDir temp_path; 947 ScopedTempDir temp_path;
945 if (!temp_path.CreateUniqueTempDir()) { 948 if (!temp_path.CreateUniqueTempDir()) {
946 PLOG(ERROR) << "Could not create temporary path."; 949 PLOG(ERROR) << "Could not create temporary path.";
947 } else { 950 } else {
948 std::wstring setup_patch = cmd_line.GetSwitchValueNative( 951 string16 setup_patch = cmd_line.GetSwitchValueNative(
949 installer::switches::kUpdateSetupExe); 952 installer::switches::kUpdateSetupExe);
950 VLOG(1) << "Opening archive " << setup_patch; 953 VLOG(1) << "Opening archive " << setup_patch;
951 std::wstring uncompressed_patch; 954 string16 uncompressed_patch;
952 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.path().value(), 955 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.path().value(),
953 &uncompressed_patch) == NO_ERROR) { 956 &uncompressed_patch) == NO_ERROR) {
954 FilePath old_setup_exe = cmd_line.GetProgram(); 957 FilePath old_setup_exe = cmd_line.GetProgram();
955 FilePath new_setup_exe = cmd_line.GetSwitchValuePath( 958 FilePath new_setup_exe = cmd_line.GetSwitchValuePath(
956 installer::switches::kNewSetupExe); 959 installer::switches::kNewSetupExe);
957 if (!installer::ApplyDiffPatch(old_setup_exe, 960 if (!installer::ApplyDiffPatch(old_setup_exe,
958 FilePath(uncompressed_patch), 961 FilePath(uncompressed_patch),
959 new_setup_exe, 962 new_setup_exe,
960 installer_state)) 963 installer_state))
961 status = installer::NEW_VERSION_UPDATED; 964 status = installer::NEW_VERSION_UPDATED;
(...skipping 11 matching lines...) Expand all
973 if (*exit_code) { 976 if (*exit_code) {
974 LOG(WARNING) << "setup.exe patching failed."; 977 LOG(WARNING) << "setup.exe patching failed.";
975 installer_state->WriteInstallerResult(status, IDS_SETUP_PATCH_FAILED_BASE, 978 installer_state->WriteInstallerResult(status, IDS_SETUP_PATCH_FAILED_BASE,
976 NULL); 979 NULL);
977 } 980 }
978 // We will be exiting normally, so clear the stage indicator. 981 // We will be exiting normally, so clear the stage indicator.
979 installer_state->UpdateStage(installer::NO_STAGE); 982 installer_state->UpdateStage(installer::NO_STAGE);
980 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { 983 } 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 984 // 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. 985 // then the dialog is shown and regardless of the outcome setup exits here.
983 std::wstring inner_frame = 986 string16 inner_frame =
984 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); 987 cmd_line.GetSwitchValueNative(installer::switches::kShowEula);
985 *exit_code = ShowEULADialog(inner_frame); 988 *exit_code = ShowEULADialog(inner_frame);
986 if (installer::EULA_REJECTED != *exit_code) { 989 if (installer::EULA_REJECTED != *exit_code) {
987 GoogleUpdateSettings::SetEULAConsent( 990 GoogleUpdateSettings::SetEULAConsent(
988 original_state, BrowserDistribution::GetDistribution(), true); 991 original_state, BrowserDistribution::GetDistribution(), true);
989 } 992 }
990 } else if (cmd_line.HasSwitch( 993 } else if (cmd_line.HasSwitch(
991 installer::switches::kRegisterChromeBrowser)) { 994 installer::switches::kRegisterChromeBrowser)) {
992 installer::InstallStatus status = installer::UNKNOWN_STATUS; 995 installer::InstallStatus status = installer::UNKNOWN_STATUS;
993 const Product* chrome_install = 996 const Product* chrome_install =
994 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); 997 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER);
995 if (chrome_install) { 998 if (chrome_install) {
996 // If --register-chrome-browser option is specified, register all 999 // If --register-chrome-browser option is specified, register all
997 // Chrome protocol/file associations, as well as register it as a valid 1000 // Chrome protocol/file associations, as well as register it as a valid
998 // browser for Start Menu->Internet shortcut. This switch will also 1001 // browser for Start Menu->Internet shortcut. This switch will also
999 // register Chrome as a valid handler for a set of URL protocols that 1002 // 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 1003 // Chrome may become the default handler for, either by the user marking
1001 // Chrome as the default browser, through the Windows Default Programs 1004 // Chrome as the default browser, through the Windows Default Programs
1002 // control panel settings, or through website use of 1005 // control panel settings, or through website use of
1003 // registerProtocolHandler. These protocols are found in 1006 // registerProtocolHandler. These protocols are found in
1004 // ShellUtil::kPotentialProtocolAssociations. 1007 // ShellUtil::kPotentialProtocolAssociations.
1005 // The --register-url-protocol will additionally register Chrome as a 1008 // The --register-url-protocol will additionally register Chrome as a
1006 // potential handler for the supplied protocol, and is used if a website 1009 // potential handler for the supplied protocol, and is used if a website
1007 // registers a handler for a protocol not found in 1010 // registers a handler for a protocol not found in
1008 // ShellUtil::kPotentialProtocolAssociations. 1011 // ShellUtil::kPotentialProtocolAssociations.
1009 // These options should only be used when setup.exe is launched with admin 1012 // 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. 1013 // rights. We do not make any user specific changes with this option.
1011 DCHECK(IsUserAnAdmin()); 1014 DCHECK(IsUserAnAdmin());
1012 std::wstring chrome_exe(cmd_line.GetSwitchValueNative( 1015 string16 chrome_exe(cmd_line.GetSwitchValueNative(
1013 installer::switches::kRegisterChromeBrowser)); 1016 installer::switches::kRegisterChromeBrowser));
1014 std::wstring suffix; 1017 string16 suffix;
1015 if (cmd_line.HasSwitch( 1018 if (cmd_line.HasSwitch(
1016 installer::switches::kRegisterChromeBrowserSuffix)) { 1019 installer::switches::kRegisterChromeBrowserSuffix)) {
1017 suffix = cmd_line.GetSwitchValueNative( 1020 suffix = cmd_line.GetSwitchValueNative(
1018 installer::switches::kRegisterChromeBrowserSuffix); 1021 installer::switches::kRegisterChromeBrowserSuffix);
1019 } 1022 }
1020 if (cmd_line.HasSwitch( 1023 if (cmd_line.HasSwitch(
1021 installer::switches::kRegisterURLProtocol)) { 1024 installer::switches::kRegisterURLProtocol)) {
1022 std::wstring protocol = cmd_line.GetSwitchValueNative( 1025 string16 protocol = cmd_line.GetSwitchValueNative(
1023 installer::switches::kRegisterURLProtocol); 1026 installer::switches::kRegisterURLProtocol);
1024 // ShellUtil::RegisterChromeForProtocol performs all registration 1027 // ShellUtil::RegisterChromeForProtocol performs all registration
1025 // done by ShellUtil::RegisterChromeBrowser, as well as registering 1028 // done by ShellUtil::RegisterChromeBrowser, as well as registering
1026 // with Windows as capable of handling the supplied protocol. 1029 // with Windows as capable of handling the supplied protocol.
1027 if (ShellUtil::RegisterChromeForProtocol(chrome_install->distribution(), 1030 if (ShellUtil::RegisterChromeForProtocol(chrome_install->distribution(),
1028 chrome_exe, suffix, protocol, false)) 1031 chrome_exe, suffix, protocol, false))
1029 status = installer::IN_USE_UPDATED; 1032 status = installer::IN_USE_UPDATED;
1030 } else { 1033 } else {
1031 if (ShellUtil::RegisterChromeBrowser(chrome_install->distribution(), 1034 if (ShellUtil::RegisterChromeBrowser(chrome_install->distribution(),
1032 chrome_exe, suffix, false)) 1035 chrome_exe, suffix, false))
1033 status = installer::IN_USE_UPDATED; 1036 status = installer::IN_USE_UPDATED;
1034 } 1037 }
1035 } else { 1038 } else {
1036 LOG(DFATAL) << "Can't register browser - Chrome distribution not found"; 1039 LOG(DFATAL) << "Can't register browser - Chrome distribution not found";
1037 } 1040 }
1038 *exit_code = InstallUtil::GetInstallReturnCode(status); 1041 *exit_code = InstallUtil::GetInstallReturnCode(status);
1039 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { 1042 } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) {
1040 // If --rename-chrome-exe is specified, we want to rename the executables 1043 // If --rename-chrome-exe is specified, we want to rename the executables
1041 // and exit. 1044 // and exit.
1042 *exit_code = RenameChromeExecutables(original_state, installer_state); 1045 *exit_code = RenameChromeExecutables(original_state, installer_state);
1043 } else if (cmd_line.HasSwitch( 1046 } else if (cmd_line.HasSwitch(
1044 installer::switches::kRemoveChromeRegistration)) { 1047 installer::switches::kRemoveChromeRegistration)) {
1045 // This is almost reverse of --register-chrome-browser option above. 1048 // This is almost reverse of --register-chrome-browser option above.
1046 // Here we delete Chrome browser registration. This option should only 1049 // Here we delete Chrome browser registration. This option should only
1047 // be used when setup.exe is launched with admin rights. We do not 1050 // be used when setup.exe is launched with admin rights. We do not
1048 // make any user specific changes in this option. 1051 // make any user specific changes in this option.
1049 std::wstring suffix; 1052 string16 suffix;
1050 if (cmd_line.HasSwitch( 1053 if (cmd_line.HasSwitch(
1051 installer::switches::kRegisterChromeBrowserSuffix)) { 1054 installer::switches::kRegisterChromeBrowserSuffix)) {
1052 suffix = cmd_line.GetSwitchValueNative( 1055 suffix = cmd_line.GetSwitchValueNative(
1053 installer::switches::kRegisterChromeBrowserSuffix); 1056 installer::switches::kRegisterChromeBrowserSuffix);
1054 } 1057 }
1055 installer::InstallStatus tmp = installer::UNKNOWN_STATUS; 1058 installer::InstallStatus tmp = installer::UNKNOWN_STATUS;
1056 const Product* chrome_install = 1059 const Product* chrome_install =
1057 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); 1060 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER);
1058 DCHECK(chrome_install); 1061 DCHECK(chrome_install);
1059 if (chrome_install) { 1062 if (chrome_install) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 return true; 1177 return true;
1175 } 1178 }
1176 1179
1177 private: 1180 private:
1178 bool initialized_; 1181 bool initialized_;
1179 }; 1182 };
1180 1183
1181 // Returns the Custom information for the client identified by the exe path 1184 // Returns the Custom information for the client identified by the exe path
1182 // passed in. This information is used for crash reporting. 1185 // passed in. This information is used for crash reporting.
1183 google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* exe_path) { 1186 google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* exe_path) {
1184 std::wstring product; 1187 string16 product;
1185 std::wstring version; 1188 string16 version;
1186 scoped_ptr<FileVersionInfo> 1189 scoped_ptr<FileVersionInfo>
1187 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); 1190 version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path)));
1188 if (version_info.get()) { 1191 if (version_info.get()) {
1189 version = version_info->product_version(); 1192 version = version_info->product_version();
1190 product = version_info->product_short_name(); 1193 product = version_info->product_short_name();
1191 } 1194 }
1192 1195
1193 if (version.empty()) 1196 if (version.empty())
1194 version = L"0.1.0.0"; 1197 version = L"0.1.0.0";
1195 1198
(...skipping 24 matching lines...) Expand all
1220 FilePath temp_directory; 1223 FilePath temp_directory;
1221 if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) 1224 if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty())
1222 return NULL; 1225 return NULL;
1223 1226
1224 wchar_t exe_path[MAX_PATH * 2] = {0}; 1227 wchar_t exe_path[MAX_PATH * 2] = {0};
1225 GetModuleFileName(NULL, exe_path, arraysize(exe_path)); 1228 GetModuleFileName(NULL, exe_path, arraysize(exe_path));
1226 1229
1227 // Build the pipe name. It can be either: 1230 // Build the pipe name. It can be either:
1228 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18" 1231 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18"
1229 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>" 1232 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>"
1230 std::wstring user_sid = kSystemPrincipalSid; 1233 string16 user_sid = kSystemPrincipalSid;
1231 1234
1232 if (!system_install) { 1235 if (!system_install) {
1233 if (!base::win::GetUserSidString(&user_sid)) { 1236 if (!base::win::GetUserSidString(&user_sid)) {
1234 return NULL; 1237 return NULL;
1235 } 1238 }
1236 } 1239 }
1237 1240
1238 std::wstring pipe_name = kGoogleUpdatePipeName; 1241 string16 pipe_name = kGoogleUpdatePipeName;
1239 pipe_name += user_sid; 1242 pipe_name += user_sid;
1240 1243
1241 google_breakpad::ExceptionHandler* breakpad = 1244 google_breakpad::ExceptionHandler* breakpad =
1242 new google_breakpad::ExceptionHandler( 1245 new google_breakpad::ExceptionHandler(
1243 temp_directory.value(), NULL, NULL, NULL, 1246 temp_directory.value(), NULL, NULL, NULL,
1244 google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType, 1247 google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType,
1245 pipe_name.c_str(), GetCustomInfo(exe_path)); 1248 pipe_name.c_str(), GetCustomInfo(exe_path));
1246 return breakpad; 1249 return breakpad;
1247 } 1250 }
1248 1251
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 if (!(installer_state.is_msi() && is_uninstall)) 1387 if (!(installer_state.is_msi() && is_uninstall))
1385 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1388 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1386 // to pass through, since this is only returned on uninstall which is 1389 // to pass through, since this is only returned on uninstall which is
1387 // never invoked directly by Google Update. 1390 // never invoked directly by Google Update.
1388 return_code = InstallUtil::GetInstallReturnCode(install_status); 1391 return_code = InstallUtil::GetInstallReturnCode(install_status);
1389 1392
1390 VLOG(1) << "Installation complete, returning: " << return_code; 1393 VLOG(1) << "Installation complete, returning: " << return_code;
1391 1394
1392 return return_code; 1395 return return_code;
1393 } 1396 }
OLDNEW
« no previous file with comments | « chrome/browser/shell_integration_win.cc ('k') | chrome/installer/setup/uninstall.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698