| 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 3fd2dbdc7e437f1d90976148930d77638d4a0f72..3d19f78a783c2b0cc5d43de2782ce2eb87812905 100644
|
| --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
|
| +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc
|
| @@ -33,8 +33,8 @@
|
| #include "ui/base/gtk/gtk_hig_constants.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/gfx/gtk_util.h"
|
| +#include "ui/gfx/icon_family.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| -#include "ui/gfx/image/image_skia_rep.h"
|
|
|
| using content::BrowserThread;
|
| using extensions::Extension;
|
| @@ -83,37 +83,15 @@ CreateApplicationShortcutsDialogGtk::CreateApplicationShortcutsDialogGtk(
|
| }
|
|
|
| void CreateApplicationShortcutsDialogGtk::CreateIconPixBuf(
|
| - const gfx::Image& image) {
|
| - const gfx::ImageSkia& image_skia = *(image.ToImageSkia());
|
| - std::vector<gfx::ImageSkiaRep> image_reps = image_skia.image_reps();
|
| - // Find the smallest icon bigger or equal to the desired size. If it cannot be
|
| - // found, find the biggest icon smaller than the desired size.
|
| - const gfx::ImageSkiaRep* smallest_larger = NULL;
|
| - const gfx::ImageSkiaRep* largest_smaller = NULL;
|
| - for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin();
|
| - it != image_reps.end(); ++it) {
|
| - if (it->pixel_width() >= kIconPreviewSizePixels) {
|
| - if (!smallest_larger ||
|
| - it->pixel_width() < smallest_larger->pixel_width()) {
|
| - smallest_larger = &*it;
|
| - }
|
| - } else {
|
| - if (!largest_smaller ||
|
| - it->pixel_width() > largest_smaller->pixel_width()) {
|
| - largest_smaller = &*it;
|
| - }
|
| - }
|
| - }
|
| - GdkPixbuf* pixbuf;
|
| - if (smallest_larger) {
|
| - pixbuf = gfx::GdkPixbufFromSkBitmap(smallest_larger->sk_bitmap());
|
| - } else if (largest_smaller) {
|
| - pixbuf = gfx::GdkPixbufFromSkBitmap(largest_smaller->sk_bitmap());
|
| - } else {
|
| - // Should never happen unless the image has no representations. Call
|
| - // ToGdkPixbuf which will presumably return a null image representation.
|
| - pixbuf = static_cast<GdkPixbuf*>(g_object_ref(image.ToGdkPixbuf()));
|
| - }
|
| + const gfx::IconFamily& image) {
|
| + // Get the icon closest to the desired preview size.
|
| + const gfx::ImageSkia* icon = image.Get(kIconPreviewSizePixels,
|
| + kIconPreviewSizePixels);
|
| + if (!icon)
|
| + // The family has no icons. Leave the pixbuf as NULL.
|
| + return;
|
| +
|
| + GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(*icon->bitmap());
|
| // Prepare the icon. Scale it to the correct size to display in the dialog.
|
| int pixbuf_width = gdk_pixbuf_get_width(pixbuf);
|
| int pixbuf_height = gdk_pixbuf_get_height(pixbuf);
|
|
|