Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: chrome/browser/ui/gtk/menu_gtk.h

Issue 6840068: GTK: Add Recently Closed tabs to the History menu in the global menu bar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maybe abandoning this way Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/menu_gtk.h
diff --git a/chrome/browser/ui/gtk/menu_gtk.h b/chrome/browser/ui/gtk/menu_gtk.h
index 381993bbba5d367ffd4055807906588d3320b9c0..d8725b1a9e0a8956edb6aaecba1d6a548820a204 100644
--- a/chrome/browser/ui/gtk/menu_gtk.h
+++ b/chrome/browser/ui/gtk/menu_gtk.h
@@ -12,6 +12,7 @@
#include <vector>
#include "base/task.h"
+#include "chrome/browser/ui/gtk/gtk_menu_creator.h"
#include "ui/base/gtk/gtk_signal.h"
#include "ui/gfx/point.h"
@@ -22,10 +23,11 @@ class ButtonMenuItemModel;
class MenuModel;
}
-class MenuGtk {
+// MenuGtk both creates the menu.
+class MenuGtk : public GtkMenuCreator {
public:
// Delegate class that lets another class control the status of the menu.
- class Delegate {
+ class Delegate : public GtkMenuCreator::IconSource {
public:
virtual ~Delegate() { }
@@ -40,18 +42,6 @@ class MenuGtk {
// ExecuteCommand if the user clicks an item, but will also be called when
// the user clicks away from the menu.
virtual void StoppedShowing() {}
-
- // Return true if we should override the "gtk-menu-images" system setting
- // when showing image menu items for this menu.
- virtual bool AlwaysShowIconForCmd(int command_id) const { return false; }
-
- // Returns a tinted image used in button in a menu.
- virtual GtkIconSet* GetIconSetForId(int idr) { return NULL; }
-
- // Returns an icon for the menu item, if available.
- virtual GtkWidget* GetImageForCommandId(int command_id) const;
-
- static GtkWidget* GetDefaultImageForCommandId(int command_id);
};
MenuGtk(MenuGtk::Delegate* delegate, ui::MenuModel* model);
@@ -69,11 +59,6 @@ class MenuGtk {
const std::string& label);
GtkWidget* AppendSeparator();
GtkWidget* AppendMenuItem(int command_id, GtkWidget* menu_item);
- GtkWidget* AppendMenuItemToMenu(int index,
- ui::MenuModel* model,
- GtkWidget* menu_item,
- GtkWidget* menu,
- bool connect_to_activate);
// Displays the menu near a widget, as if the widget were a menu bar.
// Example: the wrench menu button.
@@ -123,26 +108,19 @@ class MenuGtk {
void UpdateMenu();
private:
- // Builds a GtkImageMenuItem.
- GtkWidget* BuildMenuItemWithImage(const std::string& label,
- const SkBitmap& icon);
-
- GtkWidget* BuildMenuItemWithImage(const std::string& label,
- GtkWidget* image);
-
- GtkWidget* BuildMenuItemWithLabel(const std::string& label,
- int command_id);
-
// A function that creates a GtkMenu from |model_|.
void BuildMenuFromModel();
- // Implementation of the above; called recursively.
- void BuildSubmenuFromModel(ui::MenuModel* model, GtkWidget* menu);
- // Builds a menu item with buttons in it from the data in the model.
- GtkWidget* BuildButtonMenuItem(ui::ButtonMenuItemModel* model,
- GtkWidget* menu);
void ExecuteCommand(ui::MenuModel* model, int id);
+ // MenuCreator:
+ virtual GtkWidget* AppendMenuItemToMenu(int index,
+ ui::MenuModel* model,
+ GtkWidget* menu_item,
+ GtkWidget* menu);
+ virtual GtkWidget* BuildButtonMenuItem(ui::ButtonMenuItemModel* model,
+ GtkWidget* menu);
+
// Callback for when a menu item is clicked.
CHROMEGTK_CALLBACK_0(MenuGtk, void, OnMenuItemActivated);
@@ -173,11 +151,6 @@ class MenuGtk {
// menu (overriding the delegate as a controller).
ui::MenuModel* model_;
- // For some menu items, we want to show the accelerator, but not actually
- // explicitly handle it. To this end we connect those menu items' accelerators
- // to this group, but don't attach this group to any top level window.
- GtkAccelGroup* dummy_accel_group_;
-
// gtk_menu_popup() does not appear to take ownership of popup menus, so
// MenuGtk explicitly manages the lifetime of the menu.
GtkWidget* menu_;

Powered by Google App Engine
This is Rietveld 408576698