Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 const FileSystemOptions& options) | 61 const FileSystemOptions& options) |
| 61 : task_runners_(task_runners.Pass()), | 62 : task_runners_(task_runners.Pass()), |
| 62 quota_manager_proxy_(quota_manager_proxy), | 63 quota_manager_proxy_(quota_manager_proxy), |
| 63 sandbox_provider_( | 64 sandbox_provider_( |
| 64 new SandboxMountPointProvider( | 65 new SandboxMountPointProvider( |
| 65 quota_manager_proxy, | 66 quota_manager_proxy, |
| 66 task_runners_->file_task_runner(), | 67 task_runners_->file_task_runner(), |
| 67 partition_path, | 68 partition_path, |
| 68 options)), | 69 options)), |
| 69 isolated_provider_(new IsolatedMountPointProvider(partition_path)), | 70 isolated_provider_(new IsolatedMountPointProvider(partition_path)), |
| 70 partition_path_(partition_path) { | 71 partition_path_(partition_path), |
| 72 // TODO(tbarzic): Pass this from upper levels. | |
| 73 external_mount_points_(fileapi::ExternalMountPoints::CreateRefCounted()) { | |
|
kinuko
2013/01/08 12:22:43
Can we drop this change from this CL? It doesn't s
tbarzic
2013/01/09 01:26:34
Done.
| |
| 71 DCHECK(task_runners_.get()); | 74 DCHECK(task_runners_.get()); |
| 72 | 75 |
| 73 if (quota_manager_proxy) { | 76 if (quota_manager_proxy) { |
| 74 quota_manager_proxy->RegisterClient(CreateQuotaClient( | 77 quota_manager_proxy->RegisterClient(CreateQuotaClient( |
| 75 this, options.is_incognito())); | 78 this, options.is_incognito())); |
| 76 } | 79 } |
| 77 #if defined(OS_CHROMEOS) | 80 #if defined(OS_CHROMEOS) |
| 78 external_provider_.reset( | 81 external_provider_.reset( |
| 79 new chromeos::CrosMountPointProvider(special_storage_policy)); | 82 new chromeos::CrosMountPointProvider( |
| 83 special_storage_policy, | |
| 84 // TODO(tbarzic): Switch this to |external_mount_points_|. | |
| 85 fileapi::ExternalMountPoints::GetSystemInstance(), | |
| 86 fileapi::ExternalMountPoints::GetSystemInstance())); | |
|
kinuko
2013/01/08 12:22:43
ditto.
tbarzic
2013/01/09 01:26:34
I'd rather leave this (this cl does separate syste
| |
| 80 #endif | 87 #endif |
| 81 } | 88 } |
| 82 | 89 |
| 83 bool FileSystemContext::DeleteDataForOriginOnFileThread( | 90 bool FileSystemContext::DeleteDataForOriginOnFileThread( |
| 84 const GURL& origin_url) { | 91 const GURL& origin_url) { |
| 85 DCHECK(task_runners_->file_task_runner()->RunsTasksOnCurrentThread()); | 92 DCHECK(task_runners_->file_task_runner()->RunsTasksOnCurrentThread()); |
| 86 DCHECK(sandbox_provider()); | 93 DCHECK(sandbox_provider()); |
| 87 DCHECK(origin_url == origin_url.GetOrigin()); | 94 DCHECK(origin_url == origin_url.GetOrigin()); |
| 88 | 95 |
| 89 // Delete temporary and persistent data. | 96 // 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); | 244 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); |
| 238 } | 245 } |
| 239 | 246 |
| 240 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( | 247 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( |
| 241 const FileSystemURL& url, PlatformFileError* error_code) { | 248 const FileSystemURL& url, PlatformFileError* error_code) { |
| 242 if (!url.is_valid()) { | 249 if (!url.is_valid()) { |
| 243 if (error_code) | 250 if (error_code) |
| 244 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; | 251 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; |
| 245 return NULL; | 252 return NULL; |
| 246 } | 253 } |
| 254 | |
| 247 FileSystemMountPointProvider* mount_point_provider = | 255 FileSystemMountPointProvider* mount_point_provider = |
| 248 GetMountPointProvider(url.type()); | 256 GetMountPointProvider(url.type()); |
| 249 if (!mount_point_provider) { | 257 if (!mount_point_provider) { |
| 250 if (error_code) | 258 if (error_code) |
| 251 *error_code = base::PLATFORM_FILE_ERROR_FAILED; | 259 *error_code = base::PLATFORM_FILE_ERROR_FAILED; |
| 252 return NULL; | 260 return NULL; |
| 253 } | 261 } |
| 254 | 262 |
| 255 PlatformFileError fs_error = base::PLATFORM_FILE_OK; | 263 PlatformFileError fs_error = base::PLATFORM_FILE_OK; |
| 256 FileSystemOperation* operation = | 264 FileSystemOperation* operation = |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 318 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
| 311 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 319 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
| 312 return; | 320 return; |
| 313 } | 321 } |
| 314 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 322 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
| 315 provider_map_.end()); | 323 provider_map_.end()); |
| 316 delete this; | 324 delete this; |
| 317 } | 325 } |
| 318 | 326 |
| 319 } // namespace fileapi | 327 } // namespace fileapi |
| OLD | NEW |