Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1367)

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 305dac0fd1c92b28296a6a71121b03d42046352d..62e56a59de684b1533051455066e6b1afc88f8b7 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -754,7 +754,8 @@ void AppLauncherHandler::HandleSetNotificationsDisabled(
}
void AppLauncherHandler::OnFaviconForApp(FaviconService::Handle handle,
- history::FaviconData data) {
+ history::FaviconData data,
+ std::vector<GURL> icon_urls_in_db) {
scoped_ptr<AppInstallInfo> install_info(
favicon_consumer_.GetClientDataForCurrentRequest());
scoped_ptr<WebApplicationInfo> web_app(new WebApplicationInfo());
@@ -765,16 +766,21 @@ void AppLauncherHandler::OnFaviconForApp(FaviconService::Handle handle,
WebApplicationInfo::IconInfo icon;
web_app->icons.push_back(icon);
- if (data.is_valid() && gfx::PNGCodec::Decode(data.image_data->front(),
- data.image_data->size(),
- &(web_app->icons[0].data))) {
- web_app->icons[0].url = GURL();
- web_app->icons[0].width = web_app->icons[0].data.width();
- web_app->icons[0].height = web_app->icons[0].data.height();
- } else {
- web_app->icons.clear();
+ bool bitmap_data_valid = false;
+ if (data.has_valid_bitmaps()) {
+ scoped_refptr<base::RefCountedMemory> bitmap_data(data.first_bitmap());
+ if (gfx::PNGCodec::Decode(bitmap_data->front(), bitmap_data->size(),
+ &(web_app->icons[0].data))) {
+ bitmap_data_valid = true;
+ web_app->icons[0].url = GURL();
sky 2012/08/23 15:50:38 I realize your copying code, but is this line nece
+ web_app->icons[0].width = web_app->icons[0].data.width();
+ web_app->icons[0].height = web_app->icons[0].data.height();
+ }
}
+ if (!bitmap_data_valid)
+ web_app->icons.clear();
+
scoped_refptr<CrxInstaller> installer(
CrxInstaller::Create(extension_service_, NULL));
installer->set_page_ordinal(install_info->page_ordinal);

Powered by Google App Engine
This is Rietveld 408576698