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" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "webkit/fileapi/external_mount_points.h" |
12 #include "webkit/fileapi/file_system_file_util.h" | 13 #include "webkit/fileapi/file_system_file_util.h" |
13 #include "webkit/fileapi/file_system_operation.h" | 14 #include "webkit/fileapi/file_system_operation.h" |
14 #include "webkit/fileapi/file_system_options.h" | 15 #include "webkit/fileapi/file_system_options.h" |
15 #include "webkit/fileapi/file_system_quota_client.h" | 16 #include "webkit/fileapi/file_system_quota_client.h" |
16 #include "webkit/fileapi/file_system_task_runners.h" | 17 #include "webkit/fileapi/file_system_task_runners.h" |
17 #include "webkit/fileapi/file_system_url.h" | 18 #include "webkit/fileapi/file_system_url.h" |
18 #include "webkit/fileapi/file_system_util.h" | 19 #include "webkit/fileapi/file_system_util.h" |
19 #include "webkit/fileapi/isolated_context.h" | 20 #include "webkit/fileapi/isolated_context.h" |
20 #include "webkit/fileapi/isolated_mount_point_provider.h" | 21 #include "webkit/fileapi/isolated_mount_point_provider.h" |
21 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 22 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 isolated_provider_(new IsolatedMountPointProvider(partition_path)), | 70 isolated_provider_(new IsolatedMountPointProvider(partition_path)), |
70 partition_path_(partition_path) { | 71 partition_path_(partition_path) { |
71 DCHECK(task_runners_.get()); | 72 DCHECK(task_runners_.get()); |
72 | 73 |
73 if (quota_manager_proxy) { | 74 if (quota_manager_proxy) { |
74 quota_manager_proxy->RegisterClient(CreateQuotaClient( | 75 quota_manager_proxy->RegisterClient(CreateQuotaClient( |
75 this, options.is_incognito())); | 76 this, options.is_incognito())); |
76 } | 77 } |
77 #if defined(OS_CHROMEOS) | 78 #if defined(OS_CHROMEOS) |
78 external_provider_.reset( | 79 external_provider_.reset( |
79 new chromeos::CrosMountPointProvider(special_storage_policy)); | 80 new chromeos::CrosMountPointProvider( |
| 81 special_storage_policy, |
| 82 // TODO(tbarzic): Switch this to |external_mount_points_|. |
| 83 fileapi::ExternalMountPoints::GetSystemInstance(), |
| 84 fileapi::ExternalMountPoints::GetSystemInstance())); |
80 #endif | 85 #endif |
81 } | 86 } |
82 | 87 |
83 bool FileSystemContext::DeleteDataForOriginOnFileThread( | 88 bool FileSystemContext::DeleteDataForOriginOnFileThread( |
84 const GURL& origin_url) { | 89 const GURL& origin_url) { |
85 DCHECK(task_runners_->file_task_runner()->RunsTasksOnCurrentThread()); | 90 DCHECK(task_runners_->file_task_runner()->RunsTasksOnCurrentThread()); |
86 DCHECK(sandbox_provider()); | 91 DCHECK(sandbox_provider()); |
87 DCHECK(origin_url == origin_url.GetOrigin()); | 92 DCHECK(origin_url == origin_url.GetOrigin()); |
88 | 93 |
89 // Delete temporary and persistent data. | 94 // Delete temporary and persistent data. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); | 242 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); |
238 } | 243 } |
239 | 244 |
240 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( | 245 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( |
241 const FileSystemURL& url, PlatformFileError* error_code) { | 246 const FileSystemURL& url, PlatformFileError* error_code) { |
242 if (!url.is_valid()) { | 247 if (!url.is_valid()) { |
243 if (error_code) | 248 if (error_code) |
244 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; | 249 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; |
245 return NULL; | 250 return NULL; |
246 } | 251 } |
| 252 |
247 FileSystemMountPointProvider* mount_point_provider = | 253 FileSystemMountPointProvider* mount_point_provider = |
248 GetMountPointProvider(url.type()); | 254 GetMountPointProvider(url.type()); |
249 if (!mount_point_provider) { | 255 if (!mount_point_provider) { |
250 if (error_code) | 256 if (error_code) |
251 *error_code = base::PLATFORM_FILE_ERROR_FAILED; | 257 *error_code = base::PLATFORM_FILE_ERROR_FAILED; |
252 return NULL; | 258 return NULL; |
253 } | 259 } |
254 | 260 |
255 PlatformFileError fs_error = base::PLATFORM_FILE_OK; | 261 PlatformFileError fs_error = base::PLATFORM_FILE_OK; |
256 FileSystemOperation* operation = | 262 FileSystemOperation* operation = |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 316 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
311 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 317 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
312 return; | 318 return; |
313 } | 319 } |
314 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 320 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
315 provider_map_.end()); | 321 provider_map_.end()); |
316 delete this; | 322 delete this; |
317 } | 323 } |
318 | 324 |
319 } // namespace fileapi | 325 } // namespace fileapi |
OLD | NEW |