| 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 // This file exposes the public interface to the mini_installer re-versioner. | 5 // This file exposes the public interface to the mini_installer re-versioner. |
| 6 | 6 |
| 7 #ifndef CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_ | 7 #ifndef CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_ |
| 8 #define CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_ | 8 #define CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include "base/strings/string16.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class FilePath; | 13 class FilePath; |
| 14 class Version; | 14 class Version; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace upgrade_test { | 17 namespace upgrade_test { |
| 18 | 18 |
| 19 enum Direction { | 19 enum Direction { |
| 20 PREVIOUS_VERSION, | 20 PREVIOUS_VERSION, |
| 21 NEXT_VERSION | 21 NEXT_VERSION |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 // Generates an alternate mini_installer.exe using the one indicated by | 24 // Generates an alternate mini_installer.exe using the one indicated by |
| 25 // |original_installer_path|, giving the new one a lower or higher version than | 25 // |original_installer_path|, giving the new one a lower or higher version than |
| 26 // the original and placing it in |target_path|. Any previous file at | 26 // the original and placing it in |target_path|. Any previous file at |
| 27 // |target_path| is clobbered. Returns true on success. |original_version| and | 27 // |target_path| is clobbered. Returns true on success. |original_version| and |
| 28 // |new_version|, when non-NULL, are given the original and new version numbers | 28 // |new_version|, when non-NULL, are given the original and new version numbers |
| 29 // on success. | 29 // on success. |
| 30 bool GenerateAlternateVersion(const base::FilePath& original_installer_path, | 30 bool GenerateAlternateVersion(const base::FilePath& original_installer_path, |
| 31 const base::FilePath& target_path, | 31 const base::FilePath& target_path, |
| 32 Direction direction, | 32 Direction direction, |
| 33 std::wstring* original_version, | 33 base::string16* original_version, |
| 34 std::wstring* new_version); | 34 base::string16* new_version); |
| 35 | 35 |
| 36 // Given a path to a PEImage in |original_file|, copy that file to | 36 // Given a path to a PEImage in |original_file|, copy that file to |
| 37 // |target_file|, modifying the version of the copy according to |direction|. | 37 // |target_file|, modifying the version of the copy according to |direction|. |
| 38 // Any previous file at |target_file| is clobbered. Returns true on success. | 38 // Any previous file at |target_file| is clobbered. On success, returns the |
| 39 // Note that |target_file| may still be mutated on failure. | 39 // version of the generated file. Otherwise, returns an empty string. Note that |
| 40 bool GenerateAlternatePEFileVersion(const base::FilePath& original_file, | 40 // |target_file| may still be mutated on failure. |
| 41 const base::FilePath& target_file, | 41 base::string16 GenerateAlternatePEFileVersion( |
| 42 Direction direction); | 42 const base::FilePath& original_file, |
| 43 const base::FilePath& target_file, |
| 44 Direction direction); |
| 43 | 45 |
| 44 // Given a path to a PEImage in |original_file|, copy that file to | 46 // Given a path to a PEImage in |original_file|, copy that file to |
| 45 // |target_file|, modifying the version of the copy according to |version|. | 47 // |target_file|, modifying the version of the copy according to |version|. |
| 46 // Any previous file at |target_file| is clobbered. Returns true on success. | 48 // Any previous file at |target_file| is clobbered. Returns true on success. |
| 47 // Note that |target_file| may still be mutated on failure. | 49 // Note that |target_file| may still be mutated on failure. |
| 48 bool GenerateSpecificPEFileVersion(const base::FilePath& original_file, | 50 bool GenerateSpecificPEFileVersion(const base::FilePath& original_file, |
| 49 const base::FilePath& target_file, | 51 const base::FilePath& target_file, |
| 50 const base::Version& version); | 52 const base::Version& version); |
| 51 | 53 |
| 52 } // namespace upgrade_test | 54 } // namespace upgrade_test |
| 53 | 55 |
| 54 #endif // CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_ | 56 #endif // CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_ |
| OLD | NEW |