| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // For each product that is being updated (i.e., already installed at an earlier | 284 // For each product that is being updated (i.e., already installed at an earlier |
| 285 // version), see if that product has an update policy override that differs from | 285 // version), see if that product has an update policy override that differs from |
| 286 // that for the binaries. If any are found, fail with an error indicating that | 286 // that for the binaries. If any are found, fail with an error indicating that |
| 287 // the Group Policy settings are in an inconsistent state. Do not do this test | 287 // the Group Policy settings are in an inconsistent state. Do not do this test |
| 288 // for same-version installs, since it would be unkind to block attempts to | 288 // for same-version installs, since it would be unkind to block attempts to |
| 289 // repair a corrupt installation. This function returns false when installation | 289 // repair a corrupt installation. This function returns false when installation |
| 290 // should be halted, in which case |status| contains the relevant exit code and | 290 // should be halted, in which case |status| contains the relevant exit code and |
| 291 // the proper installer result has been written to the registry. | 291 // the proper installer result has been written to the registry. |
| 292 bool CheckGroupPolicySettings(const InstallationState& original_state, | 292 bool CheckGroupPolicySettings(const InstallationState& original_state, |
| 293 const InstallerState& installer_state, | 293 const InstallerState& installer_state, |
| 294 const base::Version& new_version, | 294 const Version& new_version, |
| 295 installer::InstallStatus* status) { | 295 installer::InstallStatus* status) { |
| 296 #if !defined(GOOGLE_CHROME_BUILD) | 296 #if !defined(GOOGLE_CHROME_BUILD) |
| 297 // Chromium builds are not updated via Google Update, so there are no | 297 // Chromium builds are not updated via Google Update, so there are no |
| 298 // Group Policy settings to consult. | 298 // Group Policy settings to consult. |
| 299 return true; | 299 return true; |
| 300 #else | 300 #else |
| 301 DCHECK(status); | 301 DCHECK(status); |
| 302 | 302 |
| 303 // Single installs are always in good shape. | 303 // Single installs are always in good shape. |
| 304 if (!installer_state.is_multi_install()) | 304 if (!installer_state.is_multi_install()) |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 shortcut_properties.set_dual_mode(true); | 944 shortcut_properties.set_dual_mode(true); |
| 945 shortcut_properties.set_pin_to_taskbar(true); | 945 shortcut_properties.set_pin_to_taskbar(true); |
| 946 ShellUtil::CreateOrUpdateShortcut( | 946 ShellUtil::CreateOrUpdateShortcut( |
| 947 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, chrome_dist, | 947 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, chrome_dist, |
| 948 shortcut_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS); | 948 shortcut_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS); |
| 949 | 949 |
| 950 // Register Chrome at user-level and make it default. | 950 // Register Chrome at user-level and make it default. |
| 951 scoped_ptr<WorkItemList> delegate_execute_list( | 951 scoped_ptr<WorkItemList> delegate_execute_list( |
| 952 WorkItem::CreateWorkItemList()); | 952 WorkItem::CreateWorkItemList()); |
| 953 installer::AddDelegateExecuteWorkItems( | 953 installer::AddDelegateExecuteWorkItems( |
| 954 installer_state, chrome_exe.DirName(), base::Version(), chrome, | 954 installer_state, chrome_exe.DirName(), Version(), chrome, |
| 955 delegate_execute_list.get()); | 955 delegate_execute_list.get()); |
| 956 delegate_execute_list->Do(); | 956 delegate_execute_list->Do(); |
| 957 if (ShellUtil::CanMakeChromeDefaultUnattended()) { | 957 if (ShellUtil::CanMakeChromeDefaultUnattended()) { |
| 958 ShellUtil::MakeChromeDefault( | 958 ShellUtil::MakeChromeDefault( |
| 959 chrome_dist, ShellUtil::CURRENT_USER, chrome_exe.value(), true); | 959 chrome_dist, ShellUtil::CURRENT_USER, chrome_exe.value(), true); |
| 960 } else { | 960 } else { |
| 961 ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe.value()); | 961 ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe.value()); |
| 962 } | 962 } |
| 963 } else { | 963 } else { |
| 964 LOG(ERROR) << "Path not found: " << chrome_exe.value(); | 964 LOG(ERROR) << "Path not found: " << chrome_exe.value(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 } | 1167 } |
| 1168 } | 1168 } |
| 1169 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1169 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
| 1170 const Products& products = installer_state->products(); | 1170 const Products& products = installer_state->products(); |
| 1171 for (Products::const_iterator it = products.begin(); it < products.end(); | 1171 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 1172 ++it) { | 1172 ++it) { |
| 1173 const Product& product = **it; | 1173 const Product& product = **it; |
| 1174 BrowserDistribution* browser_dist = product.distribution(); | 1174 BrowserDistribution* browser_dist = product.distribution(); |
| 1175 // We started as system-level and have been re-launched as user level | 1175 // We started as system-level and have been re-launched as user level |
| 1176 // to continue with the toast experiment. | 1176 // to continue with the toast experiment. |
| 1177 base::Version installed_version; | 1177 Version installed_version; |
| 1178 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); | 1178 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); |
| 1179 if (!installed_version.IsValid()) { | 1179 if (!installed_version.IsValid()) { |
| 1180 LOG(ERROR) << "No installation of " | 1180 LOG(ERROR) << "No installation of " |
| 1181 << browser_dist->GetDisplayName() | 1181 << browser_dist->GetDisplayName() |
| 1182 << " found for system-level toast."; | 1182 << " found for system-level toast."; |
| 1183 } else { | 1183 } else { |
| 1184 product.LaunchUserExperiment( | 1184 product.LaunchUserExperiment( |
| 1185 cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE, true); | 1185 cmd_line.GetProgram(), installer::REENTRY_SYS_UPDATE, true); |
| 1186 } | 1186 } |
| 1187 } | 1187 } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 installer_state.WriteInstallerResult( | 1456 installer_state.WriteInstallerResult( |
| 1457 UNCOMPRESSION_FAILED, | 1457 UNCOMPRESSION_FAILED, |
| 1458 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, | 1458 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, |
| 1459 NULL); | 1459 NULL); |
| 1460 return UNCOMPRESSION_FAILED; | 1460 return UNCOMPRESSION_FAILED; |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 VLOG(1) << "unpacked to " << unpack_path.value(); | 1463 VLOG(1) << "unpacked to " << unpack_path.value(); |
| 1464 base::FilePath src_path( | 1464 base::FilePath src_path( |
| 1465 unpack_path.Append(kInstallSourceChromeDir)); | 1465 unpack_path.Append(kInstallSourceChromeDir)); |
| 1466 scoped_ptr<base::Version> | 1466 scoped_ptr<Version> |
| 1467 installer_version(GetMaxVersionFromArchiveDir(src_path)); | 1467 installer_version(GetMaxVersionFromArchiveDir(src_path)); |
| 1468 if (!installer_version.get()) { | 1468 if (!installer_version.get()) { |
| 1469 LOG(ERROR) << "Did not find any valid version in installer."; | 1469 LOG(ERROR) << "Did not find any valid version in installer."; |
| 1470 install_status = INVALID_ARCHIVE; | 1470 install_status = INVALID_ARCHIVE; |
| 1471 installer_state.WriteInstallerResult(install_status, | 1471 installer_state.WriteInstallerResult(install_status, |
| 1472 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); | 1472 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); |
| 1473 } else { | 1473 } else { |
| 1474 VLOG(1) << "version to install: " << installer_version->GetString(); | 1474 VLOG(1) << "version to install: " << installer_version->GetString(); |
| 1475 bool proceed_with_installation = true; | 1475 bool proceed_with_installation = true; |
| 1476 | 1476 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1805 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1806 // to pass through, since this is only returned on uninstall which is | 1806 // to pass through, since this is only returned on uninstall which is |
| 1807 // never invoked directly by Google Update. | 1807 // never invoked directly by Google Update. |
| 1808 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1808 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1809 } | 1809 } |
| 1810 | 1810 |
| 1811 VLOG(1) << "Installation complete, returning: " << return_code; | 1811 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1812 | 1812 |
| 1813 return return_code; | 1813 return return_code; |
| 1814 } | 1814 } |
| OLD | NEW |