| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/file_version_info.h" | 16 #include "base/file_version_info.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/scoped_temp_dir.h" |
| 19 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
| 20 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 21 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 22 #include "base/values.h" | 23 #include "base/values.h" |
| 23 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
| 24 #include "base/win/scoped_handle.h" | 25 #include "base/win/scoped_handle.h" |
| 25 #include "base/win/win_util.h" | 26 #include "base/win/win_util.h" |
| 26 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
| 27 #include "breakpad/src/client/windows/handler/exception_handler.h" | 28 #include "breakpad/src/client/windows/handler/exception_handler.h" |
| 28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // it is a differential installer if chrome.7z is not found. | 108 // it is a differential installer if chrome.7z is not found. |
| 108 if (!file_util::PathExists(uncompressed_archive)) { | 109 if (!file_util::PathExists(uncompressed_archive)) { |
| 109 *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; | 110 *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; |
| 110 VLOG(1) << "Differential patch found. Applying to existing archive."; | 111 VLOG(1) << "Differential patch found. Applying to existing archive."; |
| 111 if (!archive_version.get()) { | 112 if (!archive_version.get()) { |
| 112 LOG(ERROR) << "Can not use differential update when Chrome is not " | 113 LOG(ERROR) << "Can not use differential update when Chrome is not " |
| 113 << "installed on the system."; | 114 << "installed on the system."; |
| 114 return installer::CHROME_NOT_INSTALLED; | 115 return installer::CHROME_NOT_INSTALLED; |
| 115 } | 116 } |
| 116 | 117 |
| 117 FilePath existing_archive(installer_state.target_path().Append( | 118 FilePath existing_archive(installer_state.target_path().AppendASCII( |
| 118 UTF8ToWide(archive_version->GetString()))); | 119 archive_version->GetString())); |
| 119 existing_archive = existing_archive.Append(installer::kInstallerDir); | 120 existing_archive = existing_archive.Append(installer::kInstallerDir); |
| 120 existing_archive = existing_archive.Append(installer::kChromeArchive); | 121 existing_archive = existing_archive.Append(installer::kChromeArchive); |
| 121 if (int i = installer::ApplyDiffPatch(FilePath(existing_archive), | 122 if (int i = installer::ApplyDiffPatch(FilePath(existing_archive), |
| 122 FilePath(unpacked_file), | 123 FilePath(unpacked_file), |
| 123 FilePath(uncompressed_archive))) { | 124 FilePath(uncompressed_archive))) { |
| 124 LOG(ERROR) << "Binary patching failed with error " << i; | 125 LOG(ERROR) << "Binary patching failed with error " << i; |
| 125 return i; | 126 return i; |
| 126 } | 127 } |
| 127 } else { | 128 } else { |
| 128 *archive_type = installer::FULL_ARCHIVE_TYPE; | 129 *archive_type = installer::FULL_ARCHIVE_TYPE; |
| 129 } | 130 } |
| 130 | 131 |
| 131 // Unpack the uncompressed archive. | 132 // Unpack the uncompressed archive. |
| 132 return LzmaUtil::UnPackArchive(uncompressed_archive.value(), | 133 return LzmaUtil::UnPackArchive(uncompressed_archive.value(), |
| 133 output_directory.value(), &unpacked_file); | 134 output_directory.value(), &unpacked_file); |
| 134 } | 135 } |
| 135 | 136 |
| 136 // This function is called when --rename-chrome-exe option is specified on | 137 // This function is called when --rename-chrome-exe option is specified on |
| 137 // setup.exe command line. This function assumes an in-use update has happened | 138 // setup.exe command line. This function assumes an in-use update has happened |
| 138 // for Chrome so there should be a file called new_chrome.exe on the file | 139 // for Chrome so there should be a file called new_chrome.exe on the file |
| 139 // system and a key called 'opv' in the registry. This function will move | 140 // system and a key called 'opv' in the registry. This function will move |
| 140 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. | 141 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. |
| 141 installer::InstallStatus RenameChromeExecutables( | 142 installer::InstallStatus RenameChromeExecutables( |
| 142 const InstallerState& installer_state) { | 143 const InstallerState& installer_state) { |
| 143 const FilePath &target_path = installer_state.target_path(); | 144 const FilePath &target_path = installer_state.target_path(); |
| 144 FilePath chrome_exe(target_path.Append(installer::kChromeExe)); | 145 FilePath chrome_exe(target_path.Append(installer::kChromeExe)); |
| 145 FilePath chrome_old_exe(target_path.Append(installer::kChromeOldExe)); | |
| 146 FilePath chrome_new_exe(target_path.Append(installer::kChromeNewExe)); | 146 FilePath chrome_new_exe(target_path.Append(installer::kChromeNewExe)); |
| 147 | 147 |
| 148 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); | 148 // TODO(grt): Create the temp dir in the target_path rather than %TMP% and |
| 149 install_list->AddDeleteTreeWorkItem(chrome_old_exe); | 149 // friends since it/they may be on another volume, which prevents us from |
| 150 FilePath temp_path; | 150 // moving an in-use chrome.exe out of the way. |
| 151 if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { | 151 ScopedTempDir temp_path; |
| 152 LOG(ERROR) << "Failed to create Temp directory " << temp_path.value(); | 152 if (!temp_path.CreateUniqueTempDir()) { |
| 153 PLOG(ERROR) << "Failed to create Temp directory"; |
| 153 return installer::RENAME_FAILED; | 154 return installer::RENAME_FAILED; |
| 154 } | 155 } |
| 155 | 156 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); |
| 156 install_list->AddCopyTreeWorkItem(chrome_new_exe.value(), | 157 install_list->AddCopyTreeWorkItem(chrome_new_exe.value(), |
| 157 chrome_exe.value(), | 158 chrome_exe.value(), |
| 158 temp_path.value(), | 159 temp_path.path().value(), |
| 159 WorkItem::IF_DIFFERENT, | 160 WorkItem::IF_DIFFERENT, |
| 160 std::wstring()); | 161 std::wstring()); |
| 161 install_list->AddDeleteTreeWorkItem(chrome_new_exe); | 162 install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); |
| 162 | 163 |
| 163 HKEY reg_root = installer_state.root_key(); | 164 HKEY reg_root = installer_state.root_key(); |
| 164 const Products& products = installer_state.products(); | 165 const Products& products = installer_state.products(); |
| 165 for (size_t i = 0; i < products.size(); ++i) { | 166 for (size_t i = 0; i < products.size(); ++i) { |
| 166 const Product* product = products[i]; | 167 const Product* product = products[i]; |
| 167 BrowserDistribution* browser_dist = product->distribution(); | 168 BrowserDistribution* browser_dist = product->distribution(); |
| 168 std::wstring version_key(browser_dist->GetVersionKey()); | 169 std::wstring version_key(browser_dist->GetVersionKey()); |
| 169 install_list->AddDeleteRegValueWorkItem(reg_root, | 170 install_list->AddDeleteRegValueWorkItem(reg_root, |
| 170 version_key, | 171 version_key, |
| 171 google_update::kRegOldVersionField); | 172 google_update::kRegOldVersionField); |
| 172 install_list->AddDeleteRegValueWorkItem(reg_root, | 173 install_list->AddDeleteRegValueWorkItem(reg_root, |
| 173 version_key, | 174 version_key, |
| 174 google_update::kRegRenameCmdField); | 175 google_update::kRegRenameCmdField); |
| 175 } | 176 } |
| 176 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; | 177 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; |
| 177 if (!install_list->Do()) { | 178 if (!install_list->Do()) { |
| 178 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; | 179 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; |
| 179 install_list->Rollback(); | 180 install_list->Rollback(); |
| 180 ret = installer::RENAME_FAILED; | 181 ret = installer::RENAME_FAILED; |
| 181 } | 182 } |
| 182 file_util::Delete(temp_path, true); | |
| 183 return ret; | 183 return ret; |
| 184 } | 184 } |
| 185 | 185 |
| 186 // The supported multi-install modes are: | 186 // The supported multi-install modes are: |
| 187 // --multi-install --chrome --chrome-frame --ready-mode | 187 // --multi-install --chrome --chrome-frame --ready-mode |
| 188 // - If a non-multi Chrome Frame installation is present, Chrome Frame is | 188 // - If a non-multi Chrome Frame installation is present, Chrome Frame is |
| 189 // removed from |installer_state|'s list of products (thereby preserving | 189 // removed from |installer_state|'s list of products (thereby preserving |
| 190 // the existing SxS install). | 190 // the existing SxS install). |
| 191 // - If a multi Chrome Frame installation is present, its options are | 191 // - If a multi Chrome Frame installation is present, its options are |
| 192 // preserved (i.e., the --ready-mode command-line option is ignored). | 192 // preserved (i.e., the --ready-mode command-line option is ignored). |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // If --install-archive is given, get the user specified value | 472 // If --install-archive is given, get the user specified value |
| 473 if (cmd_line.HasSwitch(installer::switches::kInstallArchive)) { | 473 if (cmd_line.HasSwitch(installer::switches::kInstallArchive)) { |
| 474 archive = cmd_line.GetSwitchValuePath( | 474 archive = cmd_line.GetSwitchValuePath( |
| 475 installer::switches::kInstallArchive); | 475 installer::switches::kInstallArchive); |
| 476 } | 476 } |
| 477 VLOG(1) << "Archive found to install Chrome " << archive.value(); | 477 VLOG(1) << "Archive found to install Chrome " << archive.value(); |
| 478 const Products& products = installer_state.products(); | 478 const Products& products = installer_state.products(); |
| 479 | 479 |
| 480 // Create a temp folder where we will unpack Chrome archive. If it fails, | 480 // Create a temp folder where we will unpack Chrome archive. If it fails, |
| 481 // then we are doomed, so return immediately and no cleanup is required. | 481 // then we are doomed, so return immediately and no cleanup is required. |
| 482 FilePath temp_path; | 482 ScopedTempDir temp_path; |
| 483 if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { | 483 if (!temp_path.CreateUniqueTempDir()) { |
| 484 LOG(ERROR) << "Could not create temporary path."; | 484 PLOG(ERROR) << "Could not create temporary path."; |
| 485 InstallUtil::WriteInstallerResult(system_install, | 485 InstallUtil::WriteInstallerResult(system_install, |
| 486 installer_state.state_key(), installer::TEMP_DIR_FAILED, | 486 installer_state.state_key(), installer::TEMP_DIR_FAILED, |
| 487 IDS_INSTALL_TEMP_DIR_FAILED_BASE, NULL); | 487 IDS_INSTALL_TEMP_DIR_FAILED_BASE, NULL); |
| 488 return installer::TEMP_DIR_FAILED; | 488 return installer::TEMP_DIR_FAILED; |
| 489 } | 489 } |
| 490 VLOG(1) << "created path " << temp_path.value(); | 490 VLOG(1) << "created path " << temp_path.path().value(); |
| 491 | 491 |
| 492 FilePath unpack_path(temp_path.Append(installer::kInstallSourceDir)); | 492 FilePath unpack_path(temp_path.path().Append(installer::kInstallSourceDir)); |
| 493 if (UnPackArchive(archive, installer_state, temp_path, unpack_path, | 493 if (UnPackArchive(archive, installer_state, temp_path.path(), unpack_path, |
| 494 archive_type)) { | 494 archive_type)) { |
| 495 install_status = installer::UNCOMPRESSION_FAILED; | 495 install_status = installer::UNCOMPRESSION_FAILED; |
| 496 InstallUtil::WriteInstallerResult(system_install, | 496 InstallUtil::WriteInstallerResult(system_install, |
| 497 installer_state.state_key(), install_status, | 497 installer_state.state_key(), install_status, |
| 498 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); | 498 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); |
| 499 } else { | 499 } else { |
| 500 VLOG(1) << "unpacked to " << unpack_path.value(); | 500 VLOG(1) << "unpacked to " << unpack_path.value(); |
| 501 FilePath src_path(unpack_path.Append(installer::kInstallSourceChromeDir)); | 501 FilePath src_path(unpack_path.Append(installer::kInstallSourceChromeDir)); |
| 502 scoped_ptr<Version> | 502 scoped_ptr<Version> |
| 503 installer_version(installer::GetMaxVersionFromArchiveDir(src_path)); | 503 installer_version(installer::GetMaxVersionFromArchiveDir(src_path)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 InstallUtil::WriteInstallerResult(system_install, | 536 InstallUtil::WriteInstallerResult(system_install, |
| 537 installer_state.state_key(), install_status, | 537 installer_state.state_key(), install_status, |
| 538 IDS_INSTALL_HIGHER_VERSION_CF_BASE, NULL); | 538 IDS_INSTALL_HIGHER_VERSION_CF_BASE, NULL); |
| 539 } | 539 } |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 | 542 |
| 543 if (!higher_version_installed) { | 543 if (!higher_version_installed) { |
| 544 // We want to keep uncompressed archive (chrome.7z) that we get after | 544 // We want to keep uncompressed archive (chrome.7z) that we get after |
| 545 // uncompressing and binary patching. Get the location for this file. | 545 // uncompressing and binary patching. Get the location for this file. |
| 546 FilePath archive_to_copy(temp_path.Append(installer::kChromeArchive)); | 546 FilePath archive_to_copy( |
| 547 temp_path.path().Append(installer::kChromeArchive)); |
| 547 FilePath prefs_source_path(cmd_line.GetSwitchValueNative( | 548 FilePath prefs_source_path(cmd_line.GetSwitchValueNative( |
| 548 installer::switches::kInstallerData)); | 549 installer::switches::kInstallerData)); |
| 549 install_status = installer::InstallOrUpdateProduct(original_state, | 550 install_status = installer::InstallOrUpdateProduct(original_state, |
| 550 installer_state, cmd_line.GetProgram(), archive_to_copy, temp_path, | 551 installer_state, cmd_line.GetProgram(), archive_to_copy, |
| 551 prefs_source_path, prefs, *installer_version); | 552 temp_path.path(), prefs_source_path, prefs, *installer_version); |
| 552 | 553 |
| 553 int install_msg_base = IDS_INSTALL_FAILED_BASE; | 554 int install_msg_base = IDS_INSTALL_FAILED_BASE; |
| 554 std::wstring chrome_exe; | 555 std::wstring chrome_exe; |
| 555 if (install_status == installer::SAME_VERSION_REPAIR_FAILED) { | 556 if (install_status == installer::SAME_VERSION_REPAIR_FAILED) { |
| 556 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { | 557 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { |
| 557 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_CF_BASE; | 558 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_CF_BASE; |
| 558 } else { | 559 } else { |
| 559 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; | 560 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; |
| 560 } | 561 } |
| 561 } else if (install_status != installer::INSTALL_FAILED) { | 562 } else if (install_status != installer::INSTALL_FAILED) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 const Product* product = products[i]; | 627 const Product* product = products[i]; |
| 627 product->distribution()->LaunchUserExperiment(install_status, | 628 product->distribution()->LaunchUserExperiment(install_status, |
| 628 *installer_version, *product, system_install); | 629 *installer_version, *product, system_install); |
| 629 } | 630 } |
| 630 } | 631 } |
| 631 | 632 |
| 632 // Delete temporary files. These include install temporary directory | 633 // Delete temporary files. These include install temporary directory |
| 633 // and master profile file if present. Note that we do not care about rollback | 634 // and master profile file if present. Note that we do not care about rollback |
| 634 // here and we schedule for deletion on reboot below if the deletes fail. As | 635 // here and we schedule for deletion on reboot below if the deletes fail. As |
| 635 // such, we do not use DeleteTreeWorkItem. | 636 // such, we do not use DeleteTreeWorkItem. |
| 636 VLOG(1) << "Deleting temporary directory " << temp_path.value(); | 637 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); |
| 637 bool cleanup_success = file_util::Delete(temp_path, true); | 638 bool cleanup_success = temp_path.Delete(); |
| 638 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { | 639 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { |
| 639 std::wstring prefs_path = cmd_line.GetSwitchValueNative( | 640 std::wstring prefs_path = cmd_line.GetSwitchValueNative( |
| 640 installer::switches::kInstallerData); | 641 installer::switches::kInstallerData); |
| 641 cleanup_success = file_util::Delete(prefs_path, true) && cleanup_success; | 642 cleanup_success = file_util::Delete(prefs_path, true) && cleanup_success; |
| 642 } | 643 } |
| 643 | 644 |
| 644 // The above cleanup has been observed to fail on several users machines. | 645 // The above cleanup has been observed to fail on several users machines. |
| 645 // Specifically, it appears that the temp folder may be locked when we try | 646 // Specifically, it appears that the temp folder may be locked when we try |
| 646 // to delete it. This is Rather Bad in the case where we have failed updates | 647 // to delete it. This is Rather Bad in the case where we have failed updates |
| 647 // as we end up filling users' disks with large-ish temp files. To mitigate | 648 // as we end up filling users' disks with large-ish temp files. To mitigate |
| 648 // this, if we fail to delete the temp folders, then schedule them for | 649 // this, if we fail to delete the temp folders, then schedule them for |
| 649 // deletion at next reboot. | 650 // deletion at next reboot. |
| 650 if (!cleanup_success) { | 651 if (!cleanup_success) { |
| 651 ScheduleDirectoryForDeletion(temp_path.value().c_str()); | 652 ScheduleDirectoryForDeletion(temp_path.path().value().c_str()); |
| 652 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { | 653 if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { |
| 653 std::wstring prefs_path = cmd_line.GetSwitchValueNative( | 654 std::wstring prefs_path = cmd_line.GetSwitchValueNative( |
| 654 installer::switches::kInstallerData); | 655 installer::switches::kInstallerData); |
| 655 ScheduleDirectoryForDeletion(prefs_path.c_str()); | 656 ScheduleDirectoryForDeletion(prefs_path.c_str()); |
| 656 } | 657 } |
| 657 } | 658 } |
| 658 | 659 |
| 659 return install_status; | 660 return install_status; |
| 660 } | 661 } |
| 661 | 662 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 int* exit_code) { | 752 int* exit_code) { |
| 752 bool handled = true; | 753 bool handled = true; |
| 753 // TODO(tommi): Split these checks up into functions and use a data driven | 754 // TODO(tommi): Split these checks up into functions and use a data driven |
| 754 // map of switch->function. | 755 // map of switch->function. |
| 755 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { | 756 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { |
| 756 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; | 757 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; |
| 757 // If --update-setup-exe command line option is given, we apply the given | 758 // If --update-setup-exe command line option is given, we apply the given |
| 758 // patch to current exe, and store the resulting binary in the path | 759 // patch to current exe, and store the resulting binary in the path |
| 759 // specified by --new-setup-exe. But we need to first unpack the file | 760 // specified by --new-setup-exe. But we need to first unpack the file |
| 760 // given in --update-setup-exe. | 761 // given in --update-setup-exe. |
| 761 FilePath temp_path; | 762 ScopedTempDir temp_path; |
| 762 if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { | 763 if (!temp_path.CreateUniqueTempDir()) { |
| 763 LOG(ERROR) << "Could not create temporary path."; | 764 PLOG(ERROR) << "Could not create temporary path."; |
| 764 } else { | 765 } else { |
| 765 std::wstring setup_patch = cmd_line.GetSwitchValueNative( | 766 std::wstring setup_patch = cmd_line.GetSwitchValueNative( |
| 766 installer::switches::kUpdateSetupExe); | 767 installer::switches::kUpdateSetupExe); |
| 767 VLOG(1) << "Opening archive " << setup_patch; | 768 VLOG(1) << "Opening archive " << setup_patch; |
| 768 std::wstring uncompressed_patch; | 769 std::wstring uncompressed_patch; |
| 769 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.value(), | 770 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.path().value(), |
| 770 &uncompressed_patch) == NO_ERROR) { | 771 &uncompressed_patch) == NO_ERROR) { |
| 771 FilePath old_setup_exe = cmd_line.GetProgram(); | 772 FilePath old_setup_exe = cmd_line.GetProgram(); |
| 772 FilePath new_setup_exe = cmd_line.GetSwitchValuePath( | 773 FilePath new_setup_exe = cmd_line.GetSwitchValuePath( |
| 773 installer::switches::kNewSetupExe); | 774 installer::switches::kNewSetupExe); |
| 774 if (!installer::ApplyDiffPatch(old_setup_exe, | 775 if (!installer::ApplyDiffPatch(old_setup_exe, |
| 775 FilePath(uncompressed_patch), | 776 FilePath(uncompressed_patch), |
| 776 new_setup_exe)) | 777 new_setup_exe)) |
| 777 status = installer::NEW_VERSION_UPDATED; | 778 status = installer::NEW_VERSION_UPDATED; |
| 778 } | 779 } |
| 779 } | 780 } |
| 780 | 781 |
| 781 *exit_code = InstallUtil::GetInstallReturnCode(status); | 782 *exit_code = InstallUtil::GetInstallReturnCode(status); |
| 782 if (*exit_code) { | 783 if (*exit_code) { |
| 783 LOG(WARNING) << "setup.exe patching failed."; | 784 LOG(WARNING) << "setup.exe patching failed."; |
| 784 InstallUtil::WriteInstallerResult(installer_state->system_install(), | 785 InstallUtil::WriteInstallerResult(installer_state->system_install(), |
| 785 installer_state->state_key(), status, IDS_SETUP_PATCH_FAILED_BASE, | 786 installer_state->state_key(), status, IDS_SETUP_PATCH_FAILED_BASE, |
| 786 NULL); | 787 NULL); |
| 787 } | 788 } |
| 788 file_util::Delete(temp_path, true); | |
| 789 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { | 789 } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { |
| 790 // Check if we need to show the EULA. If it is passed as a command line | 790 // Check if we need to show the EULA. If it is passed as a command line |
| 791 // then the dialog is shown and regardless of the outcome setup exits here. | 791 // then the dialog is shown and regardless of the outcome setup exits here. |
| 792 std::wstring inner_frame = | 792 std::wstring inner_frame = |
| 793 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); | 793 cmd_line.GetSwitchValueNative(installer::switches::kShowEula); |
| 794 *exit_code = ShowEULADialog(inner_frame); | 794 *exit_code = ShowEULADialog(inner_frame); |
| 795 if (installer::EULA_REJECTED != *exit_code) | 795 if (installer::EULA_REJECTED != *exit_code) |
| 796 GoogleUpdateSettings::SetEULAConsent(*installer_state, true); | 796 GoogleUpdateSettings::SetEULAConsent(*installer_state, true); |
| 797 } else if (cmd_line.HasSwitch( | 797 } else if (cmd_line.HasSwitch( |
| 798 installer::switches::kRegisterChromeBrowser)) { | 798 installer::switches::kRegisterChromeBrowser)) { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 if (!(installer_state.is_msi() && is_uninstall)) | 1158 if (!(installer_state.is_msi() && is_uninstall)) |
| 1159 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1159 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1160 // to pass through, since this is only returned on uninstall which is | 1160 // to pass through, since this is only returned on uninstall which is |
| 1161 // never invoked directly by Google Update. | 1161 // never invoked directly by Google Update. |
| 1162 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1162 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1163 | 1163 |
| 1164 VLOG(1) << "Installation complete, returning: " << return_code; | 1164 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1165 | 1165 |
| 1166 return return_code; | 1166 return return_code; |
| 1167 } | 1167 } |
| OLD | NEW |