diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-18 00:26:30 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-18 00:26:30 +0000 |
commit | 263cb08f526585b58aeb6cf82e67c7a53491e403 (patch) | |
tree | f33b5930ea9b9dc8498d378917141170a78c84fa /android_webview | |
parent | 7b904af5b9825658d3fc02b9c5fa7db5afdef277 (diff) | |
download | chromium_src-263cb08f526585b58aeb6cf82e67c7a53491e403.zip chromium_src-263cb08f526585b58aeb6cf82e67c7a53491e403.tar.gz chromium_src-263cb08f526585b58aeb6cf82e67c7a53491e403.tar.bz2 |
This CL:
- Passes in ImageHostMsg_DidDownloadImage the original sizes of the bitmaps before they were resized as a result of the max size passed by ImageMsg_DownloadImage. This enables FaviconHandler to properly score the "goodness" of a bitmap.
- Removes the unused "preferred size" parameters from the ImageMsg_DownloadImage and ImageHostMsg_DidDownloadImage messages
- Adds a method in the anonymous namespace of FaviconUtil so that FaviconUtil::SelectFaviconFramesFromPNGs() does not use SelectFaviconFrames(). The old behavior is confusing because the call to SelectFaviconFrames() in FaviconUtil::SelectFaviconFramesFromPNGs() was operating on already resized bitmaps
BUG=278457
TEST=FaviconHandlerTest.MultipleFavicons
R=joth,cevans,jam,sky
TBR=benwells (For trivial change to shell_window.*)
Review URL: https://chromiumcodereview.appspot.com/23708024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/browser/icon_helper.cc | 9 | ||||
-rw-r--r-- | android_webview/browser/icon_helper.h | 13 |
2 files changed, 16 insertions, 6 deletions
diff --git a/android_webview/browser/icon_helper.cc b/android_webview/browser/icon_helper.cc index 77c98d4..80233fc 100644 --- a/android_webview/browser/icon_helper.cc +++ b/android_webview/browser/icon_helper.cc @@ -11,6 +11,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/favicon_url.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/size.h" using content::BrowserThread; using content::WebContents; @@ -30,8 +31,11 @@ void IconHelper::SetListener(Listener* listener) { } void IconHelper::DownloadFaviconCallback( - int id, int http_status_code, const GURL& image_url, int requested_size, - const std::vector<SkBitmap>& bitmaps) { + int id, + int http_status_code, + const GURL& image_url, + const std::vector<SkBitmap>& bitmaps, + const std::vector<gfx::Size>& original_bitmap_sizes) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (bitmaps.size() == 0) { return; @@ -61,7 +65,6 @@ void IconHelper::DidUpdateFaviconURL(int32 page_id, // but we should decouple that setting via a boolean setting) web_contents()->DownloadImage(i->icon_url, true, // Is a favicon - 0, // No preferred size 0, // No maximum size base::Bind( &IconHelper::DownloadFaviconCallback, base::Unretained(this))); diff --git a/android_webview/browser/icon_helper.h b/android_webview/browser/icon_helper.h index 97539eb..7498874 100644 --- a/android_webview/browser/icon_helper.h +++ b/android_webview/browser/icon_helper.h @@ -15,6 +15,10 @@ namespace content { struct FaviconURL; } +namespace gfx { +class Size; +} + namespace android_webview { // A helper that observes favicon changes for Webview. @@ -39,9 +43,12 @@ class IconHelper : public content::WebContentsObserver { virtual void DidUpdateFaviconURL(int32 page_id, const std::vector<content::FaviconURL>& candidates) OVERRIDE; - void DownloadFaviconCallback(int id, int http_status_code, - const GURL& image_url, int requested_size, - const std::vector<SkBitmap>& bitmaps); + void DownloadFaviconCallback( + int id, + int http_status_code, + const GURL& image_url, + const std::vector<SkBitmap>& bitmaps, + const std::vector<gfx::Size>& original_bitmap_sizes); private: Listener* listener_; |