Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 168033003: Pass in correct parameter to MenuController::SelectByChar() on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/i18n/case_conversion.h" 11 #include "base/i18n/case_conversion.h"
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "ui/base/dragdrop/drag_utils.h" 16 #include "ui/base/dragdrop/drag_utils.h"
17 #include "ui/base/dragdrop/os_exchange_data.h" 17 #include "ui/base/dragdrop/os_exchange_data.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/events/event_constants.h" 19 #include "ui/events/event_constants.h"
20 #include "ui/events/event_utils.h" 20 #include "ui/events/event_utils.h"
21 #include "ui/events/keycodes/keyboard_code_conversion.h"
21 #include "ui/events/keycodes/keyboard_codes.h" 22 #include "ui/events/keycodes/keyboard_codes.h"
22 #include "ui/gfx/canvas.h" 23 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/screen.h" 25 #include "ui/gfx/screen.h"
25 #include "ui/gfx/vector2d.h" 26 #include "ui/gfx/vector2d.h"
26 #include "ui/native_theme/native_theme.h" 27 #include "ui/native_theme/native_theme.h"
27 #include "ui/views/controls/button/menu_button.h" 28 #include "ui/views/controls/button/menu_button.h"
28 #include "ui/views/controls/menu/menu_config.h" 29 #include "ui/views/controls/menu/menu_config.h"
29 #include "ui/views/controls/menu/menu_controller_delegate.h" 30 #include "ui/views/controls/menu/menu_controller_delegate.h"
30 #include "ui/views/controls/menu/menu_host_root_view.h" 31 #include "ui/views/controls/menu/menu_host_root_view.h"
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 // Activates mnemonics only when it it pressed without modifiers except for 1065 // Activates mnemonics only when it it pressed without modifiers except for
1065 // caps and shift. 1066 // caps and shift.
1066 int flags = ui::EventFlagsFromNative(event) & 1067 int flags = ui::EventFlagsFromNative(event) &
1067 ~ui::EF_CAPS_LOCK_DOWN & ~ui::EF_SHIFT_DOWN; 1068 ~ui::EF_CAPS_LOCK_DOWN & ~ui::EF_SHIFT_DOWN;
1068 if (flags == ui::EF_NONE) { 1069 if (flags == ui::EF_NONE) {
1069 switch (ui::EventTypeFromNative(event)) { 1070 switch (ui::EventTypeFromNative(event)) {
1070 case ui::ET_KEY_PRESSED: { 1071 case ui::ET_KEY_PRESSED: {
1071 if (!OnKeyDown(ui::KeyboardCodeFromNative(event))) 1072 if (!OnKeyDown(ui::KeyboardCodeFromNative(event)))
1072 return POST_DISPATCH_QUIT_LOOP; 1073 return POST_DISPATCH_QUIT_LOOP;
1073 1074
1074 bool should_exit = SelectByChar(ui::KeyboardCodeFromNative(event)); 1075 char c = ui::GetCharacterFromKeyCode(
1076 ui::KeyboardCodeFromNative(event), flags);
1077 bool should_exit = SelectByChar(c);
1075 return should_exit ? POST_DISPATCH_QUIT_LOOP : POST_DISPATCH_NONE; 1078 return should_exit ? POST_DISPATCH_QUIT_LOOP : POST_DISPATCH_NONE;
1076 } 1079 }
1077 case ui::ET_KEY_RELEASED: 1080 case ui::ET_KEY_RELEASED:
1078 return POST_DISPATCH_NONE; 1081 return POST_DISPATCH_NONE;
1079 default: 1082 default:
1080 break; 1083 break;
1081 } 1084 }
1082 } 1085 }
1083 1086
1084 return POST_DISPATCH_PERFORM_DEFAULT | 1087 return POST_DISPATCH_PERFORM_DEFAULT |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 (!pending_state_.item->HasSubmenu() || 2339 (!pending_state_.item->HasSubmenu() ||
2337 !pending_state_.item->GetSubmenu()->IsShowing())) { 2340 !pending_state_.item->GetSubmenu()->IsShowing())) {
2338 // On exit if the user hasn't selected an item with a submenu, move the 2341 // On exit if the user hasn't selected an item with a submenu, move the
2339 // selection back to the parent menu item. 2342 // selection back to the parent menu item.
2340 SetSelection(pending_state_.item->GetParentMenuItem(), 2343 SetSelection(pending_state_.item->GetParentMenuItem(),
2341 SELECTION_OPEN_SUBMENU); 2344 SELECTION_OPEN_SUBMENU);
2342 } 2345 }
2343 } 2346 }
2344 2347
2345 } // namespace views 2348 } // namespace views
OLDNEW
« chrome/browser/ui/views/menu_controller_test.cc ('K') | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698