| 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 // This file declares util functions for setup project. | 5 // This file declares util functions for setup project. |
| 6 | 6 |
| 7 #include "chrome/installer/setup/setup_util.h" | 7 #include "chrome/installer/setup/setup_util.h" |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/installer/setup/user_hive_visitor.h" | 34 #include "chrome/installer/setup/user_hive_visitor.h" |
| 35 #include "chrome/installer/util/app_registration_data.h" | 35 #include "chrome/installer/util/app_registration_data.h" |
| 36 #include "chrome/installer/util/google_update_constants.h" | 36 #include "chrome/installer/util/google_update_constants.h" |
| 37 #include "chrome/installer/util/installation_state.h" | 37 #include "chrome/installer/util/installation_state.h" |
| 38 #include "chrome/installer/util/installer_state.h" | 38 #include "chrome/installer/util/installer_state.h" |
| 39 #include "chrome/installer/util/master_preferences.h" | 39 #include "chrome/installer/util/master_preferences.h" |
| 40 #include "chrome/installer/util/master_preferences_constants.h" | 40 #include "chrome/installer/util/master_preferences_constants.h" |
| 41 #include "chrome/installer/util/util_constants.h" | 41 #include "chrome/installer/util/util_constants.h" |
| 42 #include "courgette/courgette.h" | 42 #include "courgette/courgette.h" |
| 43 #include "courgette/third_party/bsdiff/bsdiff.h" | 43 #include "courgette/third_party/bsdiff/bsdiff.h" |
| 44 #include "third_party/bspatch/mbspatch.h" | |
| 45 | 44 |
| 46 namespace installer { | 45 namespace installer { |
| 47 | 46 |
| 48 namespace { | 47 namespace { |
| 49 | 48 |
| 50 // Returns true if product |type| cam be meaningfully installed without the | 49 // Returns true if product |type| cam be meaningfully installed without the |
| 51 // --multi-install flag. | 50 // --multi-install flag. |
| 52 bool SupportsSingleInstall(BrowserDistribution::Type type) { | 51 bool SupportsSingleInstall(BrowserDistribution::Type type) { |
| 53 return (type == BrowserDistribution::CHROME_BROWSER || | 52 return (type == BrowserDistribution::CHROME_BROWSER || |
| 54 type == BrowserDistribution::CHROME_FRAME); | 53 type == BrowserDistribution::CHROME_FRAME); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 int BsdiffPatchFiles(const base::FilePath& src, | 141 int BsdiffPatchFiles(const base::FilePath& src, |
| 143 const base::FilePath& patch, | 142 const base::FilePath& patch, |
| 144 const base::FilePath& dest) { | 143 const base::FilePath& dest) { |
| 145 VLOG(1) << "Applying bsdiff patch " << patch.value() | 144 VLOG(1) << "Applying bsdiff patch " << patch.value() |
| 146 << " to file " << src.value() | 145 << " to file " << src.value() |
| 147 << " and generating file " << dest.value(); | 146 << " and generating file " << dest.value(); |
| 148 | 147 |
| 149 if (src.empty() || patch.empty() || dest.empty()) | 148 if (src.empty() || patch.empty() || dest.empty()) |
| 150 return installer::PATCH_INVALID_ARGUMENTS; | 149 return installer::PATCH_INVALID_ARGUMENTS; |
| 151 | 150 |
| 152 const int patch_status = courgette::ApplyBinaryPatch(src, patch, dest); | 151 const int patch_status = bsdiff::ApplyBinaryPatch(src, patch, dest); |
| 153 const int exit_code = patch_status != OK ? | 152 const int exit_code = patch_status != bsdiff::OK ? |
| 154 patch_status + kBsdiffErrorOffset : 0; | 153 patch_status + kBsdiffErrorOffset : 0; |
| 155 | 154 |
| 156 LOG_IF(ERROR, exit_code) | 155 LOG_IF(ERROR, exit_code) |
| 157 << "Failed to apply bsdiff patch " << patch.value() | 156 << "Failed to apply bsdiff patch " << patch.value() |
| 158 << " to file " << src.value() << " and generating file " << dest.value() | 157 << " to file " << src.value() << " and generating file " << dest.value() |
| 159 << ". err=" << exit_code; | 158 << ". err=" << exit_code; |
| 160 | 159 |
| 161 return exit_code; | 160 return exit_code; |
| 162 } | 161 } |
| 163 | 162 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 } | 659 } |
| 661 | 660 |
| 662 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 661 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
| 663 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 662 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
| 664 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, | 663 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, |
| 665 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 664 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
| 666 } | 665 } |
| 667 } | 666 } |
| 668 | 667 |
| 669 } // namespace installer | 668 } // namespace installer |
| OLD | NEW |