summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-05 22:49:58 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-05 22:49:58 +0000
commit0f28580a84220d218288bfdec6bb689b2e1b8d29 (patch)
tree2034a137103f04f513b6ab0d4cc3cbb13ccdd30f /app
parent4a4d141960653d52e80b52c92358b6f19fc21b1b (diff)
downloadchromium_src-0f28580a84220d218288bfdec6bb689b2e1b8d29.zip
chromium_src-0f28580a84220d218288bfdec6bb689b2e1b8d29.tar.gz
chromium_src-0f28580a84220d218288bfdec6bb689b2e1b8d29.tar.bz2
GTK: make tab context menu use tab_menu_model
flesh out some more menu model implementation for MenuGtk BUG=28977 TEST=menu still works as before Review URL: http://codereview.chromium.org/523049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35569 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/app_base.gypi1
-rw-r--r--app/menus/accelerator_gtk.h46
2 files changed, 47 insertions, 0 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi
index 9c15d4c..f0aacef 100644
--- a/app/app_base.gypi
+++ b/app/app_base.gypi
@@ -159,6 +159,7 @@
'l10n_util_win.cc',
'l10n_util_win.h',
'menus/accelerator.h',
+ 'menus/accelerator_gtk.h',
'menus/menu_model.cc',
'menus/menu_model.h',
'menus/simple_menu_model.cc',
diff --git a/app/menus/accelerator_gtk.h b/app/menus/accelerator_gtk.h
new file mode 100644
index 0000000..ad74b4e
--- /dev/null
+++ b/app/menus/accelerator_gtk.h
@@ -0,0 +1,46 @@
+// 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 APP_MENUS_ACCELERATOR_GTK_H_
+#define APP_MENUS_ACCELERATOR_GTK_H_
+
+#include <gdk/gdk.h>
+
+#include "app/menus/accelerator.h"
+#include "base/keyboard_code_conversion_gtk.h"
+#include "base/keyboard_codes_posix.h"
+
+namespace menus {
+
+class AcceleratorGtk : public Accelerator {
+ public:
+ AcceleratorGtk(base::KeyboardCode key_code,
+ bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
+ key_code_ = key_code;
+ modifiers_ = 0;
+ if (shift_pressed)
+ modifiers_ |= GDK_SHIFT_MASK;
+ if (ctrl_pressed)
+ modifiers_ |= GDK_CONTROL_MASK;
+ if (alt_pressed)
+ modifiers_ |= GDK_MOD1_MASK;
+ }
+
+ AcceleratorGtk() { }
+ 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);
+ }
+
+ GdkModifierType gdk_modifier_type() {
+ return static_cast<GdkModifierType>(modifiers());
+ }
+};
+
+}
+
+#endif // APP_MENUS_ACCELERATOR_GTK_H_