| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 installed_version->GetString()); | 65 installed_version->GetString()); |
| 66 file_util::AppendToPath(&existing_archive, installer::kInstallerDir); | 66 file_util::AppendToPath(&existing_archive, installer::kInstallerDir); |
| 67 file_util::AppendToPath(&existing_archive, installer::kChromeArchive); | 67 file_util::AppendToPath(&existing_archive, installer::kChromeArchive); |
| 68 | 68 |
| 69 std::wstring patch_archive(archive_path); | 69 std::wstring patch_archive(archive_path); |
| 70 file_util::AppendToPath(&patch_archive, installer::kChromePatchArchive); | 70 file_util::AppendToPath(&patch_archive, installer::kChromePatchArchive); |
| 71 | 71 |
| 72 LOG(INFO) << "Applying patch " << patch_archive | 72 LOG(INFO) << "Applying patch " << patch_archive |
| 73 << " to file " << existing_archive | 73 << " to file " << existing_archive |
| 74 << " and generating file " << uncompressed_archive; | 74 << " and generating file " << uncompressed_archive; |
| 75 return ApplyBinaryPatch(WideToUTF8(existing_archive).c_str(), | 75 return ApplyBinaryPatch(existing_archive.c_str(), |
| 76 WideToUTF8(patch_archive).c_str(), | 76 patch_archive.c_str(), |
| 77 WideToUTF8(uncompressed_archive).c_str()); | 77 uncompressed_archive.c_str()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 // This method unpacks and uncompresses the given archive file. For Chrome | 81 // This method unpacks and uncompresses the given archive file. For Chrome |
| 82 // install we are creating a uncompressed archive that contains all the files | 82 // install we are creating a uncompressed archive that contains all the files |
| 83 // needed for the installer. This uncompressed archive is later compressed. | 83 // needed for the installer. This uncompressed archive is later compressed. |
| 84 // | 84 // |
| 85 // This method first uncompresses archive specified by parameter "archive" | 85 // This method first uncompresses archive specified by parameter "archive" |
| 86 // and assumes that it will result in an uncompressed full archive file | 86 // and assumes that it will result in an uncompressed full archive file |
| 87 // (chrome.7z) or uncompressed patch archive file (patch.7z). If it is patch | 87 // (chrome.7z) or uncompressed patch archive file (patch.7z). If it is patch |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 if ((archive_name.size() >= prefix.size()) && | 119 if ((archive_name.size() >= prefix.size()) && |
| 120 (std::equal(prefix.begin(), prefix.end(), archive_name.begin(), | 120 (std::equal(prefix.begin(), prefix.end(), archive_name.begin(), |
| 121 CaseInsensitiveCompare<wchar_t>()))) { | 121 CaseInsensitiveCompare<wchar_t>()))) { |
| 122 LOG(INFO) << "Differential patch found. Applying to existing archive."; | 122 LOG(INFO) << "Differential patch found. Applying to existing archive."; |
| 123 incremental_install = true; | 123 incremental_install = true; |
| 124 if (!installed_version) { | 124 if (!installed_version) { |
| 125 LOG(ERROR) << "Can not use differential update when Chrome is not " | 125 LOG(ERROR) << "Can not use differential update when Chrome is not " |
| 126 << "installed on the system."; | 126 << "installed on the system."; |
| 127 return 1; | 127 return 1; |
| 128 } | 128 } |
| 129 if (PatchArchiveFile(system_install, temp_path, uncompressed_archive, | 129 if (int i = PatchArchiveFile(system_install, temp_path, |
| 130 installed_version)) { | 130 uncompressed_archive, installed_version)) { |
| 131 LOG(ERROR) << "Binary patching failed."; | 131 LOG(ERROR) << "Binary patching failed with error " << i; |
| 132 return 1; | 132 return 1; |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 // If we got the uncompressed archive, lets unpack it | 136 // If we got the uncompressed archive, lets unpack it |
| 137 LOG(INFO) << "Opening archive " << uncompressed_archive; | 137 LOG(INFO) << "Opening archive " << uncompressed_archive; |
| 138 if ((ret = util.OpenArchive(uncompressed_archive)) != NO_ERROR) { | 138 if ((ret = util.OpenArchive(uncompressed_archive)) != NO_ERROR) { |
| 139 LOG(ERROR) << "Unable to open install archive: " << | 139 LOG(ERROR) << "Unable to open install archive: " << |
| 140 uncompressed_archive; | 140 uncompressed_archive; |
| 141 } else { | 141 } else { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 install_status = InstallChrome(parsed_command_line, | 330 install_status = InstallChrome(parsed_command_line, |
| 331 installed_version.get(), | 331 installed_version.get(), |
| 332 system_install); | 332 system_install); |
| 333 } | 333 } |
| 334 | 334 |
| 335 CoUninitialize(); | 335 CoUninitialize(); |
| 336 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 336 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 337 return dist->GetInstallReturnCode(install_status); | 337 return dist->GetInstallReturnCode(install_status); |
| 338 } | 338 } |
| 339 | 339 |
| OLD | NEW |