| 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 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 if (item->GetSubmenu()->GetMenuItemCount() == 0) | 2071 if (item->GetSubmenu()->GetMenuItemCount() == 0) |
| 2072 return false; | 2072 return false; |
| 2073 | 2073 |
| 2074 // Look for matches based on mnemonic first. | 2074 // Look for matches based on mnemonic first. |
| 2075 SelectByCharDetails details = | 2075 SelectByCharDetails details = |
| 2076 FindChildForMnemonic(item, key, &MatchesMnemonic); | 2076 FindChildForMnemonic(item, key, &MatchesMnemonic); |
| 2077 if (details.first_match != -1) | 2077 if (details.first_match != -1) |
| 2078 return AcceptOrSelect(item, details); | 2078 return AcceptOrSelect(item, details); |
| 2079 | 2079 |
| 2080 if (is_combobox_) { | 2080 if (is_combobox_) { |
| 2081 item->GetSubmenu()->GetTextInputClient()->InsertChar(character, 0); | 2081 item->GetSubmenu()->GetPrefixSelector()->InsertChar(character, 0); |
| 2082 } else { | 2082 } else { |
| 2083 // If no mnemonics found, look at first character of titles. | 2083 // If no mnemonics found, look at first character of titles. |
| 2084 details = FindChildForMnemonic(item, key, &TitleMatchesMnemonic); | 2084 details = FindChildForMnemonic(item, key, &TitleMatchesMnemonic); |
| 2085 if (details.first_match != -1) | 2085 if (details.first_match != -1) |
| 2086 return AcceptOrSelect(item, details); | 2086 return AcceptOrSelect(item, details); |
| 2087 } | 2087 } |
| 2088 | 2088 |
| 2089 return false; | 2089 return false; |
| 2090 } | 2090 } |
| 2091 | 2091 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 } | 2357 } |
| 2358 } | 2358 } |
| 2359 | 2359 |
| 2360 gfx::Screen* MenuController::GetScreen() { | 2360 gfx::Screen* MenuController::GetScreen() { |
| 2361 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; | 2361 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; |
| 2362 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) | 2362 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) |
| 2363 : gfx::Screen::GetNativeScreen(); | 2363 : gfx::Screen::GetNativeScreen(); |
| 2364 } | 2364 } |
| 2365 | 2365 |
| 2366 } // namespace views | 2366 } // namespace views |
| OLD | NEW |