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

Unified Diff: content/browser/loader/buffered_resource_handler.cc

Issue 12212031: Add support for redirecting ResourceHandlers to a blob: URL (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code review fixes Created 7 years, 10 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: content/browser/loader/buffered_resource_handler.cc
diff --git a/content/browser/loader/buffered_resource_handler.cc b/content/browser/loader/buffered_resource_handler.cc
index 69741423da156ba4563034f603d35d7a2657c0ed..784cbaf6faf12c87df08a901290e5ad766e47b16 100644
--- a/content/browser/loader/buffered_resource_handler.cc
+++ b/content/browser/loader/buffered_resource_handler.cc
@@ -15,7 +15,12 @@
#include "content/browser/loader/certificate_resource_handler.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/loader/resource_request_info_impl.h"
+#include "content/browser/loader/stream_resource_handler.h"
#include "content/browser/plugin_service_impl.h"
+#include "content/browser/resource_context_impl.h"
+#include "content/browser/streams/stream.h"
+#include "content/browser/streams/stream_context.h"
+#include "content/browser/streams/stream_registry.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/download_id.h"
#include "content/public/browser/download_save_info.h"
@@ -320,6 +325,32 @@ bool BufferedResourceHandler::SelectNextHandler(bool* defer) {
if (net::IsSupportedMimeType(mime_type))
return true;
+ GURL security_origin;
+ if (host_->delegate() &&
+ host_->delegate()->ShouldCreateStream(info->GetContext(),
+ request_->url(),
+ mime_type,
+ &security_origin)) {
+ StreamContext* stream_context =
+ GetStreamContextForResourceContext(info->GetContext());
+
+ scoped_refptr<Stream> stream =
+ new Stream(stream_context->registry(), security_origin);
+
+ scoped_ptr<ResourceHandler> handler(
+ new StreamResourceHandler(request_, stream));
+
+ info->set_is_stream(true);
+ host_->delegate()->OnStreamCreated(
+ info->GetContext(),
+ info->GetChildID(),
+ info->GetRouteID(),
+ stream->stream_url(),
+ mime_type,
+ request_->url());
+ return UseAlternateNextHandler(handler.Pass());
+ }
+
#if defined(ENABLE_PLUGINS)
bool stale;
bool has_plugin = HasSupportingPlugin(&stale);

Powered by Google App Engine
This is Rietveld 408576698