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" | |
9 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
10 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
11 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
12 #include "webkit/fileapi/file_system_file_util.h" | 11 #include "webkit/fileapi/file_system_file_util.h" |
13 #include "webkit/fileapi/file_system_operation.h" | 12 #include "webkit/fileapi/file_system_operation.h" |
14 #include "webkit/fileapi/file_system_options.h" | 13 #include "webkit/fileapi/file_system_options.h" |
15 #include "webkit/fileapi/file_system_quota_client.h" | 14 #include "webkit/fileapi/file_system_quota_client.h" |
16 #include "webkit/fileapi/file_system_task_runners.h" | 15 #include "webkit/fileapi/file_system_task_runners.h" |
17 #include "webkit/fileapi/file_system_url.h" | 16 #include "webkit/fileapi/file_system_url.h" |
18 #include "webkit/fileapi/file_system_util.h" | 17 #include "webkit/fileapi/file_system_util.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 GetMountPointProvider(type); | 230 GetMountPointProvider(type); |
232 if (!mount_point_provider) { | 231 if (!mount_point_provider) { |
233 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); | 232 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
234 return; | 233 return; |
235 } | 234 } |
236 | 235 |
237 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); | 236 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); |
238 } | 237 } |
239 | 238 |
240 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( | 239 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( |
241 const FileSystemURL& url, PlatformFileError* error_code) { | 240 const FileSystemURL& url, base::PlatformFileError* error_code) { |
242 if (!url.is_valid()) { | 241 if (!url.is_valid()) { |
243 if (error_code) | 242 if (error_code) |
244 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; | 243 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; |
245 return NULL; | 244 return NULL; |
246 } | 245 } |
247 FileSystemMountPointProvider* mount_point_provider = | 246 FileSystemMountPointProvider* mount_point_provider = |
248 GetMountPointProvider(url.type()); | 247 GetMountPointProvider(url.type()); |
249 if (!mount_point_provider) { | 248 if (!mount_point_provider) { |
250 if (error_code) | 249 if (error_code) |
251 *error_code = base::PLATFORM_FILE_ERROR_FAILED; | 250 *error_code = base::PLATFORM_FILE_ERROR_FAILED; |
252 return NULL; | 251 return NULL; |
253 } | 252 } |
254 | 253 |
255 PlatformFileError fs_error = base::PLATFORM_FILE_OK; | 254 base::PlatformFileError fs_error = base::PLATFORM_FILE_OK; |
256 FileSystemOperation* operation = | 255 FileSystemOperation* operation = |
257 mount_point_provider->CreateFileSystemOperation(url, this, &fs_error); | 256 mount_point_provider->CreateFileSystemOperation(url, this, &fs_error); |
258 | 257 |
259 if (error_code) | 258 if (error_code) |
260 *error_code = fs_error; | 259 *error_code = fs_error; |
261 return operation; | 260 return operation; |
262 } | 261 } |
263 | 262 |
264 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( | 263 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( |
265 const FileSystemURL& url, | 264 const FileSystemURL& url, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 309 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
311 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 310 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
312 return; | 311 return; |
313 } | 312 } |
314 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 313 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
315 provider_map_.end()); | 314 provider_map_.end()); |
316 delete this; | 315 delete this; |
317 } | 316 } |
318 | 317 |
319 } // namespace fileapi | 318 } // namespace fileapi |
OLD | NEW |