summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 00:25:43 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 00:25:43 +0000
commite2cb652d6f2b91c1ab51f7355f417f0390aaf312 (patch)
treeae902ce4c9d8eb36780c108c0ec517613d30fac4
parenta6dbdf7b66a75fc30de5fec8c6057cc32e7908f3 (diff)
downloadchromium_src-e2cb652d6f2b91c1ab51f7355f417f0390aaf312.zip
chromium_src-e2cb652d6f2b91c1ab51f7355f417f0390aaf312.tar.gz
chromium_src-e2cb652d6f2b91c1ab51f7355f417f0390aaf312.tar.bz2
Fall back to the chrome-themed default favicon if the gtk theme fails to produce one.
BUG=19994 Review URL: http://codereview.chromium.org/174267 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24191 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/gfx/canvas_linux.cc5
-rw-r--r--chrome/browser/gtk/bookmark_utils_gtk.cc30
2 files changed, 21 insertions, 14 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc
index 5d644ad..602edf5 100644
--- a/app/gfx/canvas_linux.cc
+++ b/app/gfx/canvas_linux.cc
@@ -231,6 +231,11 @@ void Canvas::DrawStringInt(const std::wstring& text,
}
void Canvas::DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y) {
+ if (!pixbuf) {
+ NOTREACHED();
+ return;
+ }
+
cairo_t* cr = beginPlatformPaint();
gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y);
cairo_paint(cr);
diff --git a/chrome/browser/gtk/bookmark_utils_gtk.cc b/chrome/browser/gtk/bookmark_utils_gtk.cc
index b08f4ff..aec8fa6 100644
--- a/chrome/browser/gtk/bookmark_utils_gtk.cc
+++ b/chrome/browser/gtk/bookmark_utils_gtk.cc
@@ -59,37 +59,39 @@ const char kBookmarkNode[] = "bookmark-node";
const int kBarButtonPadding = 4;
GdkPixbuf* GetFolderIcon(bool native) {
- if (!native) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- static GdkPixbuf* default_folder_icon = rb.GetPixbufNamed(
- IDR_BOOKMARK_BAR_FOLDER);
- return default_folder_icon;
- } else {
+ if (native) {
if (!icon_widget)
icon_widget = gtk_fixed_new();
// We never release our ref, so we will leak this on program shutdown.
static GdkPixbuf* default_folder_icon =
gtk_widget_render_icon(icon_widget, GTK_STOCK_DIRECTORY,
GTK_ICON_SIZE_MENU, NULL);
- return default_folder_icon;
+ if (default_folder_icon)
+ return default_folder_icon;
}
+
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ static GdkPixbuf* default_folder_icon = rb.GetPixbufNamed(
+ IDR_BOOKMARK_BAR_FOLDER);
+ return default_folder_icon;
}
GdkPixbuf* GetDefaultFavicon(bool native) {
- if (!native) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- static GdkPixbuf* default_bookmark_icon = rb.GetPixbufNamed(
- IDR_DEFAULT_FAVICON);
- return default_bookmark_icon;
- } else {
+ if (native) {
if (!icon_widget)
icon_widget = gtk_fixed_new();
// We never release our ref, so we will leak this on program shutdown.
static GdkPixbuf* default_bookmark_icon =
gtk_widget_render_icon(icon_widget, GTK_STOCK_FILE,
GTK_ICON_SIZE_MENU, NULL);
- return default_bookmark_icon;
+ if (default_bookmark_icon)
+ return default_bookmark_icon;
}
+
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ static GdkPixbuf* default_bookmark_icon = rb.GetPixbufNamed(
+ IDR_DEFAULT_FAVICON);
+ return default_bookmark_icon;
}
GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model,