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 "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/file_util_proxy.h" | 9 #include "base/files/file_util_proxy.h" |
10 #include "storage/browser/fileapi/async_file_util_adapter.h" | 10 #include "storage/browser/fileapi/async_file_util_adapter.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 return error; | 132 return error; |
133 } | 133 } |
134 | 134 |
135 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> LocalFileUtil:: | 135 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> LocalFileUtil:: |
136 CreateFileEnumerator( | 136 CreateFileEnumerator( |
137 FileSystemOperationContext* context, | 137 FileSystemOperationContext* context, |
138 const FileSystemURL& root_url) { | 138 const FileSystemURL& root_url) { |
139 base::FilePath file_path; | 139 base::FilePath file_path; |
140 if (GetLocalFilePath(context, root_url, &file_path) != | 140 if (GetLocalFilePath(context, root_url, &file_path) != |
141 base::File::FILE_OK) { | 141 base::File::FILE_OK) { |
142 return make_scoped_ptr(new EmptyFileEnumerator) | 142 return make_scoped_ptr(new EmptyFileEnumerator); |
143 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); | |
144 } | 143 } |
145 return make_scoped_ptr(new LocalFileEnumerator( | 144 return make_scoped_ptr(new LocalFileEnumerator( |
146 file_path, root_url.path(), | 145 file_path, |
147 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)) | 146 root_url.path(), |
148 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); | 147 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)); |
149 } | 148 } |
150 | 149 |
151 base::File::Error LocalFileUtil::GetLocalFilePath( | 150 base::File::Error LocalFileUtil::GetLocalFilePath( |
152 FileSystemOperationContext* context, | 151 FileSystemOperationContext* context, |
153 const FileSystemURL& url, | 152 const FileSystemURL& url, |
154 base::FilePath* local_file_path) { | 153 base::FilePath* local_file_path) { |
155 DCHECK(local_file_path); | 154 DCHECK(local_file_path); |
156 DCHECK(url.is_valid()); | 155 DCHECK(url.is_valid()); |
157 if (url.path().empty()) { | 156 if (url.path().empty()) { |
158 // Root direcory case, which should not be accessed. | 157 // Root direcory case, which should not be accessed. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 base::FilePath* platform_path) { | 255 base::FilePath* platform_path) { |
257 DCHECK(file_info); | 256 DCHECK(file_info); |
258 // We're just returning the local file information. | 257 // We're just returning the local file information. |
259 *error = GetFileInfo(context, url, file_info, platform_path); | 258 *error = GetFileInfo(context, url, file_info, platform_path); |
260 if (*error == base::File::FILE_OK && file_info->is_directory) | 259 if (*error == base::File::FILE_OK && file_info->is_directory) |
261 *error = base::File::FILE_ERROR_NOT_A_FILE; | 260 *error = base::File::FILE_ERROR_NOT_A_FILE; |
262 return storage::ScopedFile(); | 261 return storage::ScopedFile(); |
263 } | 262 } |
264 | 263 |
265 } // namespace storage | 264 } // namespace storage |
OLD | NEW |