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