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

Unified Diff: chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc

Issue 9535002: GTK: Update ImageLoadingTracker::Observer subclasses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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/gtk/create_application_shortcuts_dialog_gtk.cc
diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
index 92c8bfacfa70c9d504daec6f61c722be24161bd9..64e75c6790d18cacbd55b1056ba41891a3cb4f35 100644
--- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
@@ -25,6 +25,7 @@
#include "grit/theme_resources.h"
#include "ui/base/gtk/gtk_hig_constants.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/gtk_util.h"
using content::BrowserThread;
@@ -66,10 +67,10 @@ CreateApplicationShortcutsDialogGtk::CreateApplicationShortcutsDialogGtk(
}
void CreateApplicationShortcutsDialogGtk::CreateIconPixBuf(
- const SkBitmap& bitmap) {
+ const gfx::Image& image) {
// Prepare the icon. Try to scale it if it's too small, otherwise it would
// look weird.
- GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&shortcut_info_.favicon);
+ GdkPixbuf* pixbuf = image.ToGdkPixbuf();
int pixbuf_width = gdk_pixbuf_get_width(pixbuf);
int pixbuf_height = gdk_pixbuf_get_height(pixbuf);
if (pixbuf_width == pixbuf_height && pixbuf_width < kIconPreviewSizePixels) {
@@ -332,12 +333,16 @@ CreateChromeApplicationShortcutsDialogGtk::
// Called by tracker_ when the app's icon is loaded.
void CreateChromeApplicationShortcutsDialogGtk::OnImageLoaded(
- SkBitmap* image, const ExtensionResource& resource, int index) {
- if (!image || image->isNull())
- image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON);
-
- shortcut_info_.favicon = *image;
+ const gfx::Image& image,
+ const std::string& extension_id,
+ int index) {
+ if (image.IsEmpty()) {
+ shortcut_info_.favicon =
+ ResourceBundle::GetSharedInstance().GetImageNamed(IDR_APP_DEFAULT_ICON);
+ } else {
+ shortcut_info_.favicon = image;
+ }
- CreateIconPixBuf(*image);
+ CreateIconPixBuf(shortcut_info_.favicon);
CreateDialogBox(parent_);
}

Powered by Google App Engine
This is Rietveld 408576698