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

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

Issue 1072193004: Take GetCharacterFromKeyCode() out behind the barn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 | « ui/events/test/event_generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "ui/views/controls/menu/menu_event_dispatcher.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 should_perform_default = false; 51 should_perform_default = false;
52 52
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 menu_controller_->OnKeyDown(key_event->key_code()); 54 menu_controller_->OnKeyDown(key_event->key_code());
55 if (menu_controller_->exit_type() != MenuController::EXIT_NONE) 55 if (menu_controller_->exit_type() != MenuController::EXIT_NONE)
56 break; 56 break;
57 57
58 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed. 58 // Do not check mnemonics if the Alt or Ctrl modifiers are pressed.
59 int flags = key_event->flags(); 59 int flags = key_event->flags();
60 if ((flags & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)) == 0) { 60 if ((flags & (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)) == 0) {
61 char c = ui::GetCharacterFromKeyCode(key_event->key_code(), flags); 61 char c = ui::DomCodeToUsLayoutCharacter(key_event->code(), flags);
62 menu_controller_->SelectByChar(c); 62 menu_controller_->SelectByChar(c);
63 } 63 }
64 break; 64 break;
65 } 65 }
66 case ui::ET_KEY_RELEASED: 66 case ui::ET_KEY_RELEASED:
67 should_perform_default = false; 67 should_perform_default = false;
68 break; 68 break;
69 case ui::ET_TOUCH_RELEASED: 69 case ui::ET_TOUCH_RELEASED:
70 case ui::ET_TOUCH_CANCELLED: 70 case ui::ET_TOUCH_CANCELLED:
71 // Don't allow the event copy to clear the native touch id 71 // Don't allow the event copy to clear the native touch id
72 // mapping, or we'll lose the mapping before the initial event 72 // mapping, or we'll lose the mapping before the initial event
73 // has finished being dispatched. 73 // has finished being dispatched.
74 static_cast<ui::TouchEvent*>(ui_event.get()) 74 static_cast<ui::TouchEvent*>(ui_event.get())
75 ->set_should_remove_native_touch_id_mapping(false); 75 ->set_should_remove_native_touch_id_mapping(false);
76 break; 76 break;
77 default: 77 default:
78 break; 78 break;
79 } 79 }
80 } 80 }
81 81
82 if (menu_controller_->exit_type() != MenuController::EXIT_NONE) 82 if (menu_controller_->exit_type() != MenuController::EXIT_NONE)
83 menu_controller_->TerminateNestedMessageLoop(); 83 menu_controller_->TerminateNestedMessageLoop();
84 84
85 return should_perform_default ? ui::POST_DISPATCH_PERFORM_DEFAULT 85 return should_perform_default ? ui::POST_DISPATCH_PERFORM_DEFAULT
86 : ui::POST_DISPATCH_NONE; 86 : ui::POST_DISPATCH_NONE;
87 } 87 }
88 88
89 } // namespace internal 89 } // namespace internal
90 } // namespace views 90 } // namespace views
OLDNEW
« no previous file with comments | « ui/events/test/event_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698