Index: content/renderer/favicon_helper.cc |
diff --git a/content/renderer/favicon_helper.cc b/content/renderer/favicon_helper.cc |
index 1c00eb5797d24a11eeefbb440bb7ab7f62f1b248..308007939e66474f73afb9aafebbfd4b9f64b21e 100644 |
--- a/content/renderer/favicon_helper.cc |
+++ b/content/renderer/favicon_helper.cc |
@@ -8,6 +8,7 @@ |
#include "base/command_line.h" |
#include "base/message_loop.h" |
#include "content/common/icon_messages.h" |
+#include "content/public/common/content_constants.h" |
#include "content/public/renderer/render_view.h" |
#include "net/base/data_url.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" |
@@ -85,6 +86,7 @@ FaviconHelper::~FaviconHelper() { |
void FaviconHelper::OnDownloadFavicon(int id, |
const GURL& image_url, |
+ DownloadImageType image_type, |
int image_size) { |
std::vector<SkBitmap> result_images; |
if (image_url.SchemeIs("data")) { |
@@ -92,7 +94,7 @@ void FaviconHelper::OnDownloadFavicon(int id, |
if (!data_image.empty()) |
result_images.push_back(data_image); |
} else { |
- if (DownloadFavicon(id, image_url, image_size)) { |
+ if (DownloadFavicon(id, image_url, image_type, image_size)) { |
// Will complete asynchronously via FaviconHelper::DidDownloadFavicon |
return; |
} |
@@ -107,14 +109,29 @@ void FaviconHelper::OnDownloadFavicon(int id, |
bool FaviconHelper::DownloadFavicon(int id, |
const GURL& image_url, |
+ DownloadImageType image_type, |
int image_size) { |
// Make sure webview was not shut down. |
if (!render_view()->GetWebView()) |
return false; |
// Create an image resource fetcher and assign it with a call back object. |
+ WebURLRequest::TargetType target_type; |
+ switch (image_type) { |
+ case DOWNLOAD_FAVICON: |
+ target_type = WebURLRequest::TargetIsFavicon; |
+ break; |
+ case DOWNLOAD_OTHER: |
+ target_type = WebURLRequest::TargetIsImage; |
+ break; |
+ default: |
+ NOTREACHED(); |
+ } |
+ |
image_fetchers_.push_back(new MultiResolutionImageResourceFetcher( |
- image_url, render_view()->GetWebView()->mainFrame(), id, |
- WebURLRequest::TargetIsFavicon, |
+ image_url, |
+ render_view()->GetWebView()->mainFrame(), |
+ id, |
+ target_type, |
base::Bind(&FaviconHelper::DidDownloadFavicon, |
base::Unretained(this), image_size))); |
return true; |