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

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

Issue 18332014: Move Copy* into the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows Created 7 years, 5 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
« no previous file with comments | « chrome/installer/setup/uninstall.cc ('k') | chrome/installer/util/copy_tree_work_item.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 std::wstring* original_version, 517 std::wstring* original_version,
518 std::wstring* new_version) { 518 std::wstring* new_version) {
519 // Create a temporary directory in which we'll do our work. 519 // Create a temporary directory in which we'll do our work.
520 ScopedTempDirectory work_dir; 520 ScopedTempDirectory work_dir;
521 if (!work_dir.Initialize()) 521 if (!work_dir.Initialize())
522 return false; 522 return false;
523 523
524 // Copy the original mini_installer. 524 // Copy the original mini_installer.
525 base::FilePath mini_installer = 525 base::FilePath mini_installer =
526 work_dir.directory().Append(original_installer_path.BaseName()); 526 work_dir.directory().Append(original_installer_path.BaseName());
527 if (!file_util::CopyFile(original_installer_path, mini_installer)) { 527 if (!base::CopyFile(original_installer_path, mini_installer)) {
528 LOG(DFATAL) << "Failed copying \"" << original_installer_path.value() 528 LOG(DFATAL) << "Failed copying \"" << original_installer_path.value()
529 << "\" to \"" << mini_installer.value() << "\""; 529 << "\" to \"" << mini_installer.value() << "\"";
530 return false; 530 return false;
531 } 531 }
532 532
533 base::FilePath setup_ex_ = work_dir.directory().Append(&kSetupEx_[0]); 533 base::FilePath setup_ex_ = work_dir.directory().Append(&kSetupEx_[0]);
534 base::FilePath chrome_packed_7z = 534 base::FilePath chrome_packed_7z =
535 work_dir.directory().Append(&kChromePacked7z[0]); 535 work_dir.directory().Append(&kChromePacked7z[0]);
536 // Load the original file and extract setup.ex_ and chrome.packed.7z 536 // Load the original file and extract setup.ex_ and chrome.packed.7z
537 { 537 {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 Version new_version(WideToASCII(ctx.new_version_str)); 672 Version new_version(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 (!base::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
OLDNEW
« no previous file with comments | « chrome/installer/setup/uninstall.cc ('k') | chrome/installer/util/copy_tree_work_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698