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/browser/fileapi/native_file_util.h" | 5 #include "webkit/browser/fileapi/native_file_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 | 196 |
197 return base::PLATFORM_FILE_OK; | 197 return base::PLATFORM_FILE_OK; |
198 } | 198 } |
199 | 199 |
200 PlatformFileError NativeFileUtil::GetFileInfo( | 200 PlatformFileError NativeFileUtil::GetFileInfo( |
201 const base::FilePath& path, | 201 const base::FilePath& path, |
202 base::PlatformFileInfo* file_info) { | 202 base::PlatformFileInfo* file_info) { |
203 if (!base::PathExists(path)) | 203 if (!base::PathExists(path)) |
204 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 204 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
205 if (!base::GetFileInfo(path, file_info)) | 205 |
| 206 // TODO(rvargas): convert this code to use base::File. |
| 207 if (!base::GetFileInfo(path, reinterpret_cast<base::File::Info*>(file_info))) |
206 return base::PLATFORM_FILE_ERROR_FAILED; | 208 return base::PLATFORM_FILE_ERROR_FAILED; |
207 return base::PLATFORM_FILE_OK; | 209 return base::PLATFORM_FILE_OK; |
208 } | 210 } |
209 | 211 |
210 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> | 212 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> |
211 NativeFileUtil::CreateFileEnumerator(const base::FilePath& root_path, | 213 NativeFileUtil::CreateFileEnumerator(const base::FilePath& root_path, |
212 bool recursive) { | 214 bool recursive) { |
213 return make_scoped_ptr(new NativeFileEnumerator( | 215 return make_scoped_ptr(new NativeFileEnumerator( |
214 root_path, recursive, | 216 root_path, recursive, |
215 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)) | 217 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)) |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 if (!base::DirectoryExists(path)) | 320 if (!base::DirectoryExists(path)) |
319 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; | 321 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; |
320 if (!base::IsDirectoryEmpty(path)) | 322 if (!base::IsDirectoryEmpty(path)) |
321 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; | 323 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; |
322 if (!base::DeleteFile(path, false)) | 324 if (!base::DeleteFile(path, false)) |
323 return base::PLATFORM_FILE_ERROR_FAILED; | 325 return base::PLATFORM_FILE_ERROR_FAILED; |
324 return base::PLATFORM_FILE_OK; | 326 return base::PLATFORM_FILE_OK; |
325 } | 327 } |
326 | 328 |
327 } // namespace fileapi | 329 } // namespace fileapi |
OLD | NEW |