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

Unified Diff: content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc

Issue 16358002: Allow MultiResolutionImageFetcher to fetch image from file:/// protocol (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
diff --git a/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc b/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
index f3c79b3cef0f130a5f1b50b1115a64f87d1248c4..bd518acbd5db016039100851818bc6c6bc0fbd0e 100644
--- a/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
+++ b/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
@@ -6,6 +6,8 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/utf_string_conversions.h"
+#include "net/base/mime_util.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/size.h"
@@ -44,7 +46,9 @@ void MultiResolutionImageResourceFetcher::OnURLFetchComplete(
std::vector<SkBitmap> bitmaps;
if (!response.isNull()) {
http_status_code_ = response.httpStatusCode();
- if (http_status_code_ == 200) {
+ std::string mime_type = UTF16ToUTF8(response.mimeType());
+ if (http_status_code_ == 200 || (net::IsSupportedImageMimeType(mime_type) &&
Nico 2013/06/04 18:01:20 This will now also let through a partially downloa
+ data.size() > 0)) {
// Request succeeded, try to convert it to an image.
bitmaps = webkit_glue::ImageDecoder::DecodeAll(
reinterpret_cast<const unsigned char*>(data.data()), data.size());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698