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

Unified Diff: views/controls/menu/native_menu_win.cc

Issue 6304013: Fix regression in submenus not working. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/native_menu_win.cc
===================================================================
--- views/controls/menu/native_menu_win.cc (revision 71973)
+++ views/controls/menu/native_menu_win.cc (working copy)
@@ -88,6 +88,14 @@
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 @@
// Called when the user selects a specific item.
void OnMenuCommand(int position, HMENU menu) {
- parent_->model_->ActivatedAt(position);
+ NativeMenuWin* intergoat = GetNativeMenuWinFromHMENU(menu);
asargent_no_longer_on_chrome 2011/01/20 19:56:57 Does the name "intergoat" actually mean something
jam 2011/01/20 20:24:30 I think it's an inside joke :) This is just resur
+ 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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698