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.h" | 8 #include "base/stl_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 | 764 |
765 string16 MenuItemView::GetAcceleratorText() { | 765 string16 MenuItemView::GetAcceleratorText() { |
766 if (id() == kEmptyMenuItemViewID) { | 766 if (id() == kEmptyMenuItemViewID) { |
767 // Don't query the delegate for menus that represent no children. | 767 // Don't query the delegate for menus that represent no children. |
768 return string16(); | 768 return string16(); |
769 } | 769 } |
770 | 770 |
771 if(!MenuConfig::instance().show_accelerators) | 771 if(!MenuConfig::instance().show_accelerators) |
772 return string16(); | 772 return string16(); |
773 | 773 |
774 Accelerator accelerator; | 774 ui::Accelerator accelerator; |
775 return (GetDelegate() && | 775 return (GetDelegate() && |
776 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? | 776 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? |
777 accelerator.GetShortcutText() : string16(); | 777 accelerator.GetShortcutText() : string16(); |
778 } | 778 } |
779 | 779 |
780 bool MenuItemView::IsContainer() const { | 780 bool MenuItemView::IsContainer() const { |
781 // Let the first child take over |this| when we only have one child and no | 781 // Let the first child take over |this| when we only have one child and no |
782 // title. Note that what child_count() returns is the number of children, | 782 // title. Note that what child_count() returns is the number of children, |
783 // not the number of menu items. | 783 // not the number of menu items. |
784 return child_count() == 1 && title_.empty(); | 784 return child_count() == 1 && title_.empty(); |
785 } | 785 } |
786 | 786 |
787 } // namespace views | 787 } // namespace views |
OLD | NEW |