| 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 "storage/browser/fileapi/file_system_context.h" | 5 #include "storage/browser/fileapi/file_system_context.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 NOTREACHED(); | 138 NOTREACHED(); |
| 139 return FILE_PERMISSION_ALWAYS_DENY; | 139 return FILE_PERMISSION_ALWAYS_DENY; |
| 140 } | 140 } |
| 141 | 141 |
| 142 FileSystemContext::FileSystemContext( | 142 FileSystemContext::FileSystemContext( |
| 143 base::SingleThreadTaskRunner* io_task_runner, | 143 base::SingleThreadTaskRunner* io_task_runner, |
| 144 base::SequencedTaskRunner* file_task_runner, | 144 base::SequencedTaskRunner* file_task_runner, |
| 145 ExternalMountPoints* external_mount_points, | 145 ExternalMountPoints* external_mount_points, |
| 146 storage::SpecialStoragePolicy* special_storage_policy, | 146 storage::SpecialStoragePolicy* special_storage_policy, |
| 147 storage::QuotaManagerProxy* quota_manager_proxy, | 147 storage::QuotaManagerProxy* quota_manager_proxy, |
| 148 ScopedVector<FileSystemBackend> additional_backends, | 148 std::vector<std::unique_ptr<FileSystemBackend>> additional_backends, |
| 149 const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers, | 149 const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers, |
| 150 const base::FilePath& partition_path, | 150 const base::FilePath& partition_path, |
| 151 const FileSystemOptions& options) | 151 const FileSystemOptions& options) |
| 152 : io_task_runner_(io_task_runner), | 152 : io_task_runner_(io_task_runner), |
| 153 default_file_task_runner_(file_task_runner), | 153 default_file_task_runner_(file_task_runner), |
| 154 quota_manager_proxy_(quota_manager_proxy), | 154 quota_manager_proxy_(quota_manager_proxy), |
| 155 sandbox_delegate_( | 155 sandbox_delegate_( |
| 156 new SandboxFileSystemBackendDelegate(quota_manager_proxy, | 156 new SandboxFileSystemBackendDelegate(quota_manager_proxy, |
| 157 file_task_runner, | 157 file_task_runner, |
| 158 partition_path, | 158 partition_path, |
| 159 special_storage_policy, | 159 special_storage_policy, |
| 160 options)), | 160 options)), |
| 161 sandbox_backend_(new SandboxFileSystemBackend(sandbox_delegate_.get())), | 161 sandbox_backend_(new SandboxFileSystemBackend(sandbox_delegate_.get())), |
| 162 plugin_private_backend_( | 162 plugin_private_backend_( |
| 163 new PluginPrivateFileSystemBackend(file_task_runner, | 163 new PluginPrivateFileSystemBackend(file_task_runner, |
| 164 partition_path, | 164 partition_path, |
| 165 special_storage_policy, | 165 special_storage_policy, |
| 166 options)), | 166 options)), |
| 167 additional_backends_(std::move(additional_backends)), | 167 additional_backends_(std::move(additional_backends)), |
| 168 auto_mount_handlers_(auto_mount_handlers), | 168 auto_mount_handlers_(auto_mount_handlers), |
| 169 external_mount_points_(external_mount_points), | 169 external_mount_points_(external_mount_points), |
| 170 partition_path_(partition_path), | 170 partition_path_(partition_path), |
| 171 is_incognito_(options.is_incognito()), | 171 is_incognito_(options.is_incognito()), |
| 172 operation_runner_(new FileSystemOperationRunner(this)) { | 172 operation_runner_(new FileSystemOperationRunner(this)) { |
| 173 RegisterBackend(sandbox_backend_.get()); | 173 RegisterBackend(sandbox_backend_.get()); |
| 174 RegisterBackend(plugin_private_backend_.get()); | 174 RegisterBackend(plugin_private_backend_.get()); |
| 175 | 175 |
| 176 for (ScopedVector<FileSystemBackend>::const_iterator iter = | 176 for (const auto& backend : additional_backends_) |
| 177 additional_backends_.begin(); | 177 RegisterBackend(backend.get()); |
| 178 iter != additional_backends_.end(); ++iter) { | |
| 179 RegisterBackend(*iter); | |
| 180 } | |
| 181 | 178 |
| 182 // If the embedder's additional backends already provide support for | 179 // If the embedder's additional backends already provide support for |
| 183 // kFileSystemTypeNativeLocal and kFileSystemTypeNativeForPlatformApp then | 180 // kFileSystemTypeNativeLocal and kFileSystemTypeNativeForPlatformApp then |
| 184 // IsolatedFileSystemBackend does not need to handle them. For example, on | 181 // IsolatedFileSystemBackend does not need to handle them. For example, on |
| 185 // Chrome OS the additional backend chromeos::FileSystemBackend handles these | 182 // Chrome OS the additional backend chromeos::FileSystemBackend handles these |
| 186 // types. | 183 // types. |
| 187 isolated_backend_.reset(new IsolatedFileSystemBackend( | 184 isolated_backend_.reset(new IsolatedFileSystemBackend( |
| 188 !base::ContainsKey(backend_map_, kFileSystemTypeNativeLocal), | 185 !base::ContainsKey(backend_map_, kFileSystemTypeNativeLocal), |
| 189 !base::ContainsKey(backend_map_, kFileSystemTypeNativeForPlatformApp))); | 186 !base::ContainsKey(backend_map_, kFileSystemTypeNativeForPlatformApp))); |
| 190 RegisterBackend(isolated_backend_.get()); | 187 RegisterBackend(isolated_backend_.get()); |
| 191 | 188 |
| 192 if (quota_manager_proxy) { | 189 if (quota_manager_proxy) { |
| 193 // Quota client assumes all backends have registered. | 190 // Quota client assumes all backends have registered. |
| 194 quota_manager_proxy->RegisterClient(CreateQuotaClient( | 191 quota_manager_proxy->RegisterClient(CreateQuotaClient( |
| 195 this, options.is_incognito())); | 192 this, options.is_incognito())); |
| 196 } | 193 } |
| 197 | 194 |
| 198 sandbox_backend_->Initialize(this); | 195 sandbox_backend_->Initialize(this); |
| 199 isolated_backend_->Initialize(this); | 196 isolated_backend_->Initialize(this); |
| 200 plugin_private_backend_->Initialize(this); | 197 plugin_private_backend_->Initialize(this); |
| 201 for (ScopedVector<FileSystemBackend>::const_iterator iter = | 198 for (const auto& backend : additional_backends_) |
| 202 additional_backends_.begin(); | 199 backend->Initialize(this); |
| 203 iter != additional_backends_.end(); ++iter) { | |
| 204 (*iter)->Initialize(this); | |
| 205 } | |
| 206 | 200 |
| 207 // Additional mount points must be added before regular system-wide | 201 // Additional mount points must be added before regular system-wide |
| 208 // mount points. | 202 // mount points. |
| 209 if (external_mount_points) | 203 if (external_mount_points) |
| 210 url_crackers_.push_back(external_mount_points); | 204 url_crackers_.push_back(external_mount_points); |
| 211 url_crackers_.push_back(ExternalMountPoints::GetSystemInstance()); | 205 url_crackers_.push_back(ExternalMountPoints::GetSystemInstance()); |
| 212 url_crackers_.push_back(IsolatedContext::GetInstance()); | 206 url_crackers_.push_back(IsolatedContext::GetInstance()); |
| 213 } | 207 } |
| 214 | 208 |
| 215 bool FileSystemContext::DeleteDataForOriginOnFileTaskRunner( | 209 bool FileSystemContext::DeleteDataForOriginOnFileTaskRunner( |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 627 |
| 634 // TODO(mtomasz): Not all fields should be required for ResolveURL. | 628 // TODO(mtomasz): Not all fields should be required for ResolveURL. |
| 635 operation_runner()->GetMetadata( | 629 operation_runner()->GetMetadata( |
| 636 url, FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY | | 630 url, FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY | |
| 637 FileSystemOperation::GET_METADATA_FIELD_SIZE | | 631 FileSystemOperation::GET_METADATA_FIELD_SIZE | |
| 638 FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, | 632 FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, |
| 639 base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); | 633 base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); |
| 640 } | 634 } |
| 641 | 635 |
| 642 } // namespace storage | 636 } // namespace storage |
| OLD | NEW |