OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_event_dispatcher_linux.h" | 5 #include "ui/views/controls/menu/menu_event_dispatcher_linux.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/events/event_utils.h" | 9 #include "ui/events/event_utils.h" |
10 #include "ui/events/keycodes/keyboard_code_conversion.h" | 10 #include "ui/events/keycodes/keyboard_code_conversion.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ui::KeyEvent* key_event = static_cast<ui::KeyEvent*>(ui_event.get()); | 53 ui::KeyEvent* key_event = static_cast<ui::KeyEvent*>(ui_event.get()); |
54 if (!menu_controller_->OnKeyDown(key_event->key_code())) { | 54 if (!menu_controller_->OnKeyDown(key_event->key_code())) { |
55 should_quit = true; | 55 should_quit = true; |
56 should_perform_default = false; | 56 should_perform_default = false; |
57 break; | 57 break; |
58 } | 58 } |
59 | 59 |
60 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed. | 60 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed. |
61 int flags = key_event->flags(); | 61 int flags = key_event->flags(); |
62 if ((flags & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)) == 0) { | 62 if ((flags & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)) == 0) { |
63 char c = ui::GetCharacterFromKeyCode(key_event->key_code(), flags); | 63 char c = ui::DomCodeToCharacter(key_event->code(), flags); |
64 if (menu_controller_->SelectByChar(c)) { | 64 if (menu_controller_->SelectByChar(c)) { |
65 should_quit = true; | 65 should_quit = true; |
66 should_perform_default = false; | 66 should_perform_default = false; |
67 break; | 67 break; |
68 } | 68 } |
69 } | 69 } |
70 should_quit = false; | 70 should_quit = false; |
71 should_perform_default = false; | 71 should_perform_default = false; |
72 break; | 72 break; |
73 } | 73 } |
(...skipping 16 matching lines...) Expand all Loading... |
90 | 90 |
91 if (should_quit || menu_controller_->exit_type() != MenuController::EXIT_NONE) | 91 if (should_quit || menu_controller_->exit_type() != MenuController::EXIT_NONE) |
92 menu_controller_->TerminateNestedMessageLoop(); | 92 menu_controller_->TerminateNestedMessageLoop(); |
93 | 93 |
94 return should_perform_default ? ui::POST_DISPATCH_PERFORM_DEFAULT | 94 return should_perform_default ? ui::POST_DISPATCH_PERFORM_DEFAULT |
95 : ui::POST_DISPATCH_NONE; | 95 : ui::POST_DISPATCH_NONE; |
96 } | 96 } |
97 | 97 |
98 } // namespace internal | 98 } // namespace internal |
99 } // namespace views | 99 } // namespace views |
OLD | NEW |