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 "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 #include "chrome/installer/setup/install_worker.h" | 32 #include "chrome/installer/setup/install_worker.h" |
33 #include "chrome/installer/setup/setup_constants.h" | 33 #include "chrome/installer/setup/setup_constants.h" |
34 #include "chrome/installer/setup/setup_util.h" | 34 #include "chrome/installer/setup/setup_util.h" |
35 #include "chrome/installer/setup/uninstall.h" | 35 #include "chrome/installer/setup/uninstall.h" |
36 #include "chrome/installer/util/browser_distribution.h" | 36 #include "chrome/installer/util/browser_distribution.h" |
37 #include "chrome/installer/util/channel_info.h" | 37 #include "chrome/installer/util/channel_info.h" |
38 #include "chrome/installer/util/delete_after_reboot_helper.h" | 38 #include "chrome/installer/util/delete_after_reboot_helper.h" |
39 #include "chrome/installer/util/delete_tree_work_item.h" | 39 #include "chrome/installer/util/delete_tree_work_item.h" |
40 #include "chrome/installer/util/google_update_constants.h" | 40 #include "chrome/installer/util/google_update_constants.h" |
41 #include "chrome/installer/util/google_update_settings.h" | 41 #include "chrome/installer/util/google_update_settings.h" |
42 #include "chrome/installer/util/google_update_util.h" | |
42 #include "chrome/installer/util/helper.h" | 43 #include "chrome/installer/util/helper.h" |
43 #include "chrome/installer/util/html_dialog.h" | 44 #include "chrome/installer/util/html_dialog.h" |
44 #include "chrome/installer/util/install_util.h" | 45 #include "chrome/installer/util/install_util.h" |
45 #include "chrome/installer/util/installation_state.h" | 46 #include "chrome/installer/util/installation_state.h" |
46 #include "chrome/installer/util/installation_validator.h" | 47 #include "chrome/installer/util/installation_validator.h" |
47 #include "chrome/installer/util/installer_state.h" | 48 #include "chrome/installer/util/installer_state.h" |
48 #include "chrome/installer/util/l10n_string_util.h" | 49 #include "chrome/installer/util/l10n_string_util.h" |
49 #include "chrome/installer/util/logging_installer.h" | 50 #include "chrome/installer/util/logging_installer.h" |
50 #include "chrome/installer/util/lzma_util.h" | 51 #include "chrome/installer/util/lzma_util.h" |
51 #include "chrome/installer/util/master_preferences.h" | 52 #include "chrome/installer/util/master_preferences.h" |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
727 switch (higher_products) { | 728 switch (higher_products) { |
728 case kBrowserBit: | 729 case kBrowserBit: |
729 message_id = IDS_INSTALL_HIGHER_VERSION_BASE; | 730 message_id = IDS_INSTALL_HIGHER_VERSION_BASE; |
730 break; | 731 break; |
731 case kGCFBit: | 732 case kGCFBit: |
732 message_id = IDS_INSTALL_HIGHER_VERSION_CF_BASE; | 733 message_id = IDS_INSTALL_HIGHER_VERSION_CF_BASE; |
733 break; | 734 break; |
734 case kGCFBit | kBrowserBit: | 735 case kGCFBit | kBrowserBit: |
735 message_id = IDS_INSTALL_HIGHER_VERSION_CB_CF_BASE; | 736 message_id = IDS_INSTALL_HIGHER_VERSION_CB_CF_BASE; |
736 break; | 737 break; |
738 case kAppHostBit: | |
739 message_id = IDS_INSTALL_HIGHER_VERSION_APP_HOST_BASE; | |
740 break; | |
737 default: | 741 default: |
742 // TODO: Get a more appropriate message for other subsets. | |
grt (UTC plus 2)
2012/09/20 17:58:51
TODO(who?)
| |
738 message_id = IDS_INSTALL_HIGHER_VERSION_APP_HOST_BASE; | 743 message_id = IDS_INSTALL_HIGHER_VERSION_APP_HOST_BASE; |
erikwright (departed)
2012/09/20 18:00:01
I think that this message is actually generic (doe
huangs
2012/09/21 01:43:14
Reverting and no-op, per discussion.
| |
739 break; | 744 break; |
740 } | 745 } |
741 | 746 |
742 installer_state.WriteInstallerResult(install_status, message_id, NULL); | 747 installer_state.WriteInstallerResult(install_status, message_id, NULL); |
743 } | 748 } |
744 | 749 |
745 proceed_with_installation = | 750 proceed_with_installation = |
746 proceed_with_installation && | 751 proceed_with_installation && |
747 CheckGroupPolicySettings(original_state, installer_state, | 752 CheckGroupPolicySettings(original_state, installer_state, |
748 *installer_version, &install_status); | 753 *installer_version, &install_status); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
844 } | 849 } |
845 for (Products::const_iterator it = products.begin(); it < products.end(); | 850 for (Products::const_iterator it = products.begin(); it < products.end(); |
846 ++it) { | 851 ++it) { |
847 const Product& product = **it; | 852 const Product& product = **it; |
848 product.distribution()->LaunchUserExperiment(setup_path, | 853 product.distribution()->LaunchUserExperiment(setup_path, |
849 install_status, *installer_version, product, system_install); | 854 install_status, *installer_version, product, system_install); |
850 } | 855 } |
851 } | 856 } |
852 } | 857 } |
853 | 858 |
859 // Install Google Update, if it is not installed already. | |
grt (UTC plus 2)
2012/09/20 17:58:51
no comma
huangs
2012/09/21 01:43:14
Done.
| |
860 // This is for quick-enable App Host install via system-level Google Update. | |
erikwright (departed)
2012/09/20 18:00:01
via ... -> from a system-level Chrome Binaries ins
huangs
2012/09/21 01:43:14
Done.
| |
861 if (cmd_line.HasSwitch(installer::switches::kEnsureGoogleUpdateInstalled)) { | |
862 // Currently this feature is only needed by, and implemented for user-level. | |
erikwright (departed)
2012/09/20 18:00:01
Remove this comment and edit line 859 to say somet
huangs
2012/09/21 01:43:14
Done, merged with earlier comment, too.
| |
863 if (!system_install) { | |
864 if (!google_update::EnsureUserLevelGoogleUpdateInstalled()) { | |
grt (UTC plus 2)
2012/09/20 17:58:51
no braces
huangs
2012/09/21 01:43:14
Done.
| |
865 LOG(ERROR) << "Failed to install Google Update"; | |
866 } | |
867 } else { | |
868 LOG(ERROR) << "--" << installer::switches::kEnsureGoogleUpdateInstalled | |
grt (UTC plus 2)
2012/09/20 17:58:51
this belongs in CheckAppHostPreconditions, no?
huangs
2012/09/21 01:43:14
Talked to erikwright@: Moving the check for user-l
| |
869 << " is for user level only"; | |
870 } | |
871 } | |
872 | |
854 // Delete the master profile file if present. Note that we do not care about | 873 // Delete the master profile file if present. Note that we do not care about |
855 // rollback here and we schedule for deletion on reboot if the delete fails. | 874 // rollback here and we schedule for deletion on reboot if the delete fails. |
856 // As such, we do not use DeleteTreeWorkItem. | 875 // As such, we do not use DeleteTreeWorkItem. |
857 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { | 876 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { |
858 FilePath prefs_path(cmd_line.GetSwitchValuePath( | 877 FilePath prefs_path(cmd_line.GetSwitchValuePath( |
859 installer::switches::kInstallerData)); | 878 installer::switches::kInstallerData)); |
860 if (!file_util::Delete(prefs_path, true)) { | 879 if (!file_util::Delete(prefs_path, true)) { |
861 LOG(ERROR) << "Failed deleting master preferences file " | 880 LOG(ERROR) << "Failed deleting master preferences file " |
862 << prefs_path.value() | 881 << prefs_path.value() |
863 << ", scheduling for deletion after reboot."; | 882 << ", scheduling for deletion after reboot."; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1087 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { | 1106 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { |
1088 // Check if we need to show the EULA. If it is passed as a command line | 1107 // Check if we need to show the EULA. If it is passed as a command line |
1089 // then the dialog is shown and regardless of the outcome setup exits here. | 1108 // then the dialog is shown and regardless of the outcome setup exits here. |
1090 string16 inner_frame = | 1109 string16 inner_frame = |
1091 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); | 1110 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); |
1092 *exit_code = ShowEULADialog(inner_frame); | 1111 *exit_code = ShowEULADialog(inner_frame); |
1093 if (installer::EULA_REJECTED != *exit_code) { | 1112 if (installer::EULA_REJECTED != *exit_code) { |
1094 GoogleUpdateSettings::SetEULAConsent( | 1113 GoogleUpdateSettings::SetEULAConsent( |
1095 original_state, BrowserDistribution::GetDistribution(), true); | 1114 original_state, BrowserDistribution::GetDistribution(), true); |
1096 } | 1115 } |
1097 } else if (cmd_line.HasSwitch( | 1116 } else if (cmd_line.HasSwitch(installer::switches::kConfigureUserSettings)) { |
1098 installer::switches::kConfigureUserSettings)) { | |
1099 DCHECK(installer_state->system_install()); | 1117 DCHECK(installer_state->system_install()); |
1100 const Product* chrome_install = | 1118 const Product* chrome_install = |
1101 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); | 1119 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); |
1102 DCHECK(chrome_install); | 1120 DCHECK(chrome_install); |
1103 // TODO(gab): Implement the new shortcut functionality here. | 1121 // TODO(gab): Implement the new shortcut functionality here. |
1104 LOG(ERROR) << "--configure-user-settings is not implemented."; | 1122 LOG(ERROR) << "--configure-user-settings is not implemented."; |
1105 } else if (cmd_line.HasSwitch( | 1123 } else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) { |
1106 installer::switches::kRegisterChromeBrowser)) { | |
1107 installer::InstallStatus status = installer::UNKNOWN_STATUS; | 1124 installer::InstallStatus status = installer::UNKNOWN_STATUS; |
1108 const Product* chrome_install = | 1125 const Product* chrome_install = |
1109 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); | 1126 installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER); |
1110 if (chrome_install) { | 1127 if (chrome_install) { |
1111 // If --register-chrome-browser option is specified, register all | 1128 // If --register-chrome-browser option is specified, register all |
1112 // Chrome protocol/file associations, as well as register it as a valid | 1129 // Chrome protocol/file associations, as well as register it as a valid |
1113 // browser for Start Menu->Internet shortcut. This switch will also | 1130 // browser for Start Menu->Internet shortcut. This switch will also |
1114 // register Chrome as a valid handler for a set of URL protocols that | 1131 // register Chrome as a valid handler for a set of URL protocols that |
1115 // Chrome may become the default handler for, either by the user marking | 1132 // Chrome may become the default handler for, either by the user marking |
1116 // Chrome as the default browser, through the Windows Default Programs | 1133 // Chrome as the default browser, through the Windows Default Programs |
1117 // control panel settings, or through website use of | 1134 // control panel settings, or through website use of |
1118 // registerProtocolHandler. These protocols are found in | 1135 // registerProtocolHandler. These protocols are found in |
1119 // ShellUtil::kPotentialProtocolAssociations. | 1136 // ShellUtil::kPotentialProtocolAssociations. |
1120 // The --register-url-protocol will additionally register Chrome as a | 1137 // The --register-url-protocol will additionally register Chrome as a |
1121 // potential handler for the supplied protocol, and is used if a website | 1138 // potential handler for the supplied protocol, and is used if a website |
1122 // registers a handler for a protocol not found in | 1139 // registers a handler for a protocol not found in |
1123 // ShellUtil::kPotentialProtocolAssociations. | 1140 // ShellUtil::kPotentialProtocolAssociations. |
1124 // These options should only be used when setup.exe is launched with admin | 1141 // These options should only be used when setup.exe is launched with admin |
1125 // rights. We do not make any user specific changes with this option. | 1142 // rights. We do not make any user specific changes with this option. |
1126 DCHECK(IsUserAnAdmin()); | 1143 DCHECK(IsUserAnAdmin()); |
1127 string16 chrome_exe(cmd_line.GetSwitchValueNative( | 1144 string16 chrome_exe(cmd_line.GetSwitchValueNative( |
1128 installer::switches::kRegisterChromeBrowser)); | 1145 installer::switches::kRegisterChromeBrowser)); |
1129 string16 suffix; | 1146 string16 suffix; |
1130 if (cmd_line.HasSwitch( | 1147 if (cmd_line.HasSwitch( |
1131 installer::switches::kRegisterChromeBrowserSuffix)) { | 1148 installer::switches::kRegisterChromeBrowserSuffix)) { |
1132 suffix = cmd_line.GetSwitchValueNative( | 1149 suffix = cmd_line.GetSwitchValueNative( |
1133 installer::switches::kRegisterChromeBrowserSuffix); | 1150 installer::switches::kRegisterChromeBrowserSuffix); |
1134 } | 1151 } |
1135 if (cmd_line.HasSwitch( | 1152 if (cmd_line.HasSwitch(installer::switches::kRegisterURLProtocol)) { |
1136 installer::switches::kRegisterURLProtocol)) { | |
1137 string16 protocol = cmd_line.GetSwitchValueNative( | 1153 string16 protocol = cmd_line.GetSwitchValueNative( |
1138 installer::switches::kRegisterURLProtocol); | 1154 installer::switches::kRegisterURLProtocol); |
1139 // ShellUtil::RegisterChromeForProtocol performs all registration | 1155 // ShellUtil::RegisterChromeForProtocol performs all registration |
1140 // done by ShellUtil::RegisterChromeBrowser, as well as registering | 1156 // done by ShellUtil::RegisterChromeBrowser, as well as registering |
1141 // with Windows as capable of handling the supplied protocol. | 1157 // with Windows as capable of handling the supplied protocol. |
1142 if (ShellUtil::RegisterChromeForProtocol( | 1158 if (ShellUtil::RegisterChromeForProtocol( |
1143 chrome_install->distribution(), chrome_exe, suffix, protocol, | 1159 chrome_install->distribution(), chrome_exe, suffix, protocol, |
1144 false)) | 1160 false)) |
1145 status = installer::IN_USE_UPDATED; | 1161 status = installer::IN_USE_UPDATED; |
1146 } else { | 1162 } else { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1519 if (!(installer_state.is_msi() && is_uninstall)) | 1535 if (!(installer_state.is_msi() && is_uninstall)) |
1520 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1536 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1521 // to pass through, since this is only returned on uninstall which is | 1537 // to pass through, since this is only returned on uninstall which is |
1522 // never invoked directly by Google Update. | 1538 // never invoked directly by Google Update. |
1523 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1539 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1524 | 1540 |
1525 VLOG(1) << "Installation complete, returning: " << return_code; | 1541 VLOG(1) << "Installation complete, returning: " << return_code; |
1526 | 1542 |
1527 return return_code; | 1543 return return_code; |
1528 } | 1544 } |
OLD | NEW |