Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 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_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "chrome/browser/download/download_shelf_context_menu.h" | |
| 13 #include "chrome/browser/ui/gtk/menu_gtk.h" | |
| 14 | |
| 15 class BaseDownloadItemModel; | |
| 16 class DownloadItemGtk; | |
| 17 | |
| 18 class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu, | |
| 19 public MenuGtk::Delegate { | |
| 20 public: | |
| 21 // The constructor creates the menu and immediately pops it up. | |
| 22 // |model| is the download item model associated with this context menu, | |
| 23 // |widget| is the button that popped up this context menu, and |e| is | |
| 24 // the button press event that caused this menu to be created. | |
|
asanka
2011/05/20 21:23:52
Can this comment be cleaned up while you are here?
tfarina
2011/05/20 22:15:47
Removed.
| |
| 25 DownloadShelfContextMenuGtk(BaseDownloadItemModel* model, | |
| 26 DownloadItemGtk* download_item); | |
| 27 virtual ~DownloadShelfContextMenuGtk(); | |
| 28 | |
| 29 void Popup(GtkWidget* widget, GdkEventButton* event); | |
| 30 | |
| 31 private: | |
| 32 // MenuGtk::Delegate: | |
| 33 virtual void StoppedShowing() OVERRIDE; | |
| 34 virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE; | |
| 35 | |
| 36 // The menu we show on Popup(). We keep a pointer to it for a couple reasons: | |
| 37 // * we don't want to have to recreate the menu every time it's popped up. | |
| 38 // * we have to keep it in scope for longer than the duration of Popup(), or | |
| 39 // completing the user-selected action races against the menu's | |
| 40 // destruction. | |
| 41 scoped_ptr<MenuGtk> menu_; | |
| 42 | |
| 43 // The download item that created us. | |
| 44 DownloadItemGtk* download_item_gtk_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuGtk); | |
| 47 }; | |
| 48 | |
| 49 #endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_ | |
| OLD | NEW |