summaryrefslogtreecommitdiffstats
path: root/content/browser/storage_partition_impl_map.cc
diff options
context:
space:
mode:
authorzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 15:06:15 +0000
committerzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 15:06:15 +0000
commit2f67b439d86916fad3abd6dc6d4a55a32d2596f6 (patch)
tree33a0f7b10c8113a6f04eadddffb08a118bb58e55 /content/browser/storage_partition_impl_map.cc
parent61fdcbf4572ca0c6a80109f4c9437a58caded5ac (diff)
downloadchromium_src-2f67b439d86916fad3abd6dc6d4a55a32d2596f6.zip
chromium_src-2f67b439d86916fad3abd6dc6d4a55a32d2596f6.tar.gz
chromium_src-2f67b439d86916fad3abd6dc6d4a55a32d2596f6.tar.bz2
Add URL request handling for Streams.
BUG=181495 Review URL: https://chromiumcodereview.appspot.com/12734003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/storage_partition_impl_map.cc')
-rw-r--r--content/browser/storage_partition_impl_map.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc
index 78c1188..16111cf 100644
--- a/content/browser/storage_partition_impl_map.cc
+++ b/content/browser/storage_partition_impl_map.cc
@@ -19,6 +19,10 @@
#include "content/browser/loader/resource_request_info_impl.h"
#include "content/browser/resource_context_impl.h"
#include "content/browser/storage_partition_impl.h"
+#include "content/browser/streams/stream.h"
+#include "content/browser/streams/stream_context.h"
+#include "content/browser/streams/stream_registry.h"
+#include "content/browser/streams/stream_url_request_job.h"
#include "content/browser/webui/url_data_manager_backend.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -44,8 +48,10 @@ namespace {
class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
public:
BlobProtocolHandler(ChromeBlobStorageContext* blob_storage_context,
+ StreamContext* stream_context,
fileapi::FileSystemContext* file_system_context)
: blob_storage_context_(blob_storage_context),
+ stream_context_(stream_context),
file_system_context_(file_system_context) {}
virtual ~BlobProtocolHandler() {}
@@ -57,6 +63,7 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
if (!webkit_blob_protocol_handler_impl_) {
webkit_blob_protocol_handler_impl_.reset(
new WebKitBlobProtocolHandlerImpl(blob_storage_context_->controller(),
+ stream_context_,
file_system_context_));
}
return webkit_blob_protocol_handler_impl_->MaybeCreateJob(request,
@@ -71,14 +78,28 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
public:
WebKitBlobProtocolHandlerImpl(
webkit_blob::BlobStorageController* blob_storage_controller,
+ StreamContext* stream_context,
fileapi::FileSystemContext* file_system_context)
: webkit_blob::BlobProtocolHandler(
blob_storage_controller, file_system_context,
BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::FILE)) {}
+ BrowserThread::FILE)),
+ stream_context_(stream_context) {}
virtual ~WebKitBlobProtocolHandlerImpl() {}
+ virtual net::URLRequestJob* MaybeCreateJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
+ scoped_refptr<Stream> stream =
+ stream_context_->registry()->GetStream(request->url());
+ if (stream)
+ return new StreamURLRequestJob(request, network_delegate, stream);
+
+ return webkit_blob::BlobProtocolHandler::MaybeCreateJob(
+ request, network_delegate);
+ }
+
private:
// webkit_blob::BlobProtocolHandler implementation.
virtual scoped_refptr<webkit_blob::BlobData>
@@ -90,10 +111,12 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
return info->requested_blob_data();
}
+ const scoped_refptr<StreamContext> stream_context_;
DISALLOW_COPY_AND_ASSIGN(WebKitBlobProtocolHandlerImpl);
};
const scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
+ const scoped_refptr<StreamContext> stream_context_;
const scoped_refptr<fileapi::FileSystemContext> file_system_context_;
mutable scoped_ptr<WebKitBlobProtocolHandlerImpl>
@@ -386,10 +409,12 @@ StoragePartitionImpl* StoragePartitionImplMap::Get(
ChromeBlobStorageContext* blob_storage_context =
ChromeBlobStorageContext::GetFor(browser_context_);
+ StreamContext* stream_context = StreamContext::GetFor(browser_context_);
ProtocolHandlerMap protocol_handlers;
protocol_handlers[chrome::kBlobScheme] =
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
new BlobProtocolHandler(blob_storage_context,
+ stream_context,
partition->GetFileSystemContext()));
protocol_handlers[chrome::kFileSystemScheme] =
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(