summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/download_item_gtk.cc23
-rw-r--r--chrome/browser/icon_manager.h8
2 files changed, 22 insertions, 9 deletions
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc
index 744f8fc..6ed474f 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/gtk/download_item_gtk.cc
@@ -603,9 +603,24 @@ gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget,
// TODO(estade): draw a default icon if |icon_| is null.
if (download_item->icon_) {
- canvas.DrawBitmapInt(*download_item->icon_,
- widget->allocation.x + download_util::kSmallProgressIconOffset,
- widget->allocation.y + download_util::kSmallProgressIconOffset);
+ int width = download_item->icon_->width();
+ int height = download_item->icon_->height();
+ // Sometimes we get back icons that are the wrong size. Draw the correct
+ // size. This code should hopefully be made obsolete after we support SVG
+ // icons (although it could still be hit if a theme doesn't provide SVG or
+ // 16x16).
+ const int sixteen = download_util::kSmallIconSize;
+ const int offset = download_util::kSmallProgressIconOffset;
+ if (sixteen != width || sixteen != height) {
+ // Draw the bitmap at a reduced scale.
+ download_item->icon_->buildMipMap(false);
+ canvas.DrawBitmapInt(*download_item->icon_, 0, 0, width, height,
+ widget->allocation.x + offset, widget->allocation.y + offset,
+ sixteen, sixteen, true);
+ } else {
+ canvas.DrawBitmapInt(*download_item->icon_,
+ widget->allocation.x + offset, widget->allocation.y + offset);
+ }
}
return TRUE;
@@ -621,8 +636,6 @@ gboolean DownloadItemGtk::OnMenuButtonPressEvent(GtkWidget* button,
item->complete_animation_->End();
}
- // TODO(port): this never puts the button into the "active" state,
- // so this may need to be changed. See note in BrowserToolbarGtk.
if (event->type == GDK_BUTTON_PRESS) {
GdkEventButton* event_button = reinterpret_cast<GdkEventButton*>(event);
if (event_button->button == 1) {
diff --git a/chrome/browser/icon_manager.h b/chrome/browser/icon_manager.h
index 44d17da..1bb8fdf 100644
--- a/chrome/browser/icon_manager.h
+++ b/chrome/browser/icon_manager.h
@@ -70,15 +70,15 @@ class IconManager : public IconLoader::Delegate,
SkBitmap* LookupIcon(const FilePath& file_name,
IconLoader::IconSize size);
+ typedef CancelableRequestProvider::Handle Handle;
+ typedef Callback2<Handle, SkBitmap*>::Type IconRequestCallback;
+
// Asynchronous call to lookup and return the icon associated with file. The
// work is done on the file thread, with the callbacks running on the UI
// thread. The return value is the 'request_id' that will be passed to the
- // client in the callback.
+ // client in the callback. Note: this does *not* check the cache.
//
// WATCH OUT: The returned bitmap pointer may be NULL if decoding failed.
- typedef CancelableRequestProvider::Handle Handle;
- typedef Callback2<Handle, SkBitmap*>::Type IconRequestCallback;
-
Handle LoadIcon(const FilePath& file_name,
IconLoader::IconSize size,
CancelableRequestConsumerBase* consumer,