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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 ResourceLoader resource_loader; | 536 ResourceLoader resource_loader; |
537 std::pair<const uint8*, DWORD> resource_data; | 537 std::pair<const uint8*, DWORD> resource_data; |
538 | 538 |
539 if (!resource_loader.Initialize(mini_installer)) | 539 if (!resource_loader.Initialize(mini_installer)) |
540 return false; | 540 return false; |
541 | 541 |
542 // Write out setup.ex_ | 542 // Write out setup.ex_ |
543 if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data)) | 543 if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data)) |
544 return false; | 544 return false; |
545 int written = | 545 int written = |
546 file_util::WriteFile(setup_ex_, | 546 base::WriteFile(setup_ex_, |
547 reinterpret_cast<const char*>(resource_data.first), | 547 reinterpret_cast<const char*>(resource_data.first), |
548 static_cast<int>(resource_data.second)); | 548 static_cast<int>(resource_data.second)); |
549 if (written != resource_data.second) { | 549 if (written != resource_data.second) { |
550 LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\""; | 550 LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\""; |
551 return false; | 551 return false; |
552 } | 552 } |
553 | 553 |
554 // Write out chrome.packed.7z | 554 // Write out chrome.packed.7z |
555 if (!resource_loader.Load(&kChromePacked7z[0], &kB7[0], &resource_data)) | 555 if (!resource_loader.Load(&kChromePacked7z[0], &kB7[0], &resource_data)) |
556 return false; | 556 return false; |
557 written = | 557 written = |
558 file_util::WriteFile(chrome_packed_7z, | 558 base::WriteFile(chrome_packed_7z, |
559 reinterpret_cast<const char*>(resource_data.first), | 559 reinterpret_cast<const char*>(resource_data.first), |
560 static_cast<int>(resource_data.second)); | 560 static_cast<int>(resource_data.second)); |
561 if (written != resource_data.second) { | 561 if (written != resource_data.second) { |
562 LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\""; | 562 LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\""; |
563 return false; | 563 return false; |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 // Expand setup.ex_ | 567 // Expand setup.ex_ |
568 base::FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]); | 568 base::FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]); |
569 std::wstring command_line; | 569 std::wstring command_line; |
570 command_line.append(1, L'"') | 570 command_line.append(1, L'"') |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 return false; | 690 return false; |
691 } | 691 } |
692 ctx.current_version_str = ctx.current_version.ToString(); | 692 ctx.current_version_str = ctx.current_version.ToString(); |
693 ctx.new_version = ChromeVersion::FromString(version.GetString()); | 693 ctx.new_version = ChromeVersion::FromString(version.GetString()); |
694 ctx.new_version_str = ctx.new_version.ToString(); | 694 ctx.new_version_str = ctx.new_version.ToString(); |
695 | 695 |
696 return UpdateVersionIfMatch(target_file, &ctx); | 696 return UpdateVersionIfMatch(target_file, &ctx); |
697 } | 697 } |
698 | 698 |
699 } // namespace upgrade_test | 699 } // namespace upgrade_test |
OLD | NEW |