Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: webkit/browser/fileapi/file_system_context.cc

Issue 206253002: Revert of Add mechanism to auto mount file systems in response to a URL request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "net/url_request/url_request.h"
12 #include "url/gurl.h" 11 #include "url/gurl.h"
13 #include "webkit/browser/blob/file_stream_reader.h" 12 #include "webkit/browser/blob/file_stream_reader.h"
14 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" 13 #include "webkit/browser/fileapi/copy_or_move_file_validator.h"
15 #include "webkit/browser/fileapi/external_mount_points.h" 14 #include "webkit/browser/fileapi/external_mount_points.h"
16 #include "webkit/browser/fileapi/file_permission_policy.h" 15 #include "webkit/browser/fileapi/file_permission_policy.h"
17 #include "webkit/browser/fileapi/file_stream_writer.h" 16 #include "webkit/browser/fileapi/file_stream_writer.h"
18 #include "webkit/browser/fileapi/file_system_file_util.h" 17 #include "webkit/browser/fileapi/file_system_file_util.h"
19 #include "webkit/browser/fileapi/file_system_operation.h" 18 #include "webkit/browser/fileapi/file_system_operation.h"
20 #include "webkit/browser/fileapi/file_system_operation_runner.h" 19 #include "webkit/browser/fileapi/file_system_operation_runner.h"
21 #include "webkit/browser/fileapi/file_system_options.h" 20 #include "webkit/browser/fileapi/file_system_options.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return FILE_PERMISSION_ALWAYS_DENY; 106 return FILE_PERMISSION_ALWAYS_DENY;
108 } 107 }
109 108
110 FileSystemContext::FileSystemContext( 109 FileSystemContext::FileSystemContext(
111 base::SingleThreadTaskRunner* io_task_runner, 110 base::SingleThreadTaskRunner* io_task_runner,
112 base::SequencedTaskRunner* file_task_runner, 111 base::SequencedTaskRunner* file_task_runner,
113 ExternalMountPoints* external_mount_points, 112 ExternalMountPoints* external_mount_points,
114 quota::SpecialStoragePolicy* special_storage_policy, 113 quota::SpecialStoragePolicy* special_storage_policy,
115 quota::QuotaManagerProxy* quota_manager_proxy, 114 quota::QuotaManagerProxy* quota_manager_proxy,
116 ScopedVector<FileSystemBackend> additional_backends, 115 ScopedVector<FileSystemBackend> additional_backends,
117 const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers,
118 const base::FilePath& partition_path, 116 const base::FilePath& partition_path,
119 const FileSystemOptions& options) 117 const FileSystemOptions& options)
120 : io_task_runner_(io_task_runner), 118 : io_task_runner_(io_task_runner),
121 default_file_task_runner_(file_task_runner), 119 default_file_task_runner_(file_task_runner),
122 quota_manager_proxy_(quota_manager_proxy), 120 quota_manager_proxy_(quota_manager_proxy),
123 sandbox_delegate_(new SandboxFileSystemBackendDelegate( 121 sandbox_delegate_(new SandboxFileSystemBackendDelegate(
124 quota_manager_proxy, 122 quota_manager_proxy,
125 file_task_runner, 123 file_task_runner,
126 partition_path, 124 partition_path,
127 special_storage_policy, 125 special_storage_policy,
128 options)), 126 options)),
129 sandbox_backend_(new SandboxFileSystemBackend( 127 sandbox_backend_(new SandboxFileSystemBackend(
130 sandbox_delegate_.get())), 128 sandbox_delegate_.get())),
131 isolated_backend_(new IsolatedFileSystemBackend()), 129 isolated_backend_(new IsolatedFileSystemBackend()),
132 plugin_private_backend_(new PluginPrivateFileSystemBackend( 130 plugin_private_backend_(new PluginPrivateFileSystemBackend(
133 file_task_runner, 131 file_task_runner,
134 partition_path, 132 partition_path,
135 special_storage_policy, 133 special_storage_policy,
136 options)), 134 options)),
137 additional_backends_(additional_backends.Pass()), 135 additional_backends_(additional_backends.Pass()),
138 auto_mount_handlers_(auto_mount_handlers),
139 external_mount_points_(external_mount_points), 136 external_mount_points_(external_mount_points),
140 partition_path_(partition_path), 137 partition_path_(partition_path),
141 is_incognito_(options.is_incognito()), 138 is_incognito_(options.is_incognito()),
142 operation_runner_(new FileSystemOperationRunner(this)) { 139 operation_runner_(new FileSystemOperationRunner(this)) {
143 RegisterBackend(sandbox_backend_.get()); 140 RegisterBackend(sandbox_backend_.get());
144 RegisterBackend(isolated_backend_.get()); 141 RegisterBackend(isolated_backend_.get());
145 RegisterBackend(plugin_private_backend_.get()); 142 RegisterBackend(plugin_private_backend_.get());
146 143
147 for (ScopedVector<FileSystemBackend>::const_iterator iter = 144 for (ScopedVector<FileSystemBackend>::const_iterator iter =
148 additional_backends_.begin(); 145 additional_backends_.begin();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 330
334 backend->ResolveURL( 331 backend->ResolveURL(
335 url, 332 url,
336 OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, 333 OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT,
337 base::Bind(&FileSystemContext::DidOpenFileSystemForResolveURL, 334 base::Bind(&FileSystemContext::DidOpenFileSystemForResolveURL,
338 this, 335 this,
339 url, 336 url,
340 callback)); 337 callback));
341 } 338 }
342 339
343 void FileSystemContext::AttemptAutoMountForURLRequest(
344 const net::URLRequest* url_request,
345 const std::string& storage_domain,
346 const StatusCallback& callback) {
347 FileSystemURL filesystem_url(url_request->url());
348 if (filesystem_url.type() == kFileSystemTypeExternal) {
349 for (size_t i = 0; i < auto_mount_handlers_.size(); i++) {
350 if (auto_mount_handlers_[i].Run(url_request, filesystem_url,
351 storage_domain, callback)) {
352 return;
353 }
354 }
355 }
356 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
357 }
358
359 void FileSystemContext::DeleteFileSystem( 340 void FileSystemContext::DeleteFileSystem(
360 const GURL& origin_url, 341 const GURL& origin_url,
361 FileSystemType type, 342 FileSystemType type,
362 const StatusCallback& callback) { 343 const StatusCallback& callback) {
363 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); 344 DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
364 DCHECK(origin_url == origin_url.GetOrigin()); 345 DCHECK(origin_url == origin_url.GetOrigin());
365 DCHECK(!callback.is_null()); 346 DCHECK(!callback.is_null());
366 347
367 FileSystemBackend* backend = GetFileSystemBackend(type); 348 FileSystemBackend* backend = GetFileSystemBackend(type);
368 if (!backend) { 349 if (!backend) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } else if (parent != child) { 555 } else if (parent != child) {
575 bool result = parent.AppendRelativePath(child, &path); 556 bool result = parent.AppendRelativePath(child, &path);
576 DCHECK(result); 557 DCHECK(result);
577 } 558 }
578 559
579 operation_runner()->GetMetadata( 560 operation_runner()->GetMetadata(
580 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); 561 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info));
581 } 562 }
582 563
583 } // namespace fileapi 564 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_context.h ('k') | webkit/browser/fileapi/file_system_dir_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698