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" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 FileSystemOperationContext* context, | 181 FileSystemOperationContext* context, |
182 const FileSystemURL& url, | 182 const FileSystemURL& url, |
183 int64 length) { | 183 int64 length) { |
184 FilePath file_path; | 184 FilePath file_path; |
185 PlatformFileError error = GetLocalFilePath(context, url, &file_path); | 185 PlatformFileError error = GetLocalFilePath(context, url, &file_path); |
186 if (error != base::PLATFORM_FILE_OK) | 186 if (error != base::PLATFORM_FILE_OK) |
187 return error; | 187 return error; |
188 return NativeFileUtil::Truncate(file_path, length); | 188 return NativeFileUtil::Truncate(file_path, length); |
189 } | 189 } |
190 | 190 |
191 bool LocalFileUtil::PathExists( | |
192 FileSystemOperationContext* context, | |
193 const FileSystemURL& url) { | |
194 FilePath file_path; | |
195 if (GetLocalFilePath(context, url, &file_path) != base::PLATFORM_FILE_OK) | |
196 return false; | |
197 return NativeFileUtil::PathExists(file_path); | |
198 } | |
199 | |
200 bool LocalFileUtil::DirectoryExists( | |
201 FileSystemOperationContext* context, | |
202 const FileSystemURL& url) { | |
203 FilePath file_path; | |
204 if (GetLocalFilePath(context, url, &file_path) != base::PLATFORM_FILE_OK) | |
205 return false; | |
206 return NativeFileUtil::DirectoryExists(file_path); | |
207 } | |
208 | |
209 bool LocalFileUtil::IsDirectoryEmpty( | 191 bool LocalFileUtil::IsDirectoryEmpty( |
210 FileSystemOperationContext* context, | 192 FileSystemOperationContext* context, |
211 const FileSystemURL& url) { | 193 const FileSystemURL& url) { |
212 FilePath file_path; | 194 FilePath file_path; |
213 if (GetLocalFilePath(context, url, &file_path) != base::PLATFORM_FILE_OK) | 195 if (GetLocalFilePath(context, url, &file_path) != base::PLATFORM_FILE_OK) |
214 return true; | 196 return true; |
215 return NativeFileUtil::IsDirectoryEmpty(file_path); | 197 return NativeFileUtil::IsDirectoryEmpty(file_path); |
216 } | 198 } |
217 | 199 |
218 PlatformFileError LocalFileUtil::CopyOrMoveFile( | 200 PlatformFileError LocalFileUtil::CopyOrMoveFile( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 base::PlatformFileInfo* file_info, | 257 base::PlatformFileInfo* file_info, |
276 FilePath* platform_path, | 258 FilePath* platform_path, |
277 SnapshotFilePolicy* policy) { | 259 SnapshotFilePolicy* policy) { |
278 DCHECK(policy); | 260 DCHECK(policy); |
279 // We're just returning the local file information. | 261 // We're just returning the local file information. |
280 *policy = kSnapshotFileLocal; | 262 *policy = kSnapshotFileLocal; |
281 return GetFileInfo(context, url, file_info, platform_path); | 263 return GetFileInfo(context, url, file_info, platform_path); |
282 } | 264 } |
283 | 265 |
284 } // namespace fileapi | 266 } // namespace fileapi |
OLD | NEW |