Chromium Code Reviews| Index: chrome/browser/ui/webui/large_icon_source.cc |
| diff --git a/chrome/browser/ui/webui/large_icon_source.cc b/chrome/browser/ui/webui/large_icon_source.cc |
| index 82ad0c473a711a66abe5aa4eb2eb190b7a6c269b..47d7c0663debd1620b8f253f3810a04ab632ae1a 100644 |
| --- a/chrome/browser/ui/webui/large_icon_source.cc |
| +++ b/chrome/browser/ui/webui/large_icon_source.cc |
| @@ -15,6 +15,8 @@ |
| #include "components/favicon_base/favicon_types.h" |
| #include "components/favicon_base/large_icon_url_parser.h" |
| #include "net/url_request/url_request.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| +#include "ui/gfx/codec/png_codec.h" |
| namespace { |
| @@ -106,9 +108,23 @@ void LargeIconSource::OnLargeIconDataAvailable( |
| SendNotFoundResponse(callback); |
| return; |
| } |
| + |
| +#if defined(OS_ANDROID) |
| + // RenderFallbackIconBitmap() cannot draw fallback icons on Android. See |
|
newt (away)
2016/01/25 19:43:35
Instead of sending a 1x1 bitmap, could you send th
Dan Beam
2016/02/05 20:42:12
how would it be read?
|
| + // crbug.com/580922 for details. Return a 1x1 bitmap so that JavaScript can |
| + // detect that it needs to generate a fallback icon. |
| + SkBitmap bitmap; |
| + bitmap.allocN32Pixels(1, 1); |
|
Dan Beam
2016/02/05 20:42:12
why not a 0x0?
pkotwicz
2016/02/06 02:59:55
See my other comment about sending the dominant co
|
| + bitmap.eraseColor(result.fallback_icon_style->background_color); |
| + std::vector<unsigned char> bitmap_data; |
| + if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &bitmap_data)) |
| + bitmap_data.clear(); |
| +#else |
| std::vector<unsigned char> bitmap_data = |
| fallback_icon_service_->RenderFallbackIconBitmap( |
| url, size, *result.fallback_icon_style); |
| +#endif |
| + |
| callback.Run(base::RefCountedBytes::TakeVector(&bitmap_data)); |
| } |