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

Unified Diff: chrome/browser/ui/cocoa/history_menu_bridge.mm

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/cocoa/history_menu_bridge.mm
diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm
index 5b2cc84034a8b09d7e1fae3add4b503588db5c0a..56ed14d524508acc1babe0be280e59aaa2f63021 100644
--- a/chrome/browser/ui/cocoa/history_menu_bridge.mm
+++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm
@@ -462,7 +462,8 @@ void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) {
}
void HistoryMenuBridge::GotFaviconData(FaviconService::Handle handle,
- history::FaviconData favicon) {
+ history::FaviconData favicon_data,
+ std::vector<GURL> icon_urls_in_db) {
// Since we're going to do Cocoa-y things, make sure this is the main thread.
DCHECK([NSThread isMainThread]);
@@ -476,14 +477,17 @@ void HistoryMenuBridge::GotFaviconData(FaviconService::Handle handle,
// Convert the raw data to Skia and then to a NSImage.
// TODO(rsesek): Is there an easier way to do this?
SkBitmap icon;
- if (favicon.is_valid() &&
- gfx::PNGCodec::Decode(favicon.image_data->front(),
- favicon.image_data->size(), &icon)) {
- NSImage* image = gfx::SkBitmapToNSImage(icon);
- if (image) {
- // The conversion was successful.
- item->icon.reset([image retain]);
- [item->menu_item setImage:item->icon.get()];
+ if (favicon_data.has_valid_bitmaps()) {
+ scoped_refptr<base::RefCountedMemory> bitmap_data =
+ favicon_data.first_bitmap();
+ if (gfx::PNGCodec::Decode(bitmap_data->front(),
sky 2012/08/23 15:50:38 Would be nice if there was a method on favicondata
+ bitmap_data->size(), &icon)) {
+ NSImage* image = gfx::SkBitmapToNSImage(icon);
+ if (image) {
+ // The conversion was successful.
+ item->icon.reset([image retain]);
+ [item->menu_item setImage:item->icon.get()];
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698