| 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 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "app/animation.h" | 10 #include "app/animation.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/download/download_manager.h" | 12 #include "chrome/browser/download/download_manager.h" |
| 13 #include "chrome/browser/icon_manager.h" | 13 #include "chrome/browser/icon_manager.h" |
| 14 #include "chrome/common/owned_widget_gtk.h" |
| 14 | 15 |
| 15 class BaseDownloadItemModel; | 16 class BaseDownloadItemModel; |
| 16 class DownloadShelfContextMenuGtk; | 17 class DownloadShelfContextMenuGtk; |
| 17 class DownloadShelfGtk; | 18 class DownloadShelfGtk; |
| 18 class NineBox; | 19 class NineBox; |
| 19 class SkBitmap; | 20 class SkBitmap; |
| 20 class SlideAnimation; | 21 class SlideAnimation; |
| 21 | 22 |
| 22 class DownloadItemGtk : public DownloadItem::Observer, | 23 class DownloadItemGtk : public DownloadItem::Observer, |
| 23 public AnimationDelegate { | 24 public AnimationDelegate { |
| 24 public: | 25 public: |
| 25 // DownloadItemGtk takes ownership of |download_item_model|. | 26 // DownloadItemGtk takes ownership of |download_item_model|. |
| 26 DownloadItemGtk(DownloadShelfGtk* parent_shelf, | 27 DownloadItemGtk(DownloadShelfGtk* parent_shelf, |
| 27 BaseDownloadItemModel* download_item_model); | 28 BaseDownloadItemModel* download_item_model); |
| 28 | 29 |
| 29 // We put |hbox_| in |parent_shelf| and rely on |parent_shelf| recursively | 30 // Destroys all widgets belonging to this DownloadItemGtk. |
| 30 // destroying its children. Hence we do nothing in the destructor. | |
| 31 ~DownloadItemGtk(); | 31 ~DownloadItemGtk(); |
| 32 | 32 |
| 33 // DownloadItem::Observer implementation. | 33 // DownloadItem::Observer implementation. |
| 34 virtual void OnDownloadUpdated(DownloadItem* download); | 34 virtual void OnDownloadUpdated(DownloadItem* download); |
| 35 virtual void OnDownloadOpened(DownloadItem* download) { } | 35 virtual void OnDownloadOpened(DownloadItem* download) { } |
| 36 | 36 |
| 37 // AnimationDelegate implementation. | 37 // AnimationDelegate implementation. |
| 38 virtual void AnimationProgressed(const Animation* animation); | 38 virtual void AnimationProgressed(const Animation* animation); |
| 39 | 39 |
| 40 // Called when the icon manager has finished loading the icon. We take | 40 // Called when the icon manager has finished loading the icon. We take |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 static NineBox* menu_nine_box_prelight_; | 102 static NineBox* menu_nine_box_prelight_; |
| 103 static NineBox* menu_nine_box_active_; | 103 static NineBox* menu_nine_box_active_; |
| 104 | 104 |
| 105 // Ninebox for the background of the dangerous download prompt. | 105 // Ninebox for the background of the dangerous download prompt. |
| 106 static NineBox* dangerous_nine_box_; | 106 static NineBox* dangerous_nine_box_; |
| 107 | 107 |
| 108 // The shelf on which we are displayed. | 108 // The shelf on which we are displayed. |
| 109 DownloadShelfGtk* parent_shelf_; | 109 DownloadShelfGtk* parent_shelf_; |
| 110 | 110 |
| 111 // The widget that contains the body and menu dropdown. | 111 // The widget that contains the body and menu dropdown. |
| 112 GtkWidget* hbox_; | 112 OwnedWidgetGtk hbox_; |
| 113 | 113 |
| 114 // The widget that contains the name of the download and the progress | 114 // The widget that contains the name of the download and the progress |
| 115 // animation. | 115 // animation. |
| 116 GtkWidget* body_; | 116 OwnedWidgetGtk body_; |
| 117 | 117 |
| 118 // The GtkLabel that holds the download title text. | 118 // The GtkLabel that holds the download title text. |
| 119 GtkWidget* name_label_; | 119 GtkWidget* name_label_; |
| 120 | 120 |
| 121 // The GtkLabel that holds the status text. | 121 // The GtkLabel that holds the status text. |
| 122 GtkWidget* status_label_; | 122 GtkWidget* status_label_; |
| 123 | 123 |
| 124 // The widget that creates a dropdown menu when pressed. | 124 // The widget that creates a dropdown menu when pressed. |
| 125 GtkWidget* menu_button_; | 125 GtkWidget* menu_button_; |
| 126 | 126 |
| 127 // Whether the menu is currently showing for |menu_button_|. Affects how we | 127 // Whether the menu is currently showing for |menu_button_|. Affects how we |
| 128 // draw the button. | 128 // draw the button. |
| 129 bool menu_showing_; | 129 bool menu_showing_; |
| 130 | 130 |
| 131 // The widget that contains the animation progress and the file's icon | 131 // The widget that contains the animation progress and the file's icon |
| 132 // (as well as the complete animation). | 132 // (as well as the complete animation). |
| 133 GtkWidget* progress_area_; | 133 OwnedWidgetGtk progress_area_; |
| 134 | 134 |
| 135 // In degrees. Only used for downloads with no known total size. | 135 // In degrees. Only used for downloads with no known total size. |
| 136 int progress_angle_; | 136 int progress_angle_; |
| 137 | 137 |
| 138 // The menu that pops down when the user presses |menu_button_|. We do not | 138 // The menu that pops down when the user presses |menu_button_|. We do not |
| 139 // create this until the first time we actually need it. | 139 // create this until the first time we actually need it. |
| 140 scoped_ptr<DownloadShelfContextMenuGtk> menu_; | 140 scoped_ptr<DownloadShelfContextMenuGtk> menu_; |
| 141 | 141 |
| 142 // The download item model we represent. | 142 // The download item model we represent. |
| 143 scoped_ptr<BaseDownloadItemModel> download_model_; | 143 scoped_ptr<BaseDownloadItemModel> download_model_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 168 scoped_ptr<SlideAnimation> complete_animation_; | 168 scoped_ptr<SlideAnimation> complete_animation_; |
| 169 | 169 |
| 170 // The file icon for the download. May be null. | 170 // The file icon for the download. May be null. |
| 171 SkBitmap* icon_; | 171 SkBitmap* icon_; |
| 172 | 172 |
| 173 // For canceling an in progress icon request. | 173 // For canceling an in progress icon request. |
| 174 CancelableRequestConsumerT<int, 0> icon_consumer_; | 174 CancelableRequestConsumerT<int, 0> icon_consumer_; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 #endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ | 177 #endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ |
| OLD | NEW |