Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/menu_item_view.h" | 5 #include "views/controls/menu/menu_item_view.h" |
| 6 | 6 |
| 7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "grit/app_strings.h" | 10 #include "grit/app_strings.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 type_ = type; | 556 type_ = type; |
| 557 selected_ = false; | 557 selected_ = false; |
| 558 command_ = command; | 558 command_ = command; |
| 559 submenu_ = NULL; | 559 submenu_ = NULL; |
| 560 show_mnemonics_ = false; | 560 show_mnemonics_ = false; |
| 561 // Assign our ID, this allows SubmenuItemView to find MenuItemViews. | 561 // Assign our ID, this allows SubmenuItemView to find MenuItemViews. |
| 562 SetID(kMenuItemViewID); | 562 SetID(kMenuItemViewID); |
| 563 has_icons_ = false; | 563 has_icons_ = false; |
| 564 | 564 |
| 565 MenuDelegate* root_delegate = GetDelegate(); | 565 MenuDelegate* root_delegate = GetDelegate(); |
| 566 if (root_delegate) | 566 if (parent && root_delegate) |
|
sky
2011/05/25 15:41:12
Yes, this is a good change. I just did one similar
rhashimoto
2011/05/25 16:24:37
Done.
| |
| 567 SetEnabled(root_delegate->IsCommandEnabled(command)); | 567 SetEnabled(root_delegate->IsCommandEnabled(command)); |
| 568 } | 568 } |
| 569 | 569 |
| 570 void MenuItemView::DropMenuClosed(bool notify_delegate) { | 570 void MenuItemView::DropMenuClosed(bool notify_delegate) { |
| 571 DCHECK(controller_); | 571 DCHECK(controller_); |
| 572 DCHECK(!controller_->IsBlockingRun()); | 572 DCHECK(!controller_->IsBlockingRun()); |
| 573 if (MenuController::GetActiveInstance() == controller_) | 573 if (MenuController::GetActiveInstance() == controller_) |
| 574 MenuController::SetActiveInstance(NULL); | 574 MenuController::SetActiveInstance(NULL); |
| 575 delete controller_; | 575 delete controller_; |
| 576 controller_ = NULL; | 576 controller_ = NULL; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 } | 738 } |
| 739 | 739 |
| 740 string16 MenuItemView::GetAcceleratorText() { | 740 string16 MenuItemView::GetAcceleratorText() { |
| 741 Accelerator accelerator; | 741 Accelerator accelerator; |
| 742 return (GetDelegate() && | 742 return (GetDelegate() && |
| 743 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? | 743 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? |
| 744 accelerator.GetShortcutText() : string16(); | 744 accelerator.GetShortcutText() : string16(); |
| 745 } | 745 } |
| 746 | 746 |
| 747 } // namespace views | 747 } // namespace views |
| OLD | NEW |