summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 17:52:42 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 17:52:42 +0000
commit4762a9ed08ec93918b58269c21f78df72bc4961e (patch)
tree54d16d9220f4d075e14f9f2e5e32fbc4470c4d3d /app
parent0137991d3c78ec95d6d7fc386ae151d4359b308c (diff)
downloadchromium_src-4762a9ed08ec93918b58269c21f78df72bc4961e.zip
chromium_src-4762a9ed08ec93918b58269c21f78df72bc4961e.tar.gz
chromium_src-4762a9ed08ec93918b58269c21f78df72bc4961e.tar.bz2
Make a MenuModel for the popup favicon menu. For now only GTK uses it. Consolidate all accelerators for browser commands into one place.
BUG=28212,27535 TEST=1. enable custom frame and a popup window and test that the popup contains all the same (non-system) menu items as windows. 2. all context menus still display the correct shortcuts and the shortcuts work Review URL: http://codereview.chromium.org/551032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36527 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/menus/accelerator_gtk.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/app/menus/accelerator_gtk.h b/app/menus/accelerator_gtk.h
index ad74b4e..90c205f 100644
--- a/app/menus/accelerator_gtk.h
+++ b/app/menus/accelerator_gtk.h
@@ -16,7 +16,8 @@ namespace menus {
class AcceleratorGtk : public Accelerator {
public:
AcceleratorGtk(base::KeyboardCode key_code,
- bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
+ bool shift_pressed, bool ctrl_pressed, bool alt_pressed)
+ : gdk_keyval_(0) {
key_code_ = key_code;
modifiers_ = 0;
if (shift_pressed)
@@ -27,20 +28,31 @@ class AcceleratorGtk : public Accelerator {
modifiers_ |= GDK_MOD1_MASK;
}
- AcceleratorGtk() { }
+ AcceleratorGtk(guint keyval, GdkModifierType modifier_type) {
+ key_code_ = base::WindowsKeyCodeForGdkKeyCode(keyval);
+ gdk_keyval_ = keyval;
+ modifiers_ = modifier_type;
+ }
+
+ AcceleratorGtk() : gdk_keyval_(0) { }
virtual ~AcceleratorGtk() { }
- guint GetGdkKeyCode() {
- // The second parameter is false because accelerator keys are expressed in
- // terms of the non-shift-modified key.
- return base::GdkKeyCodeForWindowsKeyCode(GetKeyCode(), false);
+ guint GetGdkKeyCode() const {
+ return gdk_keyval_ > 0 ?
+ // The second parameter is false because accelerator keys are
+ // expressed in terms of the non-shift-modified key.
+ gdk_keyval_ : base::GdkKeyCodeForWindowsKeyCode(key_code_, false);
}
GdkModifierType gdk_modifier_type() {
return static_cast<GdkModifierType>(modifiers());
}
+
+ private:
+ // The GDK keycode.
+ guint gdk_keyval_;
};
-}
+} // namespace menus
#endif // APP_MENUS_ACCELERATOR_GTK_H_