OLD | NEW |
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/local_file_util.h" | 5 #include "webkit/fileapi/local_file_util.h" |
6 | 6 |
7 #include "base/file_util_proxy.h" | 7 #include "base/file_util_proxy.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "webkit/fileapi/file_system_context.h" | 9 #include "webkit/fileapi/file_system_context.h" |
10 #include "webkit/fileapi/file_system_mount_point_provider.h" | 10 #include "webkit/fileapi/file_system_mount_point_provider.h" |
11 #include "webkit/fileapi/file_system_operation_context.h" | 11 #include "webkit/fileapi/file_system_operation_context.h" |
12 #include "webkit/fileapi/file_system_types.h" | 12 #include "webkit/fileapi/file_system_types.h" |
13 #include "webkit/fileapi/file_system_url.h" | 13 #include "webkit/fileapi/file_system_url.h" |
14 #include "webkit/fileapi/file_system_util.h" | 14 #include "webkit/fileapi/file_system_util.h" |
15 #include "webkit/fileapi/native_file_util.h" | 15 #include "webkit/fileapi/native_file_util.h" |
16 | 16 |
17 namespace fileapi { | 17 namespace fileapi { |
18 | 18 |
| 19 using base::PlatformFileError; |
| 20 |
19 class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { | 21 class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { |
20 public: | 22 public: |
21 LocalFileEnumerator(const FilePath& platform_root_path, | 23 LocalFileEnumerator(const FilePath& platform_root_path, |
22 const FilePath& virtual_root_path, | 24 const FilePath& virtual_root_path, |
23 bool recursive, | 25 bool recursive, |
24 int file_type) | 26 int file_type) |
25 : file_enum_(platform_root_path, recursive, file_type), | 27 : file_enum_(platform_root_path, recursive, file_type), |
26 platform_root_path_(platform_root_path), | 28 platform_root_path_(platform_root_path), |
27 virtual_root_path_(virtual_root_path) { | 29 virtual_root_path_(virtual_root_path) { |
28 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 74 |
73 LocalFileUtil::LocalFileUtil() { | 75 LocalFileUtil::LocalFileUtil() { |
74 } | 76 } |
75 | 77 |
76 LocalFileUtil::~LocalFileUtil() { | 78 LocalFileUtil::~LocalFileUtil() { |
77 } | 79 } |
78 | 80 |
79 PlatformFileError LocalFileUtil::CreateOrOpen( | 81 PlatformFileError LocalFileUtil::CreateOrOpen( |
80 FileSystemOperationContext* context, | 82 FileSystemOperationContext* context, |
81 const FileSystemURL& url, int file_flags, | 83 const FileSystemURL& url, int file_flags, |
82 PlatformFile* file_handle, bool* created) { | 84 base::PlatformFile* file_handle, bool* created) { |
83 FilePath file_path; | 85 FilePath file_path; |
84 PlatformFileError error = GetLocalFilePath(context, url, &file_path); | 86 PlatformFileError error = GetLocalFilePath(context, url, &file_path); |
85 if (error != base::PLATFORM_FILE_OK) | 87 if (error != base::PLATFORM_FILE_OK) |
86 return error; | 88 return error; |
87 return NativeFileUtil::CreateOrOpen( | 89 return NativeFileUtil::CreateOrOpen( |
88 file_path, file_flags, file_handle, created); | 90 file_path, file_flags, file_handle, created); |
89 } | 91 } |
90 | 92 |
91 PlatformFileError LocalFileUtil::Close(FileSystemOperationContext* context, | 93 PlatformFileError LocalFileUtil::Close(FileSystemOperationContext* context, |
92 PlatformFile file) { | 94 base::PlatformFile file) { |
93 return NativeFileUtil::Close(file); | 95 return NativeFileUtil::Close(file); |
94 } | 96 } |
95 | 97 |
96 PlatformFileError LocalFileUtil::EnsureFileExists( | 98 PlatformFileError LocalFileUtil::EnsureFileExists( |
97 FileSystemOperationContext* context, | 99 FileSystemOperationContext* context, |
98 const FileSystemURL& url, | 100 const FileSystemURL& url, |
99 bool* created) { | 101 bool* created) { |
100 FilePath file_path; | 102 FilePath file_path; |
101 PlatformFileError error = GetLocalFilePath(context, url, &file_path); | 103 PlatformFileError error = GetLocalFilePath(context, url, &file_path); |
102 if (error != base::PLATFORM_FILE_OK) | 104 if (error != base::PLATFORM_FILE_OK) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 base::PlatformFileInfo* file_info, | 260 base::PlatformFileInfo* file_info, |
259 FilePath* platform_path, | 261 FilePath* platform_path, |
260 SnapshotFilePolicy* policy) { | 262 SnapshotFilePolicy* policy) { |
261 DCHECK(policy); | 263 DCHECK(policy); |
262 // We're just returning the local file information. | 264 // We're just returning the local file information. |
263 *policy = kSnapshotFileLocal; | 265 *policy = kSnapshotFileLocal; |
264 return GetFileInfo(context, url, file_info, platform_path); | 266 return GetFileInfo(context, url, file_info, platform_path); |
265 } | 267 } |
266 | 268 |
267 } // namespace fileapi | 269 } // namespace fileapi |
OLD | NEW |