| 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 // The file contains the implementation of the mini_installer re-versioner. | 5 // The file contains the implementation of the mini_installer re-versioner. |
| 6 // The main function (GenerateNextVersion) does the following in a temp dir: | 6 // The main function (GenerateNextVersion) does the following in a temp dir: |
| 7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from | 7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from |
| 8 // mini_installer.exe. | 8 // mini_installer.exe. |
| 9 // - Inspects setup.exe to determine the current version. | 9 // - Inspects setup.exe to determine the current version. |
| 10 // - Runs through all .dll and .exe files: | 10 // - Runs through all .dll and .exe files: |
| 11 // - Replacing all occurrences of the Unicode version string in the files' | 11 // - Replacing all occurrences of the Unicode version string in the files' |
| 12 // resources with the updated string. | 12 // resources with the updated string. |
| 13 // - For all resources in which the string substitution is made, the binary | 13 // - For all resources in which the string substitution is made, the binary |
| 14 // form of the version is also replaced. | 14 // form of the version is also replaced. |
| 15 // - Re-packs setup.exe and Chrome-bin. | 15 // - Re-packs setup.exe and Chrome-bin. |
| 16 // - Inserts them into the target mini_installer.exe. | 16 // - Inserts them into the target mini_installer.exe. |
| 17 // | 17 // |
| 18 // This code assumes that the host program 1) initializes the process-wide | 18 // This code assumes that the host program 1) initializes the process-wide |
| 19 // CommandLine instance, and 2) resides in the output directory of a build | 19 // CommandLine instance, and 2) resides in the output directory of a build |
| 20 // tree. When #2 is not the case, the --7za_path command-line switch may be | 20 // tree. When #2 is not the case, the --7za_path command-line switch may be |
| 21 // used to provide the (relative or absolute) path to the directory containing | 21 // used to provide the (relative or absolute) path to the directory containing |
| 22 // 7za.exe. | 22 // 7za.exe. |
| 23 | 23 |
| 24 #include "chrome/installer/test/alternate_version_generator.h" | 24 #include "chrome/installer/test/alternate_version_generator.h" |
| 25 | 25 |
| 26 #include <windows.h> | 26 #include <windows.h> |
| 27 | 27 |
| 28 #include <algorithm> | 28 #include <algorithm> |
| 29 #include <limits> |
| 29 #include <sstream> | 30 #include <sstream> |
| 30 #include <limits> | |
| 31 #include <utility> | 31 #include <utility> |
| 32 #include <vector> | 32 #include <vector> |
| 33 | 33 |
| 34 #include "base/basictypes.h" | 34 #include "base/basictypes.h" |
| 35 #include "base/command_line.h" | 35 #include "base/command_line.h" |
| 36 #include "base/file_path.h" | 36 #include "base/file_path.h" |
| 37 #include "base/file_util.h" | 37 #include "base/file_util.h" |
| 38 #include "base/logging.h" | 38 #include "base/logging.h" |
| 39 #include "base/path_service.h" | 39 #include "base/path_service.h" |
| 40 #include "base/platform_file.h" | 40 #include "base/platform_file.h" |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 return false; | 688 return false; |
| 689 } | 689 } |
| 690 ctx.current_version_str = ctx.current_version.ToString(); | 690 ctx.current_version_str = ctx.current_version.ToString(); |
| 691 ctx.new_version = ChromeVersion::FromString(version.GetString()); | 691 ctx.new_version = ChromeVersion::FromString(version.GetString()); |
| 692 ctx.new_version_str = ctx.new_version.ToString(); | 692 ctx.new_version_str = ctx.new_version.ToString(); |
| 693 | 693 |
| 694 return UpdateVersionIfMatch(target_file, &ctx); | 694 return UpdateVersionIfMatch(target_file, &ctx); |
| 695 } | 695 } |
| 696 | 696 |
| 697 } // namespace upgrade_test | 697 } // namespace upgrade_test |
| OLD | NEW |