Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/installer/test/alternate_version_generator.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/installer/setup/setup_util_unittest.cc ('k') | chrome/installer/util/install_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698