From 433bd24b73e676a6aae5b04f00131755cce3552b Mon Sep 17 00:00:00 2001 From: "dimich@chromium.org" Date: Wed, 20 Mar 2013 18:27:29 +0000 Subject: Fix Notifications Icon loading. The recent change to loading favicons regressed the loading regular icons that used the same codepath (https://chromiumcodereview.appspot.com/12218057) The fix is to add a parameter to WebContent::DownloadFavicon(...) to differentiate the loading of favicon and regular images. There is a separate patch, for renaming DownloadFavicon -> DownloadImage (https://codereview.chromium.org/12780024/) TBR=palmer@chromium.org BUG=196769 Review URL: https://codereview.chromium.org/12945007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189349 0039d316-1c4b-4281-b951-d872f2087c98 --- content/renderer/favicon_helper.cc | 11 ++++++++--- content/renderer/favicon_helper.h | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'content/renderer') diff --git a/content/renderer/favicon_helper.cc b/content/renderer/favicon_helper.cc index 1c00eb5..9dd738f 100644 --- a/content/renderer/favicon_helper.cc +++ b/content/renderer/favicon_helper.cc @@ -85,6 +85,7 @@ FaviconHelper::~FaviconHelper() { void FaviconHelper::OnDownloadFavicon(int id, const GURL& image_url, + bool is_favicon, int image_size) { std::vector result_images; if (image_url.SchemeIs("data")) { @@ -92,7 +93,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, is_favicon, image_size)) { // Will complete asynchronously via FaviconHelper::DidDownloadFavicon return; } @@ -107,14 +108,18 @@ void FaviconHelper::OnDownloadFavicon(int id, bool FaviconHelper::DownloadFavicon(int id, const GURL& image_url, + bool is_favicon, 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. image_fetchers_.push_back(new MultiResolutionImageResourceFetcher( - image_url, render_view()->GetWebView()->mainFrame(), id, - WebURLRequest::TargetIsFavicon, + image_url, + render_view()->GetWebView()->mainFrame(), + id, + is_favicon ? WebURLRequest::TargetIsFavicon : + WebURLRequest::TargetIsImage, base::Bind(&FaviconHelper::DidDownloadFavicon, base::Unretained(this), image_size))); return true; diff --git a/content/renderer/favicon_helper.h b/content/renderer/favicon_helper.h index acce508..44708e2 100644 --- a/content/renderer/favicon_helper.h +++ b/content/renderer/favicon_helper.h @@ -10,6 +10,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/scoped_vector.h" +#include "content/public/common/content_constants.h" #include "content/public/renderer/render_view_observer.h" #include "googleurl/src/gurl.h" @@ -41,16 +42,24 @@ class FaviconHelper : public RenderViewObserver { virtual ~FaviconHelper(); // Message handler. - void OnDownloadFavicon(int id, const GURL& image_url, int image_size); + void OnDownloadFavicon(int id, + const GURL& image_url, + bool is_favicon, + int image_size); // Requests to download a favicon image. When done, the RenderView // is notified by way of DidDownloadFavicon. Returns true if the // request was successfully started, false otherwise. id is used to // uniquely identify the request and passed back to the - // DidDownloadFavicon method. If the image has multiple frames, the + // DidDownloadFavicon method. If the image is a favicon, cookies are + // not sent and not accepted during download. + // If the image has multiple frames, the // frame whose size is image_size is returned. If the image doesn't // have a frame at the specified size, the first is returned. - bool DownloadFavicon(int id, const GURL& image_url, int image_size); + bool DownloadFavicon(int id, + const GURL& image_url, + bool is_favicon, + int image_size); // This callback is triggered when DownloadFavicon completes, either // succesfully or with a failure. See DownloadFavicon for more -- cgit v1.1