summaryrefslogtreecommitdiffstats
path: root/views/controls/menu/native_menu_win.cc
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 15:50:27 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 15:50:27 +0000
commit222ed2d867d2431f6f49419d80ee7963a15d98fd (patch)
tree9917226c2b3ca17c7eed3ac290d398cde4bf4512 /views/controls/menu/native_menu_win.cc
parented256c7bd9828576ce865926e898a6c592b14037 (diff)
downloadchromium_src-222ed2d867d2431f6f49419d80ee7963a15d98fd.zip
chromium_src-222ed2d867d2431f6f49419d80ee7963a15d98fd.tar.gz
chromium_src-222ed2d867d2431f6f49419d80ee7963a15d98fd.tar.bz2
Revert "Keyboard accessibility for the page and app menus."
This reverts commit 42217. TBR=dmzazzoni Review URL: http://codereview.chromium.org/1154003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/native_menu_win.cc')
-rw-r--r--views/controls/menu/native_menu_win.cc66
1 files changed, 1 insertions, 65 deletions
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc
index d959b85..75b8d4c 100644
--- a/views/controls/menu/native_menu_win.cc
+++ b/views/controls/menu/native_menu_win.cc
@@ -306,8 +306,7 @@ NativeMenuWin::NativeMenuWin(menus::MenuModel* model, HWND system_menu_for)
owner_draw_(l10n_util::NeedOverrideDefaultUIFont(NULL, NULL) &&
!system_menu_for),
system_menu_for_(system_menu_for),
- first_item_index_(0),
- menu_action_(MENU_ACTION_NONE) {
+ first_item_index_(0) {
}
NativeMenuWin::~NativeMenuWin() {
@@ -323,24 +322,10 @@ void NativeMenuWin::RunMenuAt(const gfx::Point& point, int alignment) {
UpdateStates();
UINT flags = TPM_LEFTBUTTON | TPM_RECURSE;
flags |= GetAlignmentFlags(alignment);
- menu_action_ = MENU_ACTION_NONE;
-
- // Set a hook function so we can listen for keyboard events while the
- // menu is open, and store a pointer to this object in a static
- // variable so the hook has access to it (ugly, but it's the
- // only way).
- open_native_menu_win_ = this;
- HHOOK hhook = SetWindowsHookEx(WH_MSGFILTER, MenuMessageHook,
- GetModuleHandle(NULL), ::GetCurrentThreadId());
-
// Command dispatch is done through WM_MENUCOMMAND, handled by the host
// window.
- HWND hwnd = host_window_->hwnd();
TrackPopupMenuEx(menu_, flags, point.x(), point.y(), host_window_->hwnd(),
NULL);
-
- UnhookWindowsHookEx(hhook);
- open_native_menu_win_ = NULL;
}
void NativeMenuWin::CancelMenu() {
@@ -385,58 +370,9 @@ gfx::NativeMenu NativeMenuWin::GetNativeMenu() const {
return menu_;
}
-NativeMenuWin::MenuAction NativeMenuWin::GetMenuAction() const {
- return menu_action_;
-}
-
////////////////////////////////////////////////////////////////////////////////
// NativeMenuWin, private:
-// static
-NativeMenuWin* NativeMenuWin::open_native_menu_win_ = NULL;
-
-// static
-bool NativeMenuWin::GetHighlightedMenuItemInfo(
- HMENU menu, bool* has_parent, bool* has_submenu) {
- for (int i = 0; i < ::GetMenuItemCount(menu); i++) {
- UINT state = ::GetMenuState(menu, i, MF_BYPOSITION);
- if (state & MF_HILITE) {
- if (state & MF_POPUP) {
- HMENU submenu = GetSubMenu(menu, i);
- if (GetHighlightedMenuItemInfo(submenu, has_parent, has_submenu))
- *has_parent = true;
- else
- *has_submenu = true;
- }
- return true;
- }
- }
- return false;
-}
-
-// static
-LRESULT CALLBACK NativeMenuWin::MenuMessageHook(
- int n_code, WPARAM w_param, LPARAM l_param) {
- LRESULT result = CallNextHookEx(NULL, n_code, w_param, l_param);
-
- MSG* msg = reinterpret_cast<MSG*>(l_param);
- if (msg->message == WM_KEYDOWN) {
- NativeMenuWin* this_ptr = open_native_menu_win_;
- bool has_parent = false;
- bool has_submenu = false;
- GetHighlightedMenuItemInfo(this_ptr->menu_, &has_parent, &has_submenu);
- if (msg->wParam == VK_LEFT && !has_parent) {
- this_ptr->menu_action_ = MENU_ACTION_PREVIOUS;
- ::EndMenu();
- } else if (msg->wParam == VK_RIGHT && !has_parent && !has_submenu) {
- this_ptr->menu_action_ = MENU_ACTION_NEXT;
- ::EndMenu();
- }
- }
-
- return result;
-}
-
bool NativeMenuWin::IsSeparatorItemAt(int menu_index) const {
MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);