OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_item_view.h" | 5 #include "ui/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_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 string16 MenuItemView::GetAcceleratorText() { | 1002 string16 MenuItemView::GetAcceleratorText() { |
1003 if (id() == kEmptyMenuItemViewID) { | 1003 if (id() == kEmptyMenuItemViewID) { |
1004 // Don't query the delegate for menus that represent no children. | 1004 // Don't query the delegate for menus that represent no children. |
1005 return string16(); | 1005 return string16(); |
1006 } | 1006 } |
1007 | 1007 |
1008 if(!GetMenuConfig().show_accelerators) | 1008 if(!GetMenuConfig().show_accelerators) |
1009 return string16(); | 1009 return string16(); |
1010 | 1010 |
1011 ui::Accelerator accelerator; | 1011 ui::Accelerator accelerator; |
1012 return (GetDelegate() && | 1012 return (GetDelegate() && GetCommand() && |
1013 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? | 1013 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? |
1014 accelerator.GetShortcutText() : string16(); | 1014 accelerator.GetShortcutText() : string16(); |
1015 } | 1015 } |
1016 | 1016 |
1017 bool MenuItemView::IsContainer() const { | 1017 bool MenuItemView::IsContainer() const { |
1018 // Let the first child take over |this| when we only have one child and no | 1018 // Let the first child take over |this| when we only have one child and no |
1019 // title. | 1019 // title. |
1020 return (NonIconChildViewsCount() == 1) && title_.empty(); | 1020 return (NonIconChildViewsCount() == 1) && title_.empty(); |
1021 } | 1021 } |
1022 | 1022 |
(...skipping 27 matching lines...) Expand all Loading... |
1050 } else { | 1050 } else { |
1051 const Type& type = menu_item->GetType(); | 1051 const Type& type = menu_item->GetType(); |
1052 if (type == CHECKBOX || type == RADIO) | 1052 if (type == CHECKBOX || type == RADIO) |
1053 return true; | 1053 return true; |
1054 } | 1054 } |
1055 } | 1055 } |
1056 return false; | 1056 return false; |
1057 } | 1057 } |
1058 | 1058 |
1059 } // namespace views | 1059 } // namespace views |
OLD | NEW |