summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 02:42:36 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 02:42:36 +0000
commit8107004fbfe9f7ea4be59f6620273c1206c12f42 (patch)
treef86046c0bb77f471f60d088626ad291360b356ff /chrome/browser/net
parent766f613f1c7022941e2e182543d0208a61210a16 (diff)
downloadchromium_src-8107004fbfe9f7ea4be59f6620273c1206c12f42.zip
chromium_src-8107004fbfe9f7ea4be59f6620273c1206c12f42.tar.gz
chromium_src-8107004fbfe9f7ea4be59f6620273c1206c12f42.tar.bz2
Support handling blob URL and resolve blob references in upload data.
BUG=none TEST=unittest Review URL: http://codereview.chromium.org/3282003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/blob_url_request_job_factory.cc32
-rw-r--r--chrome/browser/net/blob_url_request_job_factory.h10
2 files changed, 42 insertions, 0 deletions
diff --git a/chrome/browser/net/blob_url_request_job_factory.cc b/chrome/browser/net/blob_url_request_job_factory.cc
new file mode 100644
index 0000000..dab29d5
--- /dev/null
+++ b/chrome/browser/net/blob_url_request_job_factory.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/blob_url_request_job_factory.h"
+
+#include "chrome/browser/chrome_blob_storage_context.h"
+#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/common/url_constants.h"
+#include "webkit/blob/blob_storage_controller.h"
+#include "webkit/blob/blob_url_request_job.h"
+
+namespace {
+
+URLRequestJob* BlobURLRequestJobFactory(URLRequest* request,
+ const std::string& scheme) {
+ webkit_blob::BlobStorageController* blob_storage_controller =
+ static_cast<ChromeURLRequestContext*>(request->context())->
+ blob_storage_context()->controller();
+ return new webkit_blob::BlobURLRequestJob(
+ request,
+ blob_storage_controller->GetBlobDataFromUrl(request->url()),
+ ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE));
+}
+
+}
+
+void RegisterBlobURLRequestJobFactory() {
+ URLRequest::RegisterProtocolFactory(chrome::kBlobScheme,
+ &BlobURLRequestJobFactory);
+}
diff --git a/chrome/browser/net/blob_url_request_job_factory.h b/chrome/browser/net/blob_url_request_job_factory.h
new file mode 100644
index 0000000..b009eaf
--- /dev/null
+++ b/chrome/browser/net/blob_url_request_job_factory.h
@@ -0,0 +1,10 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NET_BLOB_URL_REQUEST_JOB_FACTORY_H_
+#define CHROME_BROWSER_NET_BLOB_URL_REQUEST_JOB_FACTORY_H_
+
+void RegisterBlobURLRequestJobFactory();
+
+#endif // CHROME_BROWSER_NET_BLOB_URL_REQUEST_JOB_FACTORY_H_