diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 22:51:31 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 22:51:31 +0000 |
commit | fcb524ead399b591b4e6587c2fbe712e45126320 (patch) | |
tree | 77da32bc4e3ab916de166e0f9e52e0ad61629efa /chrome/installer/setup/setup_util.cc | |
parent | 3afef01773fcfe63523ebede8ad5a4dfed10088b (diff) | |
download | chromium_src-fcb524ead399b591b4e6587c2fbe712e45126320.zip chromium_src-fcb524ead399b591b4e6587c2fbe712e45126320.tar.gz chromium_src-fcb524ead399b591b4e6587c2fbe712e45126320.tar.bz2 |
Move FileEnumerator to its own file, do some refactoring.
It creates a class FileInfo to contain the details rather than using a platform-specific typedef. This allows the accessors GetName, GetSize, etc. to be moved directly to this class (previously they were static helpers on the FileEnumerator class) which makes a bunch of code much cleaner. It also gives reasonable getting and initialization which the previous version lacked.
BUG=175002
R=rvargas@chromium.org
Review URL: https://codereview.chromium.org/13165005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup/setup_util.cc')
-rw-r--r-- | chrome/installer/setup/setup_util.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index 9f112c0..8b94c01 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/process_util.h" @@ -124,8 +125,8 @@ int ApplyDiffPatch(const base::FilePath& src, Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) { VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); Version* version = NULL; - file_util::FileEnumerator version_enum(chrome_path, false, - file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator version_enum(chrome_path, false, + base::FileEnumerator::DIRECTORIES); // TODO(tommi): The version directory really should match the version of // setup.exe. To begin with, we should at least DCHECK that that's true. @@ -133,12 +134,11 @@ Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) { bool version_found = false; while (!version_enum.Next().empty()) { - file_util::FileEnumerator::FindInfo find_data = {0}; - version_enum.GetFindInfo(&find_data); - VLOG(1) << "directory found: " << find_data.cFileName; + base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); + VLOG(1) << "directory found: " << find_data.GetName().value(); scoped_ptr<Version> found_version( - new Version(WideToASCII(find_data.cFileName))); + new Version(WideToASCII(find_data.GetName().value()))); if (found_version->IsValid() && found_version->CompareTo(*max_version.get()) > 0) { max_version.reset(found_version.release()); |