diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 21:38:58 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 21:38:58 +0000 |
commit | 1d0bb92191e7c495f29ef71bedda2ef4c72eb8aa (patch) | |
tree | 013774c1aca80fe1c310f10b433ee82e7a6844f1 /views/controls | |
parent | 09205efb90f920a885b1803a68a148bfa54d79ee (diff) | |
download | chromium_src-1d0bb92191e7c495f29ef71bedda2ef4c72eb8aa.zip chromium_src-1d0bb92191e7c495f29ef71bedda2ef4c72eb8aa.tar.gz chromium_src-1d0bb92191e7c495f29ef71bedda2ef4c72eb8aa.tar.bz2 |
Fix regression in submenus not working.
BUG=69797
Review URL: http://codereview.chromium.org/6304013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/menu/native_menu_win.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index f4c185e..0cf6757 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -88,6 +88,14 @@ class NativeMenuWin::MenuHostWindow { registered = true; } + NativeMenuWin* GetNativeMenuWinFromHMENU(HMENU hmenu) const { + MENUINFO mi = {0}; + mi.cbSize = sizeof(mi); + mi.fMask = MIM_MENUDATA | MIM_STYLE; + GetMenuInfo(hmenu, &mi); + return reinterpret_cast<NativeMenuWin*>(mi.dwMenuData); + } + // Converts the WPARAM value passed to WM_MENUSELECT into an index // corresponding to the menu item that was selected. int GetMenuItemIndexFromWPARAM(HMENU menu, WPARAM w_param) const { @@ -116,15 +124,20 @@ class NativeMenuWin::MenuHostWindow { // Called when the user selects a specific item. void OnMenuCommand(int position, HMENU menu) { - parent_->model_->ActivatedAt(position); + NativeMenuWin* intergoat = GetNativeMenuWinFromHMENU(menu); + ui::MenuModel* model = intergoat->model_; + model->ActivatedAt(position); } // Called as the user moves their mouse or arrows through the contents of the // menu. void OnMenuSelect(WPARAM w_param, HMENU menu) { + if (!menu) + return; // menu is null when closing on XP. + int position = GetMenuItemIndexFromWPARAM(menu, w_param); if (position >= 0) - parent_->model_->HighlightChangedTo(position); + GetNativeMenuWinFromHMENU(menu)->model_->HighlightChangedTo(position); } // Called by Windows to measure the size of an owner-drawn menu item. |