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

Unified Diff: chrome/browser/ui/toolbar/back_forward_menu_model.cc

Issue 10824402: Convert ui::MenuModel to use gfx::Image instead of ImageSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another day, another rebase 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/toolbar/back_forward_menu_model.cc
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
index 7673fd632a4eaede2cad53f64eb7fd8d48441f3a..955a9e7bc380cefe82869b348e4ff24b0d696dfa 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
@@ -133,16 +133,16 @@ int BackForwardMenuModel::GetGroupIdAt(int index) const {
return false;
}
-bool BackForwardMenuModel::GetIconAt(int index, gfx::ImageSkia* icon) {
+bool BackForwardMenuModel::GetIconAt(int index, gfx::Image* icon) {
if (!ItemHasIcon(index))
return false;
if (index == GetItemCount() - 1) {
- *icon = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ *icon = ResourceBundle::GetSharedInstance().GetNativeImageNamed(
IDR_HISTORY_FAVICON);
} else {
NavigationEntry* entry = GetNavigationEntry(index);
- *icon = *entry->GetFavicon().image.ToImageSkia();
+ *icon = entry->GetFavicon().image;
if (!entry->GetFavicon().valid && menu_model_delegate()) {
FetchFavicon(entry);
}
@@ -277,17 +277,13 @@ void BackForwardMenuModel::OnFavIconDataAvailable(
// Now that we have a valid NavigationEntry, decode the favicon and assign
// it to the NavigationEntry.
- SkBitmap fav_icon;
- if (gfx::PNGCodec::Decode(favicon.image_data->front(),
- favicon.image_data->size(),
- &fav_icon)) {
+ gfx::Image icon(favicon.image_data->front(), favicon.image_data->size());
+ if (!icon.IsEmpty()) {
entry->GetFavicon().valid = true;
entry->GetFavicon().url = favicon.icon_url;
- if (fav_icon.empty())
- return;
// TODO: Once the history service returns more representations,
// use them all instead of having just the lodpi favicon.
- entry->GetFavicon().image = gfx::Image(fav_icon);
+ entry->GetFavicon().image = icon;
if (menu_model_delegate()) {
menu_model_delegate()->OnIconChanged(model_index);
}
« no previous file with comments | « chrome/browser/ui/toolbar/back_forward_menu_model.h ('k') | chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698