| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/controls/menu/native_menu_win.h" | 5 #include "views/controls/menu/native_menu_win.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/l10n_util_win.h" | 9 #include "app/l10n_util_win.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 365 } |
| 366 | 366 |
| 367 void NativeMenuWin::UpdateStates() { | 367 void NativeMenuWin::UpdateStates() { |
| 368 // A depth-first walk of the menu items, updating states. | 368 // A depth-first walk of the menu items, updating states. |
| 369 int model_index = 0; | 369 int model_index = 0; |
| 370 std::vector<ItemData*>::const_iterator it; | 370 std::vector<ItemData*>::const_iterator it; |
| 371 for (it = items_.begin(); it != items_.end(); ++it, ++model_index) { | 371 for (it = items_.begin(); it != items_.end(); ++it, ++model_index) { |
| 372 int menu_index = model_index + first_item_index_; | 372 int menu_index = model_index + first_item_index_; |
| 373 SetMenuItemState(menu_index, model_->IsEnabledAt(model_index), | 373 SetMenuItemState(menu_index, model_->IsEnabledAt(model_index), |
| 374 model_->IsItemCheckedAt(model_index), false); | 374 model_->IsItemCheckedAt(model_index), false); |
| 375 if (model_->IsLabelDynamicAt(model_index)) { | 375 if (model_->IsItemDynamicAt(model_index)) { |
| 376 // TODO(atwilson): Update the icon as well (http://crbug.com/66508). |
| 376 SetMenuItemLabel(menu_index, model_index, | 377 SetMenuItemLabel(menu_index, model_index, |
| 377 model_->GetLabelAt(model_index)); | 378 model_->GetLabelAt(model_index)); |
| 378 } | 379 } |
| 379 Menu2* submenu = (*it)->submenu.get(); | 380 Menu2* submenu = (*it)->submenu.get(); |
| 380 if (submenu) | 381 if (submenu) |
| 381 submenu->UpdateStates(); | 382 submenu->UpdateStates(); |
| 382 } | 383 } |
| 383 } | 384 } |
| 384 | 385 |
| 385 gfx::NativeMenu NativeMenuWin::GetNativeMenu() const { | 386 gfx::NativeMenu NativeMenuWin::GetNativeMenu() const { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 | 626 |
| 626 //////////////////////////////////////////////////////////////////////////////// | 627 //////////////////////////////////////////////////////////////////////////////// |
| 627 // MenuWrapper, public: | 628 // MenuWrapper, public: |
| 628 | 629 |
| 629 // static | 630 // static |
| 630 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 631 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
| 631 return new NativeMenuWin(menu->model(), NULL); | 632 return new NativeMenuWin(menu->model(), NULL); |
| 632 } | 633 } |
| 633 | 634 |
| 634 } // namespace views | 635 } // namespace views |
| OLD | NEW |