| 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_COCOA_DOWNLOAD_SHELF_MAC_H_ |
| 6 #define CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ | 6 #define CHROME_BROWSER_COCOA_DOWNLOAD_SHELF_MAC_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/download/download_shelf.h" | 13 #include "chrome/browser/download/download_shelf.h" |
| 14 | 14 |
| 15 class BaseDownloadItemModel; | 15 class BaseDownloadItemModel; |
| 16 class CustomDrawButton; | 16 class CustomDrawButton; |
| 17 class DownloadItemGtk; | 17 class DownloadItemMac; |
| 18 | 18 |
| 19 class DownloadShelfGtk : public DownloadShelf { | 19 @class ShelfView; |
| 20 @class DownloadShelfController; |
| 21 |
| 22 // A class to bridge the chromium download shelf to mac gui. This is just a |
| 23 // wrapper class that forward everything to DownloadShelfController. |
| 24 |
| 25 class DownloadShelfMac : public DownloadShelf { |
| 20 public: | 26 public: |
| 21 explicit DownloadShelfGtk(TabContents* tab_contents); | 27 explicit DownloadShelfMac(Browser* browser, |
| 22 | 28 DownloadShelfController* controller); |
| 23 ~DownloadShelfGtk(); | |
| 24 | 29 |
| 25 // DownloadShelf implementation. | 30 // DownloadShelf implementation. |
| 26 virtual void AddDownload(BaseDownloadItemModel* download_model); | 31 virtual void AddDownload(BaseDownloadItemModel* download_model); |
| 27 virtual bool IsShowing() const; | 32 virtual bool IsShowing() const; |
| 33 virtual bool IsClosing() const; |
| 34 virtual void Show(); |
| 35 virtual void Close(); |
| 28 | 36 |
| 29 private: | 37 private: |
| 30 // Show the shelf. | 38 // The download items we have added to our shelf. |
| 31 void Show(); | 39 std::vector<DownloadItemMac*> download_items_; |
| 32 | 40 |
| 33 // Hide the shelf. | 41 DownloadShelfController* shelf_controller_; // weak, owns us |
| 34 void Hide(); | |
| 35 | |
| 36 static void OnButtonClick(GtkWidget* button, DownloadShelfGtk* toolbar); | |
| 37 | |
| 38 // |hbox_| holds the download items and buttons of the shelf. | |
| 39 GtkWidget* hbox_; | |
| 40 | |
| 41 // |shelf_| is the highest level widget of the shelf. See the constructor | |
| 42 // for an explanation of the widget layout. | |
| 43 GtkWidget* shelf_; | |
| 44 | |
| 45 // This hbox holds the link text and download icon. It also holds the | |
| 46 // distinction of being the leftmost non-download item widget on the shelf. | |
| 47 GtkWidget* link_hbox_; | |
| 48 | |
| 49 // The 'x' that the user can press to hide the download shelf. | |
| 50 scoped_ptr<CustomDrawButton> close_button_; | |
| 51 | |
| 52 // Keeps track of our current hide/show state. | |
| 53 bool is_showing_; | |
| 54 | |
| 55 // The download items we have added to our shelf. | |
| 56 std::vector<DownloadItemGtk*> download_items_; | |
| 57 }; | 42 }; |
| 58 | 43 |
| 59 #endif // CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ | 44 #endif // CHROME_BROWSER_COCOA_DOWNLOAD_SHELF_MAC_H_ |
| OLD | NEW |