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 "webkit/browser/fileapi/file_system_operation_context.h" | 10 #include "webkit/browser/fileapi/file_system_operation_context.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 return base::PLATFORM_FILE_OK; | 150 return base::PLATFORM_FILE_OK; |
151 } | 151 } |
152 | 152 |
153 PlatformFileError NativeFileUtil::GetFileInfo( | 153 PlatformFileError NativeFileUtil::GetFileInfo( |
154 const base::FilePath& path, | 154 const base::FilePath& path, |
155 base::PlatformFileInfo* file_info) { | 155 base::PlatformFileInfo* file_info) { |
156 if (!base::PathExists(path)) | 156 if (!base::PathExists(path)) |
157 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 157 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
158 if (!file_util::GetFileInfo(path, file_info)) | 158 if (!base::GetFileInfo(path, file_info)) |
159 return base::PLATFORM_FILE_ERROR_FAILED; | 159 return base::PLATFORM_FILE_ERROR_FAILED; |
160 return base::PLATFORM_FILE_OK; | 160 return base::PLATFORM_FILE_OK; |
161 } | 161 } |
162 | 162 |
163 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> | 163 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> |
164 NativeFileUtil::CreateFileEnumerator(const base::FilePath& root_path, | 164 NativeFileUtil::CreateFileEnumerator(const base::FilePath& root_path, |
165 bool recursive) { | 165 bool recursive) { |
166 return make_scoped_ptr(new NativeFileEnumerator( | 166 return make_scoped_ptr(new NativeFileEnumerator( |
167 root_path, recursive, | 167 root_path, recursive, |
168 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)) | 168 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 if (!base::DirectoryExists(path)) | 265 if (!base::DirectoryExists(path)) |
266 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; | 266 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; |
267 if (!base::IsDirectoryEmpty(path)) | 267 if (!base::IsDirectoryEmpty(path)) |
268 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; | 268 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; |
269 if (!base::DeleteFile(path, false)) | 269 if (!base::DeleteFile(path, false)) |
270 return base::PLATFORM_FILE_ERROR_FAILED; | 270 return base::PLATFORM_FILE_ERROR_FAILED; |
271 return base::PLATFORM_FILE_OK; | 271 return base::PLATFORM_FILE_OK; |
272 } | 272 } |
273 | 273 |
274 } // namespace fileapi | 274 } // namespace fileapi |
OLD | NEW |