diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 18:10:18 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 18:10:18 +0000 |
commit | 5a05dd8983fc0da2adf161509cfdb760592b7fe1 (patch) | |
tree | bc5744df02b9fc2390acbee93ff76c185466d4e0 | |
parent | 3856915fc4df49cdc68a63ba5875031ed9701281 (diff) | |
download | chromium_src-5a05dd8983fc0da2adf161509cfdb760592b7fe1.zip chromium_src-5a05dd8983fc0da2adf161509cfdb760592b7fe1.tar.gz chromium_src-5a05dd8983fc0da2adf161509cfdb760592b7fe1.tar.bz2 |
GTK: Make the bookmark menu controller use the GTK-native folder/default favicon images.
BUG=13320
Review URL: http://codereview.chromium.org/188001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25201 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/bookmark_menu_controller_gtk.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc b/chrome/browser/gtk/bookmark_menu_controller_gtk.cc index de4b885..e17a918b 100644 --- a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc +++ b/chrome/browser/gtk/bookmark_menu_controller_gtk.cc @@ -30,8 +30,10 @@ namespace { // TODO(estade): It might be a good idea to vary this by locale. const int kMaxChars = 50; -void SetImageMenuItem(GtkWidget* menu_item, const SkBitmap& bitmap) { - GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); +void SetImageMenuItem(GtkWidget* menu_item, + const BookmarkNode* node, + BookmarkModel* model) { + GdkPixbuf* pixbuf = bookmark_utils::GetPixbufForNode(node, model, true); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), gtk_image_new_from_pixbuf(pixbuf)); g_object_unref(pixbuf); @@ -128,7 +130,7 @@ void BookmarkMenuController::BookmarkNodeFavIconLoaded( std::map<const BookmarkNode*, GtkWidget*>::iterator it = node_to_menu_widget_map_.find(node); if (it != node_to_menu_widget_map_.end()) - SetImageMenuItem(it->second, model->GetFavIcon(node)); + SetImageMenuItem(it->second, node, model); } void BookmarkMenuController::NavigateToMenuItem( @@ -160,23 +162,14 @@ void BookmarkMenuController::BuildMenu(const BookmarkNode* parent, GtkWidget* menu_item = gtk_image_menu_item_new_with_label(WideToUTF8(elided_name).c_str()); g_object_set_data(G_OBJECT(menu_item), "bookmark-node", AsVoid(node)); + SetImageMenuItem(menu_item, node, profile_->GetBookmarkModel()); if (node->is_url()) { - SkBitmap icon = profile_->GetBookmarkModel()->GetFavIcon(node); - if (icon.width() == 0) { - icon = *ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_DEFAULT_FAVICON); - } - SetImageMenuItem(menu_item, icon); g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(OnMenuItemActivated), this); g_signal_connect(G_OBJECT(menu_item), "button-release-event", G_CALLBACK(OnButtonReleased), this); } else if (node->is_folder()) { - SkBitmap* folder_icon = ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); - SetImageMenuItem(menu_item, *folder_icon); - GtkWidget* submenu = gtk_menu_new(); BuildMenu(node, 0, submenu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); |