Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / disk_cache / simple / simple_index_file_win.cc
blob051d12deaf7208c173b0fcaac0849c8f646e402f
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/disk_cache/simple/simple_index_file.h"
7 #include <string>
9 #include "base/files/file_enumerator.h"
10 #include "base/files/file_path.h"
12 namespace disk_cache {
14 // static
15 bool SimpleIndexFile::TraverseCacheDirectory(
16 const base::FilePath& cache_path,
17 const EntryFileCallback& entry_file_callback) {
18 const base::FilePath current_directory(FILE_PATH_LITERAL("."));
19 const base::FilePath parent_directory(FILE_PATH_LITERAL(".."));
20 const base::FilePath::StringType file_pattern = FILE_PATH_LITERAL("*");
21 base::FileEnumerator enumerator(
22 cache_path, false /* recursive */, base::FileEnumerator::FILES,
23 file_pattern);
24 for (base::FilePath file_path = enumerator.Next(); !file_path.empty();
25 file_path = enumerator.Next()) {
26 if (file_path == current_directory || file_path == parent_directory)
27 continue;
28 entry_file_callback.Run(file_path);
30 return true;
33 } // namespace disk_cache