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_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 bool MatchesMnemonic(MenuItemView* menu, char16 key) { | 90 bool MatchesMnemonic(MenuItemView* menu, char16 key) { |
91 return menu->GetMnemonic() == key; | 91 return menu->GetMnemonic() == key; |
92 } | 92 } |
93 | 93 |
94 // Returns true if |menu| doesn't have a mnemonic and first character of the its | 94 // Returns true if |menu| doesn't have a mnemonic and first character of the its |
95 // title is |key|. | 95 // title is |key|. |
96 bool TitleMatchesMnemonic(MenuItemView* menu, char16 key) { | 96 bool TitleMatchesMnemonic(MenuItemView* menu, char16 key) { |
97 if (menu->GetMnemonic()) | 97 if (menu->GetMnemonic()) |
98 return false; | 98 return false; |
99 | 99 |
100 string16 lower_title = base::i18n::ToLower(menu->title()); | 100 base::string16 lower_title = base::i18n::ToLower(menu->title()); |
101 return !lower_title.empty() && lower_title[0] == key; | 101 return !lower_title.empty() && lower_title[0] == key; |
102 } | 102 } |
103 | 103 |
104 } // namespace | 104 } // namespace |
105 | 105 |
106 // Returns the first descendant of |view| that is hot tracked. | 106 // Returns the first descendant of |view| that is hot tracked. |
107 static CustomButton* GetFirstHotTrackedView(View* view) { | 107 static CustomButton* GetFirstHotTrackedView(View* view) { |
108 if (!view) | 108 if (!view) |
109 return NULL; | 109 return NULL; |
110 CustomButton* button = CustomButton::AsCustomButton(view); | 110 CustomButton* button = CustomButton::AsCustomButton(view); |
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 (!pending_state_.item->HasSubmenu() || | 2337 (!pending_state_.item->HasSubmenu() || |
2338 !pending_state_.item->GetSubmenu()->IsShowing())) { | 2338 !pending_state_.item->GetSubmenu()->IsShowing())) { |
2339 // On exit if the user hasn't selected an item with a submenu, move the | 2339 // On exit if the user hasn't selected an item with a submenu, move the |
2340 // selection back to the parent menu item. | 2340 // selection back to the parent menu item. |
2341 SetSelection(pending_state_.item->GetParentMenuItem(), | 2341 SetSelection(pending_state_.item->GetParentMenuItem(), |
2342 SELECTION_OPEN_SUBMENU); | 2342 SELECTION_OPEN_SUBMENU); |
2343 } | 2343 } |
2344 } | 2344 } |
2345 | 2345 |
2346 } // namespace views | 2346 } // namespace views |
OLD | NEW |