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: |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 return false; | 662 return false; |
663 } | 663 } |
664 ctx.current_version_str = ctx.current_version.ToString(); | 664 ctx.current_version_str = ctx.current_version.ToString(); |
665 | 665 |
666 if (!IncrementNewVersion(direction, &ctx)) { | 666 if (!IncrementNewVersion(direction, &ctx)) { |
667 LOG(DFATAL) << "Failed to increment version from \"" | 667 LOG(DFATAL) << "Failed to increment version from \"" |
668 << original_file.value() << "\""; | 668 << original_file.value() << "\""; |
669 return false; | 669 return false; |
670 } | 670 } |
671 | 671 |
672 Version new_version(WideToASCII(ctx.new_version_str)); | 672 Version new_version(base::WideToASCII(ctx.new_version_str)); |
673 GenerateSpecificPEFileVersion(original_file, target_file, new_version); | 673 GenerateSpecificPEFileVersion(original_file, target_file, new_version); |
674 | 674 |
675 return true; | 675 return true; |
676 } | 676 } |
677 | 677 |
678 bool GenerateSpecificPEFileVersion(const base::FilePath& original_file, | 678 bool GenerateSpecificPEFileVersion(const base::FilePath& original_file, |
679 const base::FilePath& target_file, | 679 const base::FilePath& target_file, |
680 const Version& version) { | 680 const Version& version) { |
681 // First copy original_file to target_file. | 681 // First copy original_file to target_file. |
682 if (!file_util::CopyFile(original_file, target_file)) { | 682 if (!file_util::CopyFile(original_file, target_file)) { |
683 LOG(DFATAL) << "Failed copying \"" << original_file.value() | 683 LOG(DFATAL) << "Failed copying \"" << original_file.value() |
684 << "\" to \"" << target_file.value() << "\""; | 684 << "\" to \"" << target_file.value() << "\""; |
685 return false; | 685 return false; |
686 } | 686 } |
687 | 687 |
688 VisitResourceContext ctx; | 688 VisitResourceContext ctx; |
689 if (!GetFileVersion(target_file, &ctx.current_version)) { | 689 if (!GetFileVersion(target_file, &ctx.current_version)) { |
690 LOG(DFATAL) << "Failed reading version from \"" << target_file.value() | 690 LOG(DFATAL) << "Failed reading version from \"" << target_file.value() |
691 << "\""; | 691 << "\""; |
692 return false; | 692 return false; |
693 } | 693 } |
694 ctx.current_version_str = ctx.current_version.ToString(); | 694 ctx.current_version_str = ctx.current_version.ToString(); |
695 ctx.new_version = ChromeVersion::FromString(version.GetString()); | 695 ctx.new_version = ChromeVersion::FromString(version.GetString()); |
696 ctx.new_version_str = ctx.new_version.ToString(); | 696 ctx.new_version_str = ctx.new_version.ToString(); |
697 | 697 |
698 return UpdateVersionIfMatch(target_file, &ctx); | 698 return UpdateVersionIfMatch(target_file, &ctx); |
699 } | 699 } |
700 | 700 |
701 } // namespace upgrade_test | 701 } // namespace upgrade_test |
OLD | NEW |