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

Side by Side Diff: ui/events/test/event_generator.cc

Issue 1085733007: Revert of Take GetCharacterFromKeyCode() out behind the barn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 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/events/test/event_generator.h" 5 #include "ui/events/test/event_generator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 if (window_context) 533 if (window_context)
534 current_location_ = delegate()->CenterOfWindow(window_context); 534 current_location_ = delegate()->CenterOfWindow(window_context);
535 current_target_ = delegate()->GetTargetAt(current_location_); 535 current_target_ = delegate()->GetTargetAt(current_location_);
536 } 536 }
537 537
538 void EventGenerator::DispatchKeyEvent(bool is_press, 538 void EventGenerator::DispatchKeyEvent(bool is_press,
539 ui::KeyboardCode key_code, 539 ui::KeyboardCode key_code,
540 int flags) { 540 int flags) {
541 #if defined(OS_WIN) 541 #if defined(OS_WIN)
542 UINT key_press = WM_KEYDOWN; 542 UINT key_press = WM_KEYDOWN;
543 uint16 character = ui::DomCodeToUsLayoutCharacter( 543 uint16 character = ui::GetCharacterFromKeyCode(key_code, flags);
544 ui::UsLayoutKeyboardCodeToDomCode(key_code), flags);
545 if (is_press && character) { 544 if (is_press && character) {
546 MSG native_event = { NULL, WM_KEYDOWN, key_code, 0 }; 545 MSG native_event = { NULL, WM_KEYDOWN, key_code, 0 };
547 TestKeyEvent keyev(native_event, flags); 546 TestKeyEvent keyev(native_event, flags);
548 Dispatch(&keyev); 547 Dispatch(&keyev);
549 // On Windows, WM_KEYDOWN event is followed by WM_CHAR with a character 548 // On Windows, WM_KEYDOWN event is followed by WM_CHAR with a character
550 // if the key event cooresponds to a real character. 549 // if the key event cooresponds to a real character.
551 key_press = WM_CHAR; 550 key_press = WM_CHAR;
552 key_code = static_cast<ui::KeyboardCode>(character); 551 key_code = static_cast<ui::KeyboardCode>(character);
553 } 552 }
554 MSG native_event = 553 MSG native_event =
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 return default_delegate; 658 return default_delegate;
660 } 659 }
661 660
662 EventGeneratorDelegate* EventGenerator::delegate() { 661 EventGeneratorDelegate* EventGenerator::delegate() {
663 return const_cast<EventGeneratorDelegate*>( 662 return const_cast<EventGeneratorDelegate*>(
664 const_cast<const EventGenerator*>(this)->delegate()); 663 const_cast<const EventGenerator*>(this)->delegate());
665 } 664 }
666 665
667 } // namespace test 666 } // namespace test
668 } // namespace ui 667 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc ('k') | ui/views/controls/menu/menu_event_dispatcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698