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

Side by Side Diff: webkit/fileapi/native_file_util.cc

Issue 9638002: Add symbolic link support to FileSystemFileUtil::AbstractFileEnumerator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
« no previous file with comments | « webkit/fileapi/local_file_util.cc ('k') | webkit/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/fileapi/native_file_util.h" 5 #include "webkit/fileapi/native_file_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 11 matching lines...) Expand all
22 memset(&file_util_info_, 0, sizeof(file_util_info_)); 22 memset(&file_util_info_, 0, sizeof(file_util_info_));
23 #endif // defined(OS_WIN) 23 #endif // defined(OS_WIN)
24 } 24 }
25 25
26 ~NativeFileEnumerator() {} 26 ~NativeFileEnumerator() {}
27 27
28 virtual FilePath Next() OVERRIDE; 28 virtual FilePath Next() OVERRIDE;
29 virtual int64 Size() OVERRIDE; 29 virtual int64 Size() OVERRIDE;
30 virtual base::Time LastModifiedTime() OVERRIDE; 30 virtual base::Time LastModifiedTime() OVERRIDE;
31 virtual bool IsDirectory() OVERRIDE; 31 virtual bool IsDirectory() OVERRIDE;
32 virtual bool IsLink() OVERRIDE;
32 33
33 private: 34 private:
34 file_util::FileEnumerator file_enum_; 35 file_util::FileEnumerator file_enum_;
35 file_util::FileEnumerator::FindInfo file_util_info_; 36 file_util::FileEnumerator::FindInfo file_util_info_;
36 }; 37 };
37 38
38 FilePath NativeFileEnumerator::Next() { 39 FilePath NativeFileEnumerator::Next() {
39 FilePath rv = file_enum_.Next(); 40 FilePath rv = file_enum_.Next();
40 if (!rv.empty()) 41 if (!rv.empty())
41 file_enum_.GetFindInfo(&file_util_info_); 42 file_enum_.GetFindInfo(&file_util_info_);
42 return rv; 43 return rv;
43 } 44 }
44 45
45 int64 NativeFileEnumerator::Size() { 46 int64 NativeFileEnumerator::Size() {
46 return file_util::FileEnumerator::GetFilesize(file_util_info_); 47 return file_util::FileEnumerator::GetFilesize(file_util_info_);
47 } 48 }
48 49
49 base::Time NativeFileEnumerator::LastModifiedTime() { 50 base::Time NativeFileEnumerator::LastModifiedTime() {
50 return file_util::FileEnumerator::GetLastModifiedTime(file_util_info_); 51 return file_util::FileEnumerator::GetLastModifiedTime(file_util_info_);
51 } 52 }
52 53
53 bool NativeFileEnumerator::IsDirectory() { 54 bool NativeFileEnumerator::IsDirectory() {
54 return file_util::FileEnumerator::IsDirectory(file_util_info_); 55 return file_util::FileEnumerator::IsDirectory(file_util_info_);
55 } 56 }
56 57
58 bool NativeFileEnumerator::IsLink() {
59 return file_util::FileEnumerator::IsLink(file_util_info_);
60 }
61
57 PlatformFileError NativeFileUtil::CreateOrOpen( 62 PlatformFileError NativeFileUtil::CreateOrOpen(
58 FileSystemOperationContext* unused, 63 FileSystemOperationContext* unused,
59 const FileSystemPath& path, int file_flags, 64 const FileSystemPath& path, int file_flags,
60 PlatformFile* file_handle, bool* created) { 65 PlatformFile* file_handle, bool* created) {
61 if (!file_util::DirectoryExists(path.internal_path().DirName())) { 66 if (!file_util::DirectoryExists(path.internal_path().DirName())) {
62 // If its parent does not exist, should return NOT_FOUND error. 67 // If its parent does not exist, should return NOT_FOUND error.
63 return base::PLATFORM_FILE_ERROR_NOT_FOUND; 68 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
64 } 69 }
65 PlatformFileError error_code = base::PLATFORM_FILE_OK; 70 PlatformFileError error_code = base::PLATFORM_FILE_OK;
66 *file_handle = base::CreatePlatformFile(path.internal_path(), file_flags, 71 *file_handle = base::CreatePlatformFile(path.internal_path(), file_flags,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (!file_util::IsDirectoryEmpty(path.internal_path())) { 301 if (!file_util::IsDirectoryEmpty(path.internal_path())) {
297 // TODO(dmikurube): Check if this error code is appropriate. 302 // TODO(dmikurube): Check if this error code is appropriate.
298 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; 303 return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
299 } 304 }
300 if (!file_util::Delete(path.internal_path(), false)) 305 if (!file_util::Delete(path.internal_path(), false))
301 return base::PLATFORM_FILE_ERROR_FAILED; 306 return base::PLATFORM_FILE_ERROR_FAILED;
302 return base::PLATFORM_FILE_OK; 307 return base::PLATFORM_FILE_OK;
303 } 308 }
304 309
305 } // namespace fileapi 310 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/local_file_util.cc ('k') | webkit/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698