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

Side by Side Diff: trunk/src/chrome/installer/util/installer_state.cc

Issue 14824006: Revert 198820 "Move FileEnumerator to its own file, do some refa..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/installer/util/installer_state.h" 5 #include "chrome/installer/util/installer_state.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/file_version_info.h" 13 #include "base/file_version_info.h"
14 #include "base/files/file_enumerator.h"
15 #include "base/logging.h" 14 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
17 #include "base/string_util.h" 16 #include "base/string_util.h"
18 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
19 #include "base/win/registry.h" 18 #include "base/win/registry.h"
20 #include "base/win/scoped_handle.h" 19 #include "base/win/scoped_handle.h"
21 #include "chrome/installer/util/delete_tree_work_item.h" 20 #include "chrome/installer/util/delete_tree_work_item.h"
22 #include "chrome/installer/util/helper.h" 21 #include "chrome/installer/util/helper.h"
23 #include "chrome/installer/util/install_util.h" 22 #include "chrome/installer/util/install_util.h"
24 #include "chrome/installer/util/installation_state.h" 23 #include "chrome/installer/util/installation_state.h"
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 std::set<std::string> existing_version_strings; 642 std::set<std::string> existing_version_strings;
644 existing_version_strings.insert(new_version.GetString()); 643 existing_version_strings.insert(new_version.GetString());
645 if (existing_version) 644 if (existing_version)
646 existing_version_strings.insert(existing_version->GetString()); 645 existing_version_strings.insert(existing_version->GetString());
647 646
648 // Make sure not to delete any version dir that is "referenced" by an existing 647 // Make sure not to delete any version dir that is "referenced" by an existing
649 // Chrome executable. 648 // Chrome executable.
650 GetExistingExeVersions(&existing_version_strings); 649 GetExistingExeVersions(&existing_version_strings);
651 650
652 // Try to delete all directories that are not in the set we care to keep. 651 // Try to delete all directories that are not in the set we care to keep.
653 base::FileEnumerator version_enum(target_path(), false, 652 file_util::FileEnumerator version_enum(target_path(), false,
654 base::FileEnumerator::DIRECTORIES); 653 file_util::FileEnumerator::DIRECTORIES);
655 for (base::FilePath next_version = version_enum.Next(); !next_version.empty(); 654 for (base::FilePath next_version = version_enum.Next(); !next_version.empty();
656 next_version = version_enum.Next()) { 655 next_version = version_enum.Next()) {
657 base::FilePath dir_name(next_version.BaseName()); 656 base::FilePath dir_name(next_version.BaseName());
658 version = Version(WideToASCII(dir_name.value())); 657 version = Version(WideToASCII(dir_name.value()));
659 // Delete the version folder if it is less than the new version and not 658 // Delete the version folder if it is less than the new version and not
660 // equal to the old version (if we have an old version). 659 // equal to the old version (if we have an old version).
661 if (version.IsValid() && 660 if (version.IsValid() &&
662 existing_version_strings.count(version.GetString()) == 0) { 661 existing_version_strings.count(version.GetString()) == 0) {
663 // Note: temporarily log old version deletion at ERROR level to make it 662 // Note: temporarily log old version deletion at ERROR level to make it
664 // more likely we see this in the installer log. 663 // more likely we see this in the installer log.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 } 790 }
792 if (!install_list->Do()) 791 if (!install_list->Do())
793 LOG(ERROR) << "Failed to record installer error information in registry."; 792 LOG(ERROR) << "Failed to record installer error information in registry.";
794 } 793 }
795 794
796 bool InstallerState::RequiresActiveSetup() const { 795 bool InstallerState::RequiresActiveSetup() const {
797 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); 796 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER);
798 } 797 }
799 798
800 } // namespace installer 799 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698