| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Consider the operation a success if either of these succeeds. | 148 // Consider the operation a success if either of these succeeds. |
| 149 LONG result2 = OverwriteDisplayVersion(reg_path, value, KEY_WOW64_64KEY); | 149 LONG result2 = OverwriteDisplayVersion(reg_path, value, KEY_WOW64_64KEY); |
| 150 LONG result3 = OverwriteDisplayVersion(reg_path, value, KEY_WOW64_32KEY); | 150 LONG result3 = OverwriteDisplayVersion(reg_path, value, KEY_WOW64_32KEY); |
| 151 | 151 |
| 152 return result1 != ERROR_SUCCESS ? result1 : | 152 return result1 != ERROR_SUCCESS ? result1 : |
| 153 (result2 != ERROR_SUCCESS ? result3 : ERROR_SUCCESS); | 153 (result2 != ERROR_SUCCESS ? result3 : ERROR_SUCCESS); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void DelayedOverwriteDisplayVersions(const base::FilePath& setup_exe, | 156 void DelayedOverwriteDisplayVersions(const base::FilePath& setup_exe, |
| 157 const std::string& id, | 157 const std::string& id, |
| 158 const Version& version) { | 158 const base::Version& version) { |
| 159 // This process has to be able to exit so we launch ourselves with | 159 // This process has to be able to exit so we launch ourselves with |
| 160 // instructions on what to do and then return. | 160 // instructions on what to do and then return. |
| 161 base::CommandLine command_line(setup_exe); | 161 base::CommandLine command_line(setup_exe); |
| 162 command_line.AppendSwitchASCII(installer::switches::kSetDisplayVersionProduct, | 162 command_line.AppendSwitchASCII(installer::switches::kSetDisplayVersionProduct, |
| 163 id); | 163 id); |
| 164 command_line.AppendSwitchASCII(installer::switches::kSetDisplayVersionValue, | 164 command_line.AppendSwitchASCII(installer::switches::kSetDisplayVersionValue, |
| 165 version.GetString()); | 165 version.GetString()); |
| 166 command_line.AppendSwitchNative(installer::switches::kDelay, | 166 command_line.AppendSwitchNative(installer::switches::kDelay, |
| 167 kMsiDisplayVersionOverwriteDelay); | 167 kMsiDisplayVersionOverwriteDelay); |
| 168 | 168 |
| (...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 } | 1306 } |
| 1307 } | 1307 } |
| 1308 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1308 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
| 1309 const Products& products = installer_state->products(); | 1309 const Products& products = installer_state->products(); |
| 1310 for (Products::const_iterator it = products.begin(); it < products.end(); | 1310 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 1311 ++it) { | 1311 ++it) { |
| 1312 const Product& product = **it; | 1312 const Product& product = **it; |
| 1313 BrowserDistribution* browser_dist = product.distribution(); | 1313 BrowserDistribution* browser_dist = product.distribution(); |
| 1314 // We started as system-level and have been re-launched as user level | 1314 // We started as system-level and have been re-launched as user level |
| 1315 // to continue with the toast experiment. | 1315 // to continue with the toast experiment. |
| 1316 Version installed_version; | 1316 base::Version installed_version; |
| 1317 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); | 1317 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); |
| 1318 if (!installed_version.IsValid()) { | 1318 if (!installed_version.IsValid()) { |
| 1319 LOG(ERROR) << "No installation of " | 1319 LOG(ERROR) << "No installation of " |
| 1320 << browser_dist->GetDisplayName() | 1320 << browser_dist->GetDisplayName() |
| 1321 << " found for system-level toast."; | 1321 << " found for system-level toast."; |
| 1322 } else { | 1322 } else { |
| 1323 product.LaunchUserExperiment( | 1323 product.LaunchUserExperiment( |
| 1324 setup_exe, installer::REENTRY_SYS_UPDATE, true); | 1324 setup_exe, installer::REENTRY_SYS_UPDATE, true); |
| 1325 } | 1325 } |
| 1326 } | 1326 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 UMA_HISTOGRAM_MEDIUM_TIMES( | 1517 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 1518 "Setup.Install.UnpackFullArchiveTime.background", elapsed_time); | 1518 "Setup.Install.UnpackFullArchiveTime.background", elapsed_time); |
| 1519 } else { | 1519 } else { |
| 1520 UMA_HISTOGRAM_MEDIUM_TIMES( | 1520 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 1521 "Setup.Install.UnpackFullArchiveTime", elapsed_time); | 1521 "Setup.Install.UnpackFullArchiveTime", elapsed_time); |
| 1522 } | 1522 } |
| 1523 | 1523 |
| 1524 VLOG(1) << "unpacked to " << unpack_path.value(); | 1524 VLOG(1) << "unpacked to " << unpack_path.value(); |
| 1525 base::FilePath src_path( | 1525 base::FilePath src_path( |
| 1526 unpack_path.Append(kInstallSourceChromeDir)); | 1526 unpack_path.Append(kInstallSourceChromeDir)); |
| 1527 std::unique_ptr<Version> installer_version( | 1527 std::unique_ptr<base::Version> installer_version( |
| 1528 GetMaxVersionFromArchiveDir(src_path)); | 1528 GetMaxVersionFromArchiveDir(src_path)); |
| 1529 if (!installer_version.get()) { | 1529 if (!installer_version.get()) { |
| 1530 LOG(ERROR) << "Did not find any valid version in installer."; | 1530 LOG(ERROR) << "Did not find any valid version in installer."; |
| 1531 install_status = INVALID_ARCHIVE; | 1531 install_status = INVALID_ARCHIVE; |
| 1532 installer_state.WriteInstallerResult(install_status, | 1532 installer_state.WriteInstallerResult(install_status, |
| 1533 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); | 1533 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); |
| 1534 } else { | 1534 } else { |
| 1535 VLOG(1) << "version to install: " << installer_version->GetString(); | 1535 VLOG(1) << "version to install: " << installer_version->GetString(); |
| 1536 bool proceed_with_installation = true; | 1536 bool proceed_with_installation = true; |
| 1537 | 1537 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 // never invoked directly by Google Update. | 1893 // never invoked directly by Google Update. |
| 1894 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1894 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1895 } | 1895 } |
| 1896 | 1896 |
| 1897 installer::EndPersistentHistogramStorage(installer_state.target_path(), | 1897 installer::EndPersistentHistogramStorage(installer_state.target_path(), |
| 1898 system_install); | 1898 system_install); |
| 1899 VLOG(1) << "Installation complete, returning: " << return_code; | 1899 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1900 | 1900 |
| 1901 return return_code; | 1901 return return_code; |
| 1902 } | 1902 } |
| OLD | NEW |