Chromium Code Reviews| Index: chrome/browser/android/shortcut_helper.cc |
| diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc |
| index b4b5931ca4275dd7c3c84da3de99f6401b0b6189..d036565984d3ff49249d7ab65ee64d8ba32382db 100644 |
| --- a/chrome/browser/android/shortcut_helper.cc |
| +++ b/chrome/browser/android/shortcut_helper.cc |
| @@ -25,6 +25,7 @@ |
| #include "ui/gfx/android/java_bitmap.h" |
| #include "ui/gfx/codec/png_codec.h" |
| #include "ui/gfx/color_analysis.h" |
| +#include "ui/gfx/favicon_size.h" |
| #include "url/gurl.h" |
| ShortcutBuilder::ShortcutBuilder(content::WebContents* web_contents, |
| @@ -71,18 +72,19 @@ void ShortcutBuilder::OnDidRetrieveWebappInformation( |
| // Grab the best, largest icon we can find to represent this bookmark. |
| // TODO(dfalcantara): Try combining with the new BookmarksHandler once its |
| // rewrite is further along. |
| - FaviconService::FaviconForURLParams favicon_params( |
| - profile, |
| - url_, |
| - chrome::TOUCH_PRECOMPOSED_ICON | chrome::TOUCH_ICON | chrome::FAVICON, |
| - 0); |
| - |
| + std::vector<int> icon_types; |
| + icon_types.push_back(chrome::FAVICON); |
| + icon_types.push_back(chrome::TOUCH_PRECOMPOSED_ICON | chrome::TOUCH_ICON); |
| FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| profile, Profile::EXPLICIT_ACCESS); |
| - favicon_service->GetRawFaviconForURL( |
| - favicon_params, |
| - ui::SCALE_FACTOR_100P, |
| + // Using favicon if its size is not smaller than platform required size, |
| + // otherwise using the largest icon among all avaliable icons. |
| + int minimum_size = Java_ShortcutHelper_getLauncherLargeIconSize( |
| + base::android::AttachCurrentThread(), |
| + base::android::GetApplicationContext()); |
| + favicon_service->GetLargestRawFaviconForURL(profile, url_, icon_types, |
| + minimum_size - 1, |
|
gone
2013/10/24 22:07:32
Why are you subtracting off 1 pixel btw?
michaelbai
2013/10/25 03:36:43
The GetLargestRawFaviconForURL finds the icon larg
|
| base::Bind(&ShortcutBuilder::FinishAddingShortcut, |
| base::Unretained(this)), |
| &cancelable_task_tracker_); |