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

Unified Diff: chrome/browser/renderer_host/buffered_resource_handler.cc

Issue 55049: Add the ability to specify a default MIME type when loading a resource. We'l... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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: chrome/browser/renderer_host/buffered_resource_handler.cc
===================================================================
--- chrome/browser/renderer_host/buffered_resource_handler.cc (revision 12710)
+++ chrome/browser/renderer_host/buffered_resource_handler.cc (working copy)
@@ -180,6 +180,11 @@
bool BufferedResourceHandler::KeepBuffering(int bytes_read) {
DCHECK(read_buffer_);
+
+ ResourceDispatcherHost::ExtraRequestInfo* info =
+ ResourceDispatcherHost::ExtraInfoForRequest(request_);
+ DCHECK(info);
+
if (my_buffer_) {
// We are using our own buffer to read, update the main buffer.
CHECK(bytes_read + bytes_read_ < read_buffer_size_);
@@ -193,6 +198,9 @@
std::string type_hint, new_type;
request_->GetMimeType(&type_hint);
+ if (type_hint.empty())
+ type_hint = info->default_mime_type;
+
if (!net::SniffMimeType(read_buffer_->data(), bytes_read_,
request_->url(), type_hint, &new_type)) {
// SniffMimeType() returns false if there is not enough data to determine

Powered by Google App Engine
This is Rietveld 408576698