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

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

Issue 263513004: Forward MIME types to BrowserPlugin when a viewer is specified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fixes Created 6 years, 8 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 d5cabe35d4b0105f2c7002353dfa14da96d124bc..48061396a7a18634d5cdab08140632a08a091c0c 100644
--- a/content/browser/loader/buffered_resource_handler.cc
+++ b/content/browser/loader/buffered_resource_handler.cc
@@ -15,6 +15,7 @@
#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/public/browser/content_browser_client.h"
#include "content/public/browser/download_item.h"
@@ -321,10 +322,22 @@ bool BufferedResourceHandler::SelectNextHandler(bool* defer) {
if (net::IsSupportedMimeType(mime_type))
return true;
- scoped_ptr<ResourceHandler> handler(
+ scoped_ptr<StreamResourceHandler> handler(
host_->MaybeInterceptAsStream(request(), response_.get()));
- if (handler)
- return UseAlternateNextHandler(handler.Pass());
+ if (handler) {
+ if (handler->HasPayload()) {
mmenke 2014/05/12 17:12:13 I'm really not following any of this code.
+ handler->SetNextHandler(next_handler_.Pass());
+
+ next_handler_ = handler.Pass();
+ next_handler_->SetController(this);
+
+ int request_id =
+ ResourceRequestInfo::ForRequest(request())->GetRequestID();
+ return CopyReadBufferToNextHandler(request_id);
mmenke 2014/05/13 15:14:32 I think it's less than ideal to split the responsi
Zachary Kuznia 2014/05/20 22:24:39 If I understand correctly, you're saying that I sh
mmenke 2014/05/21 15:17:49 That's my suggestion. I don't think the new behav
+ } else {
+ UseAlternateNextHandler(handler.PassAs<ResourceHandler>());
+ }
+ }
#if defined(ENABLE_PLUGINS)
bool stale;

Powered by Google App Engine
This is Rietveld 408576698