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

Side by Side Diff: webkit/fileapi/media/filtering_file_enumerator.cc

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "webkit/fileapi/media/filtering_file_enumerator.h" 8 #include "webkit/fileapi/media/filtering_file_enumerator.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
11 #include <windows.h> 11 #include <windows.h>
12 #else 12 #else
13 #include <cstring> 13 #include <cstring>
14 14
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #endif 16 #endif
17 17
18 namespace fileapi { 18 namespace fileapi {
19 19
20 namespace { 20 namespace {
21 21
22 // Used to skip the hidden folders and files. Returns true if the file specified 22 // Used to skip the hidden folders and files. Returns true if the file specified
23 // by |path| should be skipped. 23 // by |path| should be skipped.
24 bool ShouldSkip(const FilePath& path) { 24 bool ShouldSkip(const base::FilePath& path) {
25 const FilePath& base_name = path.BaseName(); 25 const base::FilePath& base_name = path.BaseName();
26 if (base_name.empty()) 26 if (base_name.empty())
27 return false; 27 return false;
28 28
29 // Dot files (aka hidden files) 29 // Dot files (aka hidden files)
30 if (base_name.value()[0] == '.') 30 if (base_name.value()[0] == '.')
31 return true; 31 return true;
32 32
33 // Mac OS X file. 33 // Mac OS X file.
34 if (base_name.value() == FILE_PATH_LITERAL("__MACOSX")) 34 if (base_name.value() == FILE_PATH_LITERAL("__MACOSX"))
35 return true; 35 return true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 MediaPathFilter* filter) 70 MediaPathFilter* filter)
71 : base_enumerator_(base_enumerator.Pass()), 71 : base_enumerator_(base_enumerator.Pass()),
72 filter_(filter) { 72 filter_(filter) {
73 DCHECK(base_enumerator_.get()); 73 DCHECK(base_enumerator_.get());
74 DCHECK(filter); 74 DCHECK(filter);
75 } 75 }
76 76
77 FilteringFileEnumerator::~FilteringFileEnumerator() { 77 FilteringFileEnumerator::~FilteringFileEnumerator() {
78 } 78 }
79 79
80 FilePath FilteringFileEnumerator::Next() { 80 base::FilePath FilteringFileEnumerator::Next() {
81 while (true) { 81 while (true) {
82 FilePath next = base_enumerator_->Next(); 82 base::FilePath next = base_enumerator_->Next();
83 if (ShouldSkip(next)) 83 if (ShouldSkip(next))
84 continue; 84 continue;
85 85
86 if (next.empty() || 86 if (next.empty() ||
87 base_enumerator_->IsDirectory() || 87 base_enumerator_->IsDirectory() ||
88 filter_->Match(next)) 88 filter_->Match(next))
89 return next; 89 return next;
90 } 90 }
91 } 91 }
92 92
93 int64 FilteringFileEnumerator::Size() { 93 int64 FilteringFileEnumerator::Size() {
94 return base_enumerator_->Size(); 94 return base_enumerator_->Size();
95 } 95 }
96 96
97 base::Time FilteringFileEnumerator::LastModifiedTime() { 97 base::Time FilteringFileEnumerator::LastModifiedTime() {
98 return base_enumerator_->LastModifiedTime(); 98 return base_enumerator_->LastModifiedTime();
99 } 99 }
100 100
101 bool FilteringFileEnumerator::IsDirectory() { 101 bool FilteringFileEnumerator::IsDirectory() {
102 return base_enumerator_->IsDirectory(); 102 return base_enumerator_->IsDirectory();
103 } 103 }
104 104
105 } // namespace fileapi 105 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/media/filtering_file_enumerator.h ('k') | webkit/fileapi/media/media_path_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698