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/browser/fileapi/file_system_context.h" | 5 #include "webkit/browser/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 RegisterBackend(sandbox_backend_.get()); | 132 RegisterBackend(sandbox_backend_.get()); |
133 RegisterBackend(isolated_backend_.get()); | 133 RegisterBackend(isolated_backend_.get()); |
134 | 134 |
135 for (ScopedVector<FileSystemBackend>::const_iterator iter = | 135 for (ScopedVector<FileSystemBackend>::const_iterator iter = |
136 additional_backends_.begin(); | 136 additional_backends_.begin(); |
137 iter != additional_backends_.end(); ++iter) { | 137 iter != additional_backends_.end(); ++iter) { |
138 RegisterBackend(*iter); | 138 RegisterBackend(*iter); |
139 } | 139 } |
140 | 140 |
| 141 sandbox_backend_->Initialize(this); |
| 142 isolated_backend_->Initialize(this); |
| 143 for (ScopedVector<FileSystemBackend>::const_iterator iter = |
| 144 additional_backends_.begin(); |
| 145 iter != additional_backends_.end(); ++iter) { |
| 146 (*iter)->Initialize(this); |
| 147 } |
| 148 |
141 // Additional mount points must be added before regular system-wide | 149 // Additional mount points must be added before regular system-wide |
142 // mount points. | 150 // mount points. |
143 if (external_mount_points) | 151 if (external_mount_points) |
144 url_crackers_.push_back(external_mount_points); | 152 url_crackers_.push_back(external_mount_points); |
145 url_crackers_.push_back(ExternalMountPoints::GetSystemInstance()); | 153 url_crackers_.push_back(ExternalMountPoints::GetSystemInstance()); |
146 url_crackers_.push_back(IsolatedContext::GetInstance()); | 154 url_crackers_.push_back(IsolatedContext::GetInstance()); |
147 } | 155 } |
148 | 156 |
149 bool FileSystemContext::DeleteDataForOriginOnFileThread( | 157 bool FileSystemContext::DeleteDataForOriginOnFileThread( |
150 const GURL& origin_url) { | 158 const GURL& origin_url) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 OpenFileSystemMode mode, | 270 OpenFileSystemMode mode, |
263 const OpenFileSystemCallback& callback) { | 271 const OpenFileSystemCallback& callback) { |
264 DCHECK(!callback.is_null()); | 272 DCHECK(!callback.is_null()); |
265 | 273 |
266 FileSystemBackend* backend = GetFileSystemBackend(type); | 274 FileSystemBackend* backend = GetFileSystemBackend(type); |
267 if (!backend) { | 275 if (!backend) { |
268 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL()); | 276 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL()); |
269 return; | 277 return; |
270 } | 278 } |
271 | 279 |
272 backend->InitializeFileSystem(origin_url, type, mode, this, | 280 backend->OpenFileSystem(origin_url, type, mode, |
273 base::Bind(&DidOpenFileSystem, callback)); | 281 base::Bind(&DidOpenFileSystem, callback)); |
274 } | 282 } |
275 | 283 |
276 void FileSystemContext::DeleteFileSystem( | 284 void FileSystemContext::DeleteFileSystem( |
277 const GURL& origin_url, | 285 const GURL& origin_url, |
278 FileSystemType type, | 286 FileSystemType type, |
279 const DeleteFileSystemCallback& callback) { | 287 const DeleteFileSystemCallback& callback) { |
280 DCHECK(origin_url == origin_url.GetOrigin()); | 288 DCHECK(origin_url == origin_url.GetOrigin()); |
281 FileSystemBackend* backend = GetFileSystemBackend(type); | 289 FileSystemBackend* backend = GetFileSystemBackend(type); |
282 if (!backend) { | 290 if (!backend) { |
283 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); | 291 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 FileSystemType type = static_cast<FileSystemType>(t); | 458 FileSystemType type = static_cast<FileSystemType>(t); |
451 if (backend->CanHandleType(type)) { | 459 if (backend->CanHandleType(type)) { |
452 const bool inserted = backend_map_.insert( | 460 const bool inserted = backend_map_.insert( |
453 std::make_pair(type, backend)).second; | 461 std::make_pair(type, backend)).second; |
454 DCHECK(inserted); | 462 DCHECK(inserted); |
455 } | 463 } |
456 } | 464 } |
457 } | 465 } |
458 | 466 |
459 } // namespace fileapi | 467 } // namespace fileapi |
OLD | NEW |