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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 break; | 440 break; |
441 } | 441 } |
442 std::wstring extension = file.Extension(); | 442 std::wstring extension = file.Extension(); |
443 if (extension == &kExtExe[0] || extension == &kExtDll[0]) { | 443 if (extension == &kExtExe[0] || extension == &kExtDll[0]) { |
444 doing_great = UpdateVersionIfMatch(file, &ctx); | 444 doing_great = UpdateVersionIfMatch(file, &ctx); |
445 } | 445 } |
446 } while (doing_great); | 446 } while (doing_great); |
447 | 447 |
448 // Change the versioned directory. | 448 // Change the versioned directory. |
449 base::FilePath chrome_bin = work_dir.Append(&kChromeBin[0]); | 449 base::FilePath chrome_bin = work_dir.Append(&kChromeBin[0]); |
450 doing_great = file_util::Move(chrome_bin.Append(ctx.current_version_str), | 450 doing_great = base::Move(chrome_bin.Append(ctx.current_version_str), |
451 chrome_bin.Append(ctx.new_version_str)); | 451 chrome_bin.Append(ctx.new_version_str)); |
452 | 452 |
453 if (doing_great) { | 453 if (doing_great) { |
454 // Report the version numbers if requested. | 454 // Report the version numbers if requested. |
455 if (original_version != NULL) | 455 if (original_version != NULL) |
456 original_version->assign(ctx.current_version_str); | 456 original_version->assign(ctx.current_version_str); |
457 if (new_version != NULL) | 457 if (new_version != NULL) |
458 new_version->assign(ctx.new_version_str); | 458 new_version->assign(ctx.new_version_str); |
459 } | 459 } |
460 | 460 |
461 return doing_great; | 461 return doing_great; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), | 642 MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), |
643 setup_ex_) || | 643 setup_ex_) || |
644 !updater.Update(&kChromePacked7z[0], &kB7[0], | 644 !updater.Update(&kChromePacked7z[0], &kB7[0], |
645 MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), | 645 MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), |
646 chrome_packed_7z) || | 646 chrome_packed_7z) || |
647 !updater.Commit()) { | 647 !updater.Commit()) { |
648 return false; | 648 return false; |
649 } | 649 } |
650 | 650 |
651 // Finally, move the updated mini_installer into place. | 651 // Finally, move the updated mini_installer into place. |
652 return file_util::Move(mini_installer, target_path); | 652 return base::Move(mini_installer, target_path); |
653 } | 653 } |
654 | 654 |
655 bool GenerateAlternatePEFileVersion(const base::FilePath& original_file, | 655 bool GenerateAlternatePEFileVersion(const base::FilePath& original_file, |
656 const base::FilePath& target_file, | 656 const base::FilePath& target_file, |
657 Direction direction) { | 657 Direction direction) { |
658 VisitResourceContext ctx; | 658 VisitResourceContext ctx; |
659 if (!GetFileVersion(original_file, &ctx.current_version)) { | 659 if (!GetFileVersion(original_file, &ctx.current_version)) { |
660 LOG(DFATAL) << "Failed reading version from \"" << original_file.value() | 660 LOG(DFATAL) << "Failed reading version from \"" << original_file.value() |
661 << "\""; | 661 << "\""; |
662 return false; | 662 return false; |
(...skipping 29 matching lines...) Expand all Loading... |
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 |