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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 case kFileSystemTypeExternal: | 135 case kFileSystemTypeExternal: |
131 case kFileSystemTypeDrive: | 136 case kFileSystemTypeDrive: |
132 case kFileSystemTypeRestrictedNativeLocal: | 137 case kFileSystemTypeRestrictedNativeLocal: |
133 return external_provider_.get(); | 138 return external_provider_.get(); |
134 case kFileSystemTypeIsolated: | 139 case kFileSystemTypeIsolated: |
135 case kFileSystemTypeDragged: | 140 case kFileSystemTypeDragged: |
136 case kFileSystemTypeNativeMedia: | 141 case kFileSystemTypeNativeMedia: |
137 case kFileSystemTypeDeviceMedia: | 142 case kFileSystemTypeDeviceMedia: |
138 return isolated_provider_.get(); | 143 return isolated_provider_.get(); |
139 case kFileSystemTypeNativeLocal: | 144 case kFileSystemTypeNativeLocal: |
140 #if defined(OS_CHROMEOS) | |
141 return external_provider_.get(); | 145 return external_provider_.get(); |
142 #else | 146 case kFileSystemTypeIsolatedNativeLocal: |
143 return isolated_provider_.get(); | 147 return isolated_provider_.get(); |
144 #endif | |
145 default: | 148 default: |
146 if (provider_map_.find(type) != provider_map_.end()) | 149 if (provider_map_.find(type) != provider_map_.end()) |
147 return provider_map_.find(type)->second; | 150 return provider_map_.find(type)->second; |
148 // Fall through. | 151 // Fall through. |
149 case kFileSystemTypeUnknown: | 152 case kFileSystemTypeUnknown: |
150 NOTREACHED(); | 153 NOTREACHED(); |
151 return NULL; | 154 return NULL; |
152 } | 155 } |
153 } | 156 } |
154 | 157 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); | 240 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); |
238 } | 241 } |
239 | 242 |
240 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( | 243 FileSystemOperation* FileSystemContext::CreateFileSystemOperation( |
241 const FileSystemURL& url, PlatformFileError* error_code) { | 244 const FileSystemURL& url, PlatformFileError* error_code) { |
242 if (!url.is_valid()) { | 245 if (!url.is_valid()) { |
243 if (error_code) | 246 if (error_code) |
244 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; | 247 *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; |
245 return NULL; | 248 return NULL; |
246 } | 249 } |
| 250 |
247 FileSystemMountPointProvider* mount_point_provider = | 251 FileSystemMountPointProvider* mount_point_provider = |
248 GetMountPointProvider(url.type()); | 252 GetMountPointProvider(url.type()); |
249 if (!mount_point_provider) { | 253 if (!mount_point_provider) { |
250 if (error_code) | 254 if (error_code) |
251 *error_code = base::PLATFORM_FILE_ERROR_FAILED; | 255 *error_code = base::PLATFORM_FILE_ERROR_FAILED; |
252 return NULL; | 256 return NULL; |
253 } | 257 } |
254 | 258 |
255 PlatformFileError fs_error = base::PLATFORM_FILE_OK; | 259 PlatformFileError fs_error = base::PLATFORM_FILE_OK; |
256 FileSystemOperation* operation = | 260 FileSystemOperation* operation = |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && | 314 if (!task_runners_->io_task_runner()->RunsTasksOnCurrentThread() && |
311 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { | 315 task_runners_->io_task_runner()->DeleteSoon(FROM_HERE, this)) { |
312 return; | 316 return; |
313 } | 317 } |
314 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 318 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
315 provider_map_.end()); | 319 provider_map_.end()); |
316 delete this; | 320 delete this; |
317 } | 321 } |
318 | 322 |
319 } // namespace fileapi | 323 } // namespace fileapi |
OLD | NEW |