blob: 93308980057889486a28a29972cbe995ca83c4d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_GTK_H_
#define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_GTK_H_
#include <map>
#include <string>
#include <vector>
#include "base/scoped_ptr.h"
#include "chrome/browser/gtk/menu_gtk.h"
#include "chrome/browser/gtk/standard_menus.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "gfx/point.h"
class ContextMenuParams;
class RenderWidgetHostView;
// TODO(port): we need accelerator support for this class.
class RenderViewContextMenuGtk : public RenderViewContextMenu,
public MenuGtk::Delegate {
public:
RenderViewContextMenuGtk(TabContents* web_contents,
const ContextMenuParams& params,
uint32_t triggering_event_time);
~RenderViewContextMenuGtk();
// Show the menu at the given location.
void Popup(const gfx::Point& point);
// Menu::Delegate implementation ---------------------------------------------
virtual bool IsCommandEnabled(int id) const;
virtual bool IsItemChecked(int id) const;
virtual void ExecuteCommandById(int id);
virtual std::string GetLabel(int id) const;
virtual void StoppedShowing();
protected:
// RenderViewContextMenu implementation --------------------------------------
virtual void DoInit();
virtual void AppendMenuItem(int id);
virtual void AppendMenuItem(int id, const string16& label);
virtual void AppendRadioMenuItem(int id, const string16& label);
virtual void AppendCheckboxMenuItem(int id, const string16& label);
virtual void AppendSeparator();
virtual void StartSubMenu(int id, const string16& label);
virtual void FinishSubMenu();
private:
void AppendItem(int id, const string16& label, MenuItemType type);
static void DoneMakingMenu(std::vector<MenuCreateMaterial>* menu);
scoped_ptr<MenuGtk> gtk_menu_;
std::map<int, std::string> label_map_;
std::vector<MenuCreateMaterial> menu_;
std::vector<MenuCreateMaterial> submenu_;
bool making_submenu_;
uint32_t triggering_event_time_;
};
#endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_GTK_H_
|