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

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

Issue 150061: Rework a loop in the native menu code to iterate over the vector of items we ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 19515)
+++ views/controls/menu/native_menu_win.cc (working copy)
@@ -346,16 +346,17 @@
void NativeMenuWin::UpdateStates() {
// A depth-first walk of the menu items, updating states.
- for (int menu_index = first_item_index_;
- menu_index < first_item_index_ + model_->GetItemCount(); ++menu_index) {
- int model_index = menu_index - first_item_index_;
+ int model_index = 0;
+ std::vector<ItemData*>::const_iterator it;
+ for (it = items_.begin(); it != items_.end(); ++it, ++model_index) {
+ int menu_index = model_index + first_item_index_;
SetMenuItemState(menu_index, model_->IsEnabledAt(model_index),
model_->IsItemCheckedAt(model_index), false);
if (model_->IsLabelDynamicAt(model_index)) {
SetMenuItemLabel(menu_index, model_index,
- model_->GetLabelAt(model_index));
+ model_->GetLabelAt(model_index));
sky 2009/06/29 21:40:06 nit: align with (
}
- Menu2* submenu = items_[model_index]->submenu.get();
+ Menu2* submenu = (*it)->submenu.get();
if (submenu)
submenu->UpdateStates();
}
« 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