diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-28 07:13:19 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-28 07:13:19 +0000 |
commit | e53db4462779be3af76c63404314afe7a1464657 (patch) | |
tree | 9c90fa8655cf542bdc35a4819fea2327804a84ef /chrome/browser/renderer_host/buffered_resource_handler.cc | |
parent | 06294933c1ae46a2c6aa22bb0b6eac48582330f6 (diff) | |
download | chromium_src-e53db4462779be3af76c63404314afe7a1464657.zip chromium_src-e53db4462779be3af76c63404314afe7a1464657.tar.gz chromium_src-e53db4462779be3af76c63404314afe7a1464657.tar.bz2 |
Add the ability to specify a default MIME type when loading a resource. We'll need this to correctly load stylesheets that lack a Content-Type header in standards mode.
We're waiting on https://bugs.webkit.org/show_bug.cgi?id=24904 upstream before this works fully. This change, as it stands, is a no-op.
R=wtc
BUG=7448
Review URL: http://codereview.chromium.org/55049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/buffered_resource_handler.cc')
-rw-r--r-- | chrome/browser/renderer_host/buffered_resource_handler.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc index e8a86ee..3418666 100644 --- a/chrome/browser/renderer_host/buffered_resource_handler.cc +++ b/chrome/browser/renderer_host/buffered_resource_handler.cc @@ -180,6 +180,11 @@ bool BufferedResourceHandler::ShouldBuffer(const GURL& url, 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 @@ bool BufferedResourceHandler::KeepBuffering(int bytes_read) { 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 |