| 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 "storage/browser/fileapi/local_file_util.h" | 5 #include "storage/browser/fileapi/local_file_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 | 139 |
| 140 std::unique_ptr<FileSystemFileUtil::AbstractFileEnumerator> | 140 std::unique_ptr<FileSystemFileUtil::AbstractFileEnumerator> |
| 141 LocalFileUtil::CreateFileEnumerator(FileSystemOperationContext* context, | 141 LocalFileUtil::CreateFileEnumerator(FileSystemOperationContext* context, |
| 142 const FileSystemURL& root_url) { | 142 const FileSystemURL& root_url) { |
| 143 base::FilePath file_path; | 143 base::FilePath file_path; |
| 144 if (GetLocalFilePath(context, root_url, &file_path) != | 144 if (GetLocalFilePath(context, root_url, &file_path) != |
| 145 base::File::FILE_OK) { | 145 base::File::FILE_OK) { |
| 146 return base::WrapUnique(new EmptyFileEnumerator); | 146 return base::WrapUnique(new EmptyFileEnumerator); |
| 147 } | 147 } |
| 148 return base::WrapUnique(new LocalFileEnumerator( | 148 return base::MakeUnique<LocalFileEnumerator>( |
| 149 file_path, root_url.path(), | 149 file_path, root_url.path(), |
| 150 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)); | 150 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); |
| 151 } | 151 } |
| 152 | 152 |
| 153 base::File::Error LocalFileUtil::GetLocalFilePath( | 153 base::File::Error LocalFileUtil::GetLocalFilePath( |
| 154 FileSystemOperationContext* context, | 154 FileSystemOperationContext* context, |
| 155 const FileSystemURL& url, | 155 const FileSystemURL& url, |
| 156 base::FilePath* local_file_path) { | 156 base::FilePath* local_file_path) { |
| 157 DCHECK(local_file_path); | 157 DCHECK(local_file_path); |
| 158 DCHECK(url.is_valid()); | 158 DCHECK(url.is_valid()); |
| 159 if (url.path().empty()) { | 159 if (url.path().empty()) { |
| 160 // Root direcory case, which should not be accessed. | 160 // Root direcory case, which should not be accessed. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 base::FilePath* platform_path) { | 257 base::FilePath* platform_path) { |
| 258 DCHECK(file_info); | 258 DCHECK(file_info); |
| 259 // We're just returning the local file information. | 259 // We're just returning the local file information. |
| 260 *error = GetFileInfo(context, url, file_info, platform_path); | 260 *error = GetFileInfo(context, url, file_info, platform_path); |
| 261 if (*error == base::File::FILE_OK && file_info->is_directory) | 261 if (*error == base::File::FILE_OK && file_info->is_directory) |
| 262 *error = base::File::FILE_ERROR_NOT_A_FILE; | 262 *error = base::File::FILE_ERROR_NOT_A_FILE; |
| 263 return storage::ScopedFile(); | 263 return storage::ScopedFile(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace storage | 266 } // namespace storage |
| OLD | NEW |