| 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_SHELF_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ | 6 #define CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/gfx/native_widget_types.h" |
| 12 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/download/download_shelf.h" | 14 #include "chrome/browser/download/download_shelf.h" |
| 14 #include "chrome/common/owned_widget_gtk.h" | 15 #include "chrome/common/owned_widget_gtk.h" |
| 15 | 16 |
| 16 class BaseDownloadItemModel; | 17 class BaseDownloadItemModel; |
| 18 class Browser; |
| 17 class CustomDrawButton; | 19 class CustomDrawButton; |
| 18 class DownloadItemGtk; | 20 class DownloadItemGtk; |
| 19 class SlideAnimatorGtk; | 21 class SlideAnimatorGtk; |
| 20 | 22 |
| 21 class DownloadShelfGtk : public DownloadShelf { | 23 class DownloadShelfGtk : public DownloadShelf { |
| 22 public: | 24 public: |
| 23 explicit DownloadShelfGtk(TabContents* tab_contents); | 25 explicit DownloadShelfGtk(Browser* browser, gfx::NativeView view); |
| 24 | 26 |
| 25 ~DownloadShelfGtk(); | 27 ~DownloadShelfGtk(); |
| 26 | 28 |
| 27 // DownloadShelf implementation. | 29 // DownloadShelf implementation. |
| 28 virtual void AddDownload(BaseDownloadItemModel* download_model); | 30 virtual void AddDownload(BaseDownloadItemModel* download_model); |
| 29 virtual bool IsShowing() const; | 31 virtual bool IsShowing() const; |
| 30 virtual bool IsClosing() const; | 32 virtual bool IsClosing() const; |
| 33 virtual void Show(); |
| 34 virtual void Close(); |
| 35 |
| 36 // Returns the current height of the shelf. |
| 37 int GetHeight() const; |
| 31 | 38 |
| 32 private: | 39 private: |
| 33 // Remove |download_item| from the download shelf and delete it. | 40 // Remove |download_item| from the download shelf and delete it. |
| 34 void RemoveDownloadItem(DownloadItemGtk* download_item); | 41 void RemoveDownloadItem(DownloadItemGtk* download_item); |
| 35 | 42 |
| 36 // Get the leftmost non-download item widget on the shelf. | 43 // Get the leftmost non-download item widget on the shelf. |
| 37 GtkWidget* GetRightBoundingWidget() const; | 44 GtkWidget* GetRightBoundingWidget() const; |
| 38 | 45 |
| 39 // Get the hbox download items ought to pack themselves into. | 46 // Get the hbox download items ought to pack themselves into. |
| 40 GtkWidget* GetHBox() const; | 47 GtkWidget* GetHBox() const; |
| 41 | 48 |
| 42 static void OnButtonClick(GtkWidget* button, DownloadShelfGtk* toolbar); | 49 static void OnButtonClick(GtkWidget* button, DownloadShelfGtk* toolbar); |
| 43 | 50 |
| 44 // The top level widget of the shelf. | 51 // The top level widget of the shelf. |
| 45 scoped_ptr<SlideAnimatorGtk> slide_widget_; | 52 scoped_ptr<SlideAnimatorGtk> slide_widget_; |
| 46 | 53 |
| 47 // |hbox_| holds the download items and buttons of the shelf. | 54 // |hbox_| holds the download items and buttons of the shelf. |
| 48 GtkWidget* hbox_; | 55 OwnedWidgetGtk hbox_; |
| 49 | 56 |
| 50 // |shelf_| is the second highest level widget. See the constructor | 57 // |shelf_| is the second highest level widget. See the constructor |
| 51 // for an explanation of the widget layout. | 58 // for an explanation of the widget layout. |
| 52 OwnedWidgetGtk shelf_; | 59 OwnedWidgetGtk shelf_; |
| 53 | 60 |
| 54 // This hbox holds the link text and download icon. It also holds the | 61 // This hbox holds the link text and download icon. It also holds the |
| 55 // distinction of being the leftmost non-download item widget on the shelf. | 62 // distinction of being the leftmost non-download item widget on the shelf. |
| 56 GtkWidget* link_hbox_; | 63 GtkWidget* link_hbox_; |
| 57 | 64 |
| 58 // The 'x' that the user can press to hide the download shelf. | 65 // The 'x' that the user can press to hide the download shelf. |
| 59 scoped_ptr<CustomDrawButton> close_button_; | 66 scoped_ptr<CustomDrawButton> close_button_; |
| 60 | 67 |
| 61 // Keeps track of our current hide/show state. | 68 // Keeps track of our current hide/show state. |
| 62 bool is_showing_; | 69 bool is_showing_; |
| 63 | 70 |
| 64 // The download items we have added to our shelf. | 71 // The download items we have added to our shelf. |
| 65 std::vector<DownloadItemGtk*> download_items_; | 72 std::vector<DownloadItemGtk*> download_items_; |
| 66 | 73 |
| 67 friend class DownloadItemGtk; | 74 friend class DownloadItemGtk; |
| 68 }; | 75 }; |
| 69 | 76 |
| 70 #endif // CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ | 77 #endif // CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ |
| OLD | NEW |