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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include <algorithm> | 28 #include <algorithm> |
29 #include <limits> | 29 #include <limits> |
30 #include <sstream> | 30 #include <sstream> |
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_util.h" | 36 #include "base/file_util.h" |
| 37 #include "base/files/file_enumerator.h" |
37 #include "base/files/file_path.h" | 38 #include "base/files/file_path.h" |
38 #include "base/logging.h" | 39 #include "base/logging.h" |
39 #include "base/path_service.h" | 40 #include "base/path_service.h" |
40 #include "base/platform_file.h" | 41 #include "base/platform_file.h" |
41 #include "base/process_util.h" | 42 #include "base/process_util.h" |
42 #include "base/string_util.h" | 43 #include "base/string_util.h" |
43 #include "base/version.h" | 44 #include "base/version.h" |
44 #include "base/win/pe_image.h" | 45 #include "base/win/pe_image.h" |
45 #include "base/win/scoped_handle.h" | 46 #include "base/win/scoped_handle.h" |
46 #include "chrome/installer/test/pe_image_resources.h" | 47 #include "chrome/installer/test/pe_image_resources.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return false; | 426 return false; |
426 } | 427 } |
427 ctx.current_version_str = ctx.current_version.ToString(); | 428 ctx.current_version_str = ctx.current_version.ToString(); |
428 | 429 |
429 if (!IncrementNewVersion(direction, &ctx)) { | 430 if (!IncrementNewVersion(direction, &ctx)) { |
430 return false; | 431 return false; |
431 } | 432 } |
432 | 433 |
433 // Modify all .dll and .exe files with the current version. | 434 // Modify all .dll and .exe files with the current version. |
434 bool doing_great = true; | 435 bool doing_great = true; |
435 file_util::FileEnumerator all_files(work_dir, true, | 436 base::FileEnumerator all_files(work_dir, true, base::FileEnumerator::FILES); |
436 file_util::FileEnumerator::FILES); | |
437 do { | 437 do { |
438 base::FilePath file = all_files.Next(); | 438 base::FilePath file = all_files.Next(); |
439 if (file.empty()) { | 439 if (file.empty()) { |
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); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |