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

Unified Diff: webkit/browser/fileapi/file_system_url_request_job.cc

Issue 195923002: 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: Fix CrOS 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 side-by-side diff with in-line comments
Download patch
Index: webkit/browser/fileapi/file_system_url_request_job.cc
diff --git a/webkit/browser/fileapi/file_system_url_request_job.cc b/webkit/browser/fileapi/file_system_url_request_job.cc
index fe445649a70a4f400e1f1525b5645e352312080a..8ccc5bbf0ab9565b9d9f47d38b5a98816e306e68 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) {
« no previous file with comments | « webkit/browser/fileapi/file_system_url_request_job.h ('k') | webkit/browser/fileapi/file_system_url_request_job_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698