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/local_file_util.h" | 5 #include "webkit/browser/fileapi/local_file_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_util_proxy.h" | 8 #include "base/files/file_util_proxy.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "webkit/browser/fileapi/file_system_context.h" | 10 #include "webkit/browser/fileapi/file_system_context.h" |
11 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | |
12 #include "webkit/browser/fileapi/file_system_operation_context.h" | 11 #include "webkit/browser/fileapi/file_system_operation_context.h" |
13 #include "webkit/browser/fileapi/file_system_url.h" | 12 #include "webkit/browser/fileapi/file_system_url.h" |
14 #include "webkit/browser/fileapi/native_file_util.h" | 13 #include "webkit/browser/fileapi/native_file_util.h" |
15 #include "webkit/common/fileapi/file_system_types.h" | 14 #include "webkit/common/fileapi/file_system_types.h" |
16 #include "webkit/common/fileapi/file_system_util.h" | 15 #include "webkit/common/fileapi/file_system_util.h" |
17 | 16 |
18 namespace fileapi { | 17 namespace fileapi { |
19 | 18 |
20 using base::PlatformFileError; | 19 using base::PlatformFileError; |
21 | 20 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 file_path, root_url.path(), | 153 file_path, root_url.path(), |
155 file_util::FileEnumerator::FILES | | 154 file_util::FileEnumerator::FILES | |
156 file_util::FileEnumerator::DIRECTORIES)) | 155 file_util::FileEnumerator::DIRECTORIES)) |
157 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); | 156 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); |
158 } | 157 } |
159 | 158 |
160 PlatformFileError LocalFileUtil::GetLocalFilePath( | 159 PlatformFileError LocalFileUtil::GetLocalFilePath( |
161 FileSystemOperationContext* context, | 160 FileSystemOperationContext* context, |
162 const FileSystemURL& url, | 161 const FileSystemURL& url, |
163 base::FilePath* local_file_path) { | 162 base::FilePath* local_file_path) { |
164 FileSystemMountPointProvider* provider = | |
165 context->file_system_context()->GetMountPointProvider(url.type()); | |
166 DCHECK(provider); | |
167 base::FilePath root = context->root_path(); | 163 base::FilePath root = context->root_path(); |
168 if (root.empty()) | 164 if (root.empty()) |
169 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 165 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
170 *local_file_path = root.Append(url.path()); | 166 *local_file_path = root.Append(url.path()); |
171 return base::PLATFORM_FILE_OK; | 167 return base::PLATFORM_FILE_OK; |
172 } | 168 } |
173 | 169 |
174 PlatformFileError LocalFileUtil::Touch( | 170 PlatformFileError LocalFileUtil::Touch( |
175 FileSystemOperationContext* context, | 171 FileSystemOperationContext* context, |
176 const FileSystemURL& url, | 172 const FileSystemURL& url, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 base::FilePath* platform_path) { | 251 base::FilePath* platform_path) { |
256 DCHECK(file_info); | 252 DCHECK(file_info); |
257 // We're just returning the local file information. | 253 // We're just returning the local file information. |
258 *error = GetFileInfo(context, url, file_info, platform_path); | 254 *error = GetFileInfo(context, url, file_info, platform_path); |
259 if (*error == base::PLATFORM_FILE_OK && file_info->is_directory) | 255 if (*error == base::PLATFORM_FILE_OK && file_info->is_directory) |
260 *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE; | 256 *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE; |
261 return webkit_blob::ScopedFile(); | 257 return webkit_blob::ScopedFile(); |
262 } | 258 } |
263 | 259 |
264 } // namespace fileapi | 260 } // namespace fileapi |
OLD | NEW |