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.
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_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/download/download_shelf_context_menu.h"
12 #include "chrome/browser/ui/gtk/menu_gtk.h"
14 class DownloadItemGtk;
16 class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu,
17 public MenuGtk::Delegate {
19 DownloadShelfContextMenuGtk(DownloadItemGtk* download_item,
20 content::PageNavigator* navigator);
21 virtual ~DownloadShelfContextMenuGtk();
23 void Popup(GtkWidget* widget, GdkEventButton* event);
27 virtual void StoppedShowing() OVERRIDE;
28 virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE;
30 // The menu we show on Popup(). We keep a pointer to it for a couple reasons:
31 // * we don't want to have to recreate the menu every time it's popped up.
32 // * we have to keep it in scope for longer than the duration of Popup(), or
33 // completing the user-selected action races against the menu's
35 scoped_ptr<MenuGtk> menu_;
37 // The download item that created us.
38 DownloadItemGtk* download_item_gtk_;
40 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuGtk);
43 #endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_