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

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

Issue 1625313002: Remove MenuMessagePumpDispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced typedef with using 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
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/events/keycodes/keyboard_code_conversion.h"
9 #include "ui/views/controls/menu/menu_controller.h" 8 #include "ui/views/controls/menu/menu_controller.h"
10 #include "ui/views/views_delegate.h" 9 #include "ui/views/views_delegate.h"
11 10
12 namespace views { 11 namespace views {
13 12
14 namespace { 13 namespace {
15 14
16 const int kKeyFlagsMask = ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN; 15 const int kKeyFlagsMask = ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN;
17 16
18 } // namespace 17 } // namespace
(...skipping 27 matching lines...) Expand all
46 } 45 }
47 46
48 if (event->type() == ui::ET_KEY_PRESSED) { 47 if (event->type() == ui::ET_KEY_PRESSED) {
49 menu_controller->OnKeyDown(event->key_code()); 48 menu_controller->OnKeyDown(event->key_code());
50 49
51 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed. For 50 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed. For
52 // example Ctrl+<T> is an accelerator, but <T> only is a mnemonic. 51 // example Ctrl+<T> is an accelerator, but <T> only is a mnemonic.
53 const int flags = event->flags(); 52 const int flags = event->flags();
54 if (menu_controller->exit_type() == MenuController::EXIT_NONE && 53 if (menu_controller->exit_type() == MenuController::EXIT_NONE &&
55 (flags & kKeyFlagsMask) == 0) { 54 (flags & kKeyFlagsMask) == 0) {
56 char c = ui::DomCodeToUsLayoutCharacter(event->code(), flags); 55 char c = event->GetCharacter();
57 menu_controller->SelectByChar(c); 56 menu_controller->SelectByChar(c);
58 } 57 }
59 } 58 }
60 59
61 if (!menu_controller->TerminateNestedMessageLoopIfNecessary()) { 60 if (!menu_controller->TerminateNestedMessageLoopIfNecessary()) {
62 ui::Accelerator accelerator(*event); 61 ui::Accelerator accelerator(*event);
63 ViewsDelegate::ProcessMenuAcceleratorResult result = 62 ViewsDelegate::ProcessMenuAcceleratorResult result =
64 ViewsDelegate::GetInstance()->ProcessAcceleratorWhileMenuShowing( 63 ViewsDelegate::GetInstance()->ProcessAcceleratorWhileMenuShowing(
65 accelerator); 64 accelerator);
66 if (result == ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU) 65 if (result == ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU)
67 menu_controller->CancelAll(); 66 menu_controller->CancelAll();
68 } 67 }
69 68
70 event->StopPropagation(); 69 event->StopPropagation();
71 } 70 }
72 71
73 } // namespace views 72 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller.cc ('k') | ui/views/controls/menu/menu_message_loop_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698