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

Unified Diff: chrome/browser/ui/webui/chromeos/drive_internals_ui.cc

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/pdf/pdf_browsertest.cc ('k') | chrome/browser/ui/webui/feedback_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
index 6483cd7af66fab7e15aee04776820160866bdcd8..90a2ca9d2289e1493fc2740b2d5c1c32b1c3afbf 100644
--- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/files/file_enumerator.h"
#include "base/format_macros.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
@@ -60,26 +61,22 @@ namespace {
void GetGCacheContents(const base::FilePath& root_path,
base::ListValue* gcache_contents,
base::DictionaryValue* gcache_summary) {
- using file_util::FileEnumerator;
// Use this map to sort the result list by the path.
std::map<base::FilePath, DictionaryValue*> files;
- const int options = (file_util::FileEnumerator::FILES |
- file_util::FileEnumerator::DIRECTORIES |
- file_util::FileEnumerator::SHOW_SYM_LINKS);
- FileEnumerator enumerator(root_path, true /* recursive */, options);
+ const int options = (base::FileEnumerator::FILES |
+ base::FileEnumerator::DIRECTORIES |
+ base::FileEnumerator::SHOW_SYM_LINKS);
+ base::FileEnumerator enumerator(root_path, true /* recursive */, options);
int64 total_size = 0;
for (base::FilePath current = enumerator.Next(); !current.empty();
current = enumerator.Next()) {
- FileEnumerator::FindInfo find_info;
- enumerator.GetFindInfo(&find_info);
- int64 size = FileEnumerator::GetFilesize(find_info);
- const bool is_directory = FileEnumerator::IsDirectory(find_info);
- const bool is_symbolic_link =
- file_util::IsLink(FileEnumerator::GetFilename(find_info));
- const base::Time last_modified =
- FileEnumerator::GetLastModifiedTime(find_info);
+ base::FileEnumerator::FileInfo find_info = enumerator.GetInfo();
+ int64 size = find_info.GetSize();
+ const bool is_directory = find_info.IsDirectory();
+ const bool is_symbolic_link = file_util::IsLink(find_info.GetName());
+ const base::Time last_modified = find_info.GetLastModifiedTime();
base::DictionaryValue* entry = new base::DictionaryValue;
entry->SetString("path", current.value());
@@ -93,7 +90,7 @@ void GetGCacheContents(const base::FilePath& root_path,
// Print lower 9 bits in octal format.
entry->SetString(
"permission",
- base::StringPrintf("%03o", find_info.stat.st_mode & 0x1ff));
+ base::StringPrintf("%03o", find_info.stat().st_mode & 0x1ff));
files[current] = entry;
total_size += size;
« no previous file with comments | « chrome/browser/ui/pdf/pdf_browsertest.cc ('k') | chrome/browser/ui/webui/feedback_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698