OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/download/download_shelf_context_menu.h" | 11 #include "chrome/browser/download/download_shelf_context_menu.h" |
12 #include "chrome/browser/ui/gtk/menu_gtk.h" | 12 #include "chrome/browser/ui/gtk/menu_gtk.h" |
13 | 13 |
14 class DownloadItemGtk; | 14 class DownloadItemGtk; |
15 class DownloadItemModel; | |
16 | 15 |
17 class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu, | 16 class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu, |
18 public MenuGtk::Delegate { | 17 public MenuGtk::Delegate { |
19 public: | 18 public: |
20 DownloadShelfContextMenuGtk(DownloadItemModel* model, | 19 DownloadShelfContextMenuGtk(DownloadItemGtk* download_item, |
21 DownloadItemGtk* download_item, | |
22 content::PageNavigator* navigator); | 20 content::PageNavigator* navigator); |
23 virtual ~DownloadShelfContextMenuGtk(); | 21 virtual ~DownloadShelfContextMenuGtk(); |
24 | 22 |
25 void Popup(GtkWidget* widget, GdkEventButton* event); | 23 void Popup(GtkWidget* widget, GdkEventButton* event); |
26 | 24 |
27 private: | 25 private: |
28 // MenuGtk::Delegate: | 26 // MenuGtk::Delegate: |
29 virtual void StoppedShowing() OVERRIDE; | 27 virtual void StoppedShowing() OVERRIDE; |
30 virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE; | 28 virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE; |
31 | 29 |
32 // The menu we show on Popup(). We keep a pointer to it for a couple reasons: | 30 // The menu we show on Popup(). We keep a pointer to it for a couple reasons: |
33 // * we don't want to have to recreate the menu every time it's popped up. | 31 // * we don't want to have to recreate the menu every time it's popped up. |
34 // * we have to keep it in scope for longer than the duration of Popup(), or | 32 // * we have to keep it in scope for longer than the duration of Popup(), or |
35 // completing the user-selected action races against the menu's | 33 // completing the user-selected action races against the menu's |
36 // destruction. | 34 // destruction. |
37 scoped_ptr<MenuGtk> menu_; | 35 scoped_ptr<MenuGtk> menu_; |
38 | 36 |
39 // The download item that created us. | 37 // The download item that created us. |
40 DownloadItemGtk* download_item_gtk_; | 38 DownloadItemGtk* download_item_gtk_; |
41 | 39 |
42 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuGtk); | 40 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuGtk); |
43 }; | 41 }; |
44 | 42 |
45 #endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_ | 43 #endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_ |
OLD | NEW |