| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ | 6 #define CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "app/animation_delegate.h" | |
| 14 #include "app/gtk_signal.h" | 13 #include "app/gtk_signal.h" |
| 15 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 16 #include "base/time.h" | 15 #include "base/time.h" |
| 17 #include "chrome/browser/download/download_item.h" | 16 #include "chrome/browser/download/download_item.h" |
| 18 #include "chrome/browser/icon_manager.h" | 17 #include "chrome/browser/icon_manager.h" |
| 19 #include "chrome/browser/gtk/owned_widget_gtk.h" | 18 #include "chrome/browser/gtk/owned_widget_gtk.h" |
| 20 #include "chrome/common/notification_observer.h" | 19 #include "chrome/common/notification_observer.h" |
| 21 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
| 21 #include "ui/base/animation/animation_delegate.h" |
| 22 | 22 |
| 23 class BaseDownloadItemModel; | 23 class BaseDownloadItemModel; |
| 24 class DownloadShelfContextMenuGtk; | 24 class DownloadShelfContextMenuGtk; |
| 25 class DownloadShelfGtk; | 25 class DownloadShelfGtk; |
| 26 class GtkThemeProvider; | 26 class GtkThemeProvider; |
| 27 class NineBox; | 27 class NineBox; |
| 28 class SkBitmap; | 28 class SkBitmap; |
| 29 |
| 30 namespace ui { |
| 29 class SlideAnimation; | 31 class SlideAnimation; |
| 32 } |
| 30 | 33 |
| 31 class DownloadItemGtk : public DownloadItem::Observer, | 34 class DownloadItemGtk : public DownloadItem::Observer, |
| 32 public AnimationDelegate, | 35 public ui::AnimationDelegate, |
| 33 public NotificationObserver { | 36 public NotificationObserver { |
| 34 public: | 37 public: |
| 35 // DownloadItemGtk takes ownership of |download_item_model|. | 38 // DownloadItemGtk takes ownership of |download_item_model|. |
| 36 DownloadItemGtk(DownloadShelfGtk* parent_shelf, | 39 DownloadItemGtk(DownloadShelfGtk* parent_shelf, |
| 37 BaseDownloadItemModel* download_item_model); | 40 BaseDownloadItemModel* download_item_model); |
| 38 | 41 |
| 39 // Destroys all widgets belonging to this DownloadItemGtk. | 42 // Destroys all widgets belonging to this DownloadItemGtk. |
| 40 ~DownloadItemGtk(); | 43 ~DownloadItemGtk(); |
| 41 | 44 |
| 42 // DownloadItem::Observer implementation. | 45 // DownloadItem::Observer implementation. |
| 43 virtual void OnDownloadUpdated(DownloadItem* download); | 46 virtual void OnDownloadUpdated(DownloadItem* download); |
| 44 virtual void OnDownloadFileCompleted(DownloadItem* download) { } | 47 virtual void OnDownloadFileCompleted(DownloadItem* download) { } |
| 45 virtual void OnDownloadOpened(DownloadItem* download) { } | 48 virtual void OnDownloadOpened(DownloadItem* download) { } |
| 46 | 49 |
| 47 // AnimationDelegate implementation. | 50 // ui::AnimationDelegate implementation. |
| 48 virtual void AnimationProgressed(const Animation* animation); | 51 virtual void AnimationProgressed(const ui::Animation* animation); |
| 49 | 52 |
| 50 // Overridden from NotificationObserver: | 53 // Overridden from NotificationObserver: |
| 51 virtual void Observe(NotificationType type, | 54 virtual void Observe(NotificationType type, |
| 52 const NotificationSource& source, | 55 const NotificationSource& source, |
| 53 const NotificationDetails& details); | 56 const NotificationDetails& details); |
| 54 | 57 |
| 55 // Called when the icon manager has finished loading the icon. We take | 58 // Called when the icon manager has finished loading the icon. We take |
| 56 // ownership of |icon_bitmap|. | 59 // ownership of |icon_bitmap|. |
| 57 void OnLoadSmallIconComplete(IconManager::Handle handle, | 60 void OnLoadSmallIconComplete(IconManager::Handle handle, |
| 58 SkBitmap* icon_bitmap); | 61 SkBitmap* icon_bitmap); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 GtkWidget* dangerous_prompt_; | 185 GtkWidget* dangerous_prompt_; |
| 183 GtkWidget* dangerous_image_; | 186 GtkWidget* dangerous_image_; |
| 184 GtkWidget* dangerous_label_; | 187 GtkWidget* dangerous_label_; |
| 185 | 188 |
| 186 // An hbox for holding components of the dangerous download dialog. | 189 // An hbox for holding components of the dangerous download dialog. |
| 187 GtkWidget* dangerous_hbox_; | 190 GtkWidget* dangerous_hbox_; |
| 188 int dangerous_hbox_start_width_; | 191 int dangerous_hbox_start_width_; |
| 189 int dangerous_hbox_full_width_; | 192 int dangerous_hbox_full_width_; |
| 190 | 193 |
| 191 // The animation when this item is first added to the shelf. | 194 // The animation when this item is first added to the shelf. |
| 192 scoped_ptr<SlideAnimation> new_item_animation_; | 195 scoped_ptr<ui::SlideAnimation> new_item_animation_; |
| 193 | 196 |
| 194 // Progress animation. | 197 // Progress animation. |
| 195 base::RepeatingTimer<DownloadItemGtk> progress_timer_; | 198 base::RepeatingTimer<DownloadItemGtk> progress_timer_; |
| 196 | 199 |
| 197 // Animation for download complete. | 200 // Animation for download complete. |
| 198 scoped_ptr<SlideAnimation> complete_animation_; | 201 scoped_ptr<ui::SlideAnimation> complete_animation_; |
| 199 | 202 |
| 200 // The file icon for the download. May be null. The small version is used | 203 // The file icon for the download. May be null. The small version is used |
| 201 // for display in the shelf; the large version is for use as a drag icon. | 204 // for display in the shelf; the large version is for use as a drag icon. |
| 202 SkBitmap* icon_small_; | 205 SkBitmap* icon_small_; |
| 203 SkBitmap* icon_large_; | 206 SkBitmap* icon_large_; |
| 204 | 207 |
| 205 // The last download file path for which we requested an icon. | 208 // The last download file path for which we requested an icon. |
| 206 FilePath icon_filepath_; | 209 FilePath icon_filepath_; |
| 207 | 210 |
| 208 NotificationRegistrar registrar_; | 211 NotificationRegistrar registrar_; |
| 209 | 212 |
| 210 // The time at which we were insantiated. | 213 // The time at which we were insantiated. |
| 211 base::Time creation_time_; | 214 base::Time creation_time_; |
| 212 | 215 |
| 213 // For canceling an in progress icon request. | 216 // For canceling an in progress icon request. |
| 214 CancelableRequestConsumerT<int, 0> icon_consumer_; | 217 CancelableRequestConsumerT<int, 0> icon_consumer_; |
| 215 }; | 218 }; |
| 216 | 219 |
| 217 #endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ | 220 #endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ |
| OLD | NEW |