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

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

Issue 1652133003: Fix non-Latin key event handling for menu mnemonics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests Created 4 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
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_runner_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_key_event_handler.h" 5 #include "ui/views/controls/menu/menu_key_event_handler.h"
6 6
7 #include "ui/aura/env.h" 7 #include "ui/aura/env.h"
8 #include "ui/views/controls/menu/menu_controller.h" 8 #include "ui/views/controls/menu/menu_controller.h"
9 #include "ui/views/views_delegate.h" 9 #include "ui/views/views_delegate.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 menu_controller->OnKeyDown(event->key_code()); 50 menu_controller->OnKeyDown(event->key_code());
51 // Menu controller might have been deleted. 51 // Menu controller might have been deleted.
52 if (!MenuController::GetActiveInstance()) 52 if (!MenuController::GetActiveInstance())
53 return; 53 return;
54 54
55 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed. For 55 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed. For
56 // example Ctrl+<T> is an accelerator, but <T> only is a mnemonic. 56 // example Ctrl+<T> is an accelerator, but <T> only is a mnemonic.
57 const int flags = event->flags(); 57 const int flags = event->flags();
58 if (menu_controller->exit_type() == MenuController::EXIT_NONE && 58 if (menu_controller->exit_type() == MenuController::EXIT_NONE &&
59 (flags & kKeyFlagsMask) == 0) { 59 (flags & kKeyFlagsMask) == 0) {
60 char c = event->GetCharacter(); 60 base::char16 c = event->GetCharacter();
61 menu_controller->SelectByChar(c); 61 menu_controller->SelectByChar(c);
62 // Menu controller might have been deleted. 62 // Menu controller might have been deleted.
63 if (!MenuController::GetActiveInstance()) 63 if (!MenuController::GetActiveInstance())
64 return; 64 return;
65 } 65 }
66 } 66 }
67 67
68 if (!menu_controller->TerminateNestedMessageLoopIfNecessary()) { 68 if (!menu_controller->TerminateNestedMessageLoopIfNecessary()) {
69 ui::Accelerator accelerator(*event); 69 ui::Accelerator accelerator(*event);
70 ViewsDelegate::ProcessMenuAcceleratorResult result = 70 ViewsDelegate::ProcessMenuAcceleratorResult result =
71 ViewsDelegate::GetInstance()->ProcessAcceleratorWhileMenuShowing( 71 ViewsDelegate::GetInstance()->ProcessAcceleratorWhileMenuShowing(
72 accelerator); 72 accelerator);
73 if (result == ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU) 73 if (result == ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU)
74 menu_controller->CancelAll(); 74 menu_controller->CancelAll();
75 } 75 }
76 } 76 }
77 77
78 } // namespace views 78 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698