summaryrefslogtreecommitdiffstats
path: root/webkit/browser/fileapi/file_system_url_request_job.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_url_request_job.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_url_request_job.cc')
-rw-r--r--webkit/browser/fileapi/file_system_url_request_job.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/webkit/browser/fileapi/file_system_url_request_job.cc b/webkit/browser/fileapi/file_system_url_request_job.cc
index fe445649..8ccc5bb 100644
--- a/webkit/browser/fileapi/file_system_url_request_job.cc
+++ b/webkit/browser/fileapi/file_system_url_request_job.cc
@@ -57,8 +57,10 @@ static net::HttpResponseHeaders* CreateHttpResponseHeaders() {
FileSystemURLRequestJob::FileSystemURLRequestJob(
URLRequest* request,
NetworkDelegate* network_delegate,
+ const std::string& storage_domain,
FileSystemContext* file_system_context)
: URLRequestJob(request, network_delegate),
+ storage_domain_(storage_domain),
file_system_context_(file_system_context),
is_directory_(false),
remaining_bytes_(0),
@@ -157,6 +159,14 @@ void FileSystemURLRequestJob::StartAsync() {
return;
DCHECK(!reader_.get());
url_ = file_system_context_->CrackURL(request_->url());
+ if (!url_.is_valid()) {
+ file_system_context_->AttemptAutoMountForURLRequest(
+ request_,
+ storage_domain_,
+ base::Bind(&FileSystemURLRequestJob::DidAttemptAutoMount,
+ weak_factory_.GetWeakPtr()));
+ return;
+ }
if (!file_system_context_->CanServeURLRequest(url_)) {
// In incognito mode the API is not usable and there should be no data.
NotifyFailed(net::ERR_FILE_NOT_FOUND);
@@ -168,6 +178,15 @@ void FileSystemURLRequestJob::StartAsync() {
weak_factory_.GetWeakPtr()));
}
+void FileSystemURLRequestJob::DidAttemptAutoMount(base::File::Error result) {
+ if (result >= 0 &&
+ file_system_context_->CrackURL(request_->url()).is_valid()) {
+ StartAsync();
+ } else {
+ NotifyFailed(net::ERR_FILE_NOT_FOUND);
+ }
+}
+
void FileSystemURLRequestJob::DidGetMetadata(
base::File::Error error_code,
const base::File::Info& file_info) {