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/fileapi/file_system_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 GetMountPointProvider(type); | 195 GetMountPointProvider(type); |
196 if (!mount_point_provider) { | 196 if (!mount_point_provider) { |
197 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); | 197 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
198 return; | 198 return; |
199 } | 199 } |
200 | 200 |
201 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); | 201 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); |
202 } | 202 } |
203 | 203 |
204 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( | 204 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( |
205 const FileSystemURL& url) { | 205 const FileSystemURL& url, PlatformFileError* error_code) { |
206 if (!url.is_valid()) | 206 if (!url.is_valid()) { |
| 207 if (error_code) |
| 208 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; |
207 return NULL; | 209 return NULL; |
| 210 } |
208 FileSystemMountPointProvider* mount_point_provider = | 211 FileSystemMountPointProvider* mount_point_provider = |
209 GetMountPointProvider(url.type()); | 212 GetMountPointProvider(url.type()); |
210 if (!mount_point_provider) | 213 if (!mount_point_provider) { |
| 214 if (error_code) |
| 215 *error_code = base::PLATFORM_FILE_ERROR_FAILED; |
211 return NULL; | 216 return NULL; |
| 217 } |
| 218 |
| 219 if (error_code) |
| 220 *error_code = base::PLATFORM_FILE_OK; |
212 return mount_point_provider->CreateFileSystemOperation(url, this); | 221 return mount_point_provider->CreateFileSystemOperation(url, this); |
213 } | 222 } |
214 | 223 |
215 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( | 224 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( |
216 const FileSystemURL& url, | 225 const FileSystemURL& url, |
217 int64 offset) { | 226 int64 offset) { |
218 if (!url.is_valid()) | 227 if (!url.is_valid()) |
219 return NULL; | 228 return NULL; |
220 FileSystemMountPointProvider* mount_point_provider = | 229 FileSystemMountPointProvider* mount_point_provider = |
221 GetMountPointProvider(url.type()); | 230 GetMountPointProvider(url.type()); |
(...skipping 16 matching lines...) Expand all Loading... |
238 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 247 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
239 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 248 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
240 return; | 249 return; |
241 } | 250 } |
242 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 251 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
243 provider_map_.end()); | 252 provider_map_.end()); |
244 delete this; | 253 delete this; |
245 } | 254 } |
246 | 255 |
247 } // namespace fileapi | 256 } // namespace fileapi |
OLD | NEW |