summaryrefslogtreecommitdiffstats
path: root/webkit/browser/fileapi/file_system_context.cc
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 19:40:31 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 19:40:31 +0000
commitdc895236268d5f20f45c3ed86f1f70f65853cd80 (patch)
treefa69c05cacb50a7f12e3fce8f23fc974ab43039b /webkit/browser/fileapi/file_system_context.cc
parentd8911efaf3cd3635a1edcc985c81416bebebd3a7 (diff)
downloadchromium_src-dc895236268d5f20f45c3ed86f1f70f65853cd80.zip
chromium_src-dc895236268d5f20f45c3ed86f1f70f65853cd80.tar.gz
chromium_src-dc895236268d5f20f45c3ed86f1f70f65853cd80.tar.bz2
Add mechanism to auto mount file systems in response to a URL request.
This code adds a hook for when a file system URL request can not be cracked. It will allow external media galleries file systems to be lazily created. BUG=160900 Review URL: https://codereview.chromium.org/195923002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser/fileapi/file_system_context.cc')
-rw-r--r--webkit/browser/fileapi/file_system_context.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc
index c42eadb..067b25b 100644
--- a/webkit/browser/fileapi/file_system_context.cc
+++ b/webkit/browser/fileapi/file_system_context.cc
@@ -8,6 +8,7 @@
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/task_runner_util.h"
+#include "net/url_request/url_request.h"
#include "url/gurl.h"
#include "webkit/browser/blob/file_stream_reader.h"
#include "webkit/browser/fileapi/copy_or_move_file_validator.h"
@@ -113,6 +114,7 @@ FileSystemContext::FileSystemContext(
quota::SpecialStoragePolicy* special_storage_policy,
quota::QuotaManagerProxy* quota_manager_proxy,
ScopedVector<FileSystemBackend> additional_backends,
+ const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers,
const base::FilePath& partition_path,
const FileSystemOptions& options)
: io_task_runner_(io_task_runner),
@@ -133,6 +135,7 @@ FileSystemContext::FileSystemContext(
special_storage_policy,
options)),
additional_backends_(additional_backends.Pass()),
+ auto_mount_handlers_(auto_mount_handlers),
external_mount_points_(external_mount_points),
partition_path_(partition_path),
is_incognito_(options.is_incognito()),
@@ -337,6 +340,22 @@ void FileSystemContext::ResolveURL(
callback));
}
+void FileSystemContext::AttemptAutoMountForURLRequest(
+ const net::URLRequest* url_request,
+ const std::string& storage_domain,
+ const StatusCallback& callback) {
+ FileSystemURL filesystem_url(url_request->url());
+ if (filesystem_url.type() == kFileSystemTypeExternal) {
+ for (size_t i = 0; i < auto_mount_handlers_.size(); i++) {
+ if (auto_mount_handlers_[i].Run(url_request, filesystem_url,
+ storage_domain, callback)) {
+ return;
+ }
+ }
+ }
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
+}
+
void FileSystemContext::DeleteFileSystem(
const GURL& origin_url,
FileSystemType type,