Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / gtk / download / download_shelf_context_menu_gtk.h
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
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"
13
14 class DownloadItemGtk;
15
16 class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu,
17                                     public MenuGtk::Delegate {
18  public:
19   DownloadShelfContextMenuGtk(DownloadItemGtk* download_item,
20                               content::PageNavigator* navigator);
21   virtual ~DownloadShelfContextMenuGtk();
22
23   void Popup(GtkWidget* widget, GdkEventButton* event);
24
25  private:
26   // MenuGtk::Delegate:
27   virtual void StoppedShowing() OVERRIDE;
28   virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE;
29
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
34   //    destruction.
35   scoped_ptr<MenuGtk> menu_;
36
37   // The download item that created us.
38   DownloadItemGtk* download_item_gtk_;
39
40   DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuGtk);
41 };
42
43 #endif  // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_GTK_H_