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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine.cc

Issue 815773003: For faked key events from virtual keyboard, the character is set but dom key is not set. In such ca… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/events/event.cc » ('j') | ui/events/event.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/input_method/input_method_engine.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
6 6
7 #undef FocusIn 7 #undef FocusIn
8 #undef FocusOut 8 #undef FocusOut
9 #undef RootWindow 9 #undef RootWindow
10 #include <map> 10 #include <map>
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 ui::KeyboardCode key_code = static_cast<ui::KeyboardCode>(event.key_code); 313 ui::KeyboardCode key_code = static_cast<ui::KeyboardCode>(event.key_code);
314 if (key_code == ui::VKEY_UNKNOWN) 314 if (key_code == ui::VKEY_UNKNOWN)
315 key_code = ui::DomKeycodeToKeyboardCode(event.code); 315 key_code = ui::DomKeycodeToKeyboardCode(event.code);
316 316
317 int flags = ui::EF_NONE; 317 int flags = ui::EF_NONE;
318 flags |= event.alt_key ? ui::EF_ALT_DOWN : ui::EF_NONE; 318 flags |= event.alt_key ? ui::EF_ALT_DOWN : ui::EF_NONE;
319 flags |= event.ctrl_key ? ui::EF_CONTROL_DOWN : ui::EF_NONE; 319 flags |= event.ctrl_key ? ui::EF_CONTROL_DOWN : ui::EF_NONE;
320 flags |= event.shift_key ? ui::EF_SHIFT_DOWN : ui::EF_NONE; 320 flags |= event.shift_key ? ui::EF_SHIFT_DOWN : ui::EF_NONE;
321 flags |= event.caps_lock ? ui::EF_CAPS_LOCK_DOWN : ui::EF_NONE; 321 flags |= event.caps_lock ? ui::EF_CAPS_LOCK_DOWN : ui::EF_NONE;
322 322
323 ui::KeyEvent ui_event( 323 base::char16 ch = 0;
324 type,
325 key_code,
326 ui::KeycodeConverter::CodeStringToDomCode(event.code.c_str()),
327 flags);
328 // 4-bytes UTF-8 string is at least 2-characters UTF-16 string. 324 // 4-bytes UTF-8 string is at least 2-characters UTF-16 string.
329 // And Key char can only be single UTF-16 character. 325 // And Key char can only be single UTF-16 character.
330 if (!event.key.empty() && event.key.size() < 4) { 326 if (!event.key.empty() && event.key.size() < 4) {
331 base::string16 key_char = base::UTF8ToUTF16(event.key); 327 base::string16 key_char = base::UTF8ToUTF16(event.key);
332 if (key_char.size() == 1) 328 if (key_char.size() == 1)
333 ui_event.set_character(key_char[0]); 329 ch = key_char[0];
334 } 330 }
331 ui::KeyEvent ui_event(
332 type,
333 key_code,
334 ui::KeycodeConverter::CodeStringToDomCode(event.code.c_str()),
335 flags,
336 ui::KeycodeConverter::KeyStringToDomKey(event.key.c_str()),
337 ch);
kpschoedel 2014/12/19 16:08:51 I think eventually we want something like: ui
Shu Chen 2014/12/20 11:38:11 ACK. Thanks & looking forward to the dom key is fu
335 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_, 338 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_,
336 &ui_event); 339 &ui_event);
337 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&ui_event); 340 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&ui_event);
338 if (details.dispatcher_destroyed) 341 if (details.dispatcher_destroyed)
339 break; 342 break;
340 } 343 }
341 344
342 return true; 345 return true;
343 } 346 }
344 347
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // TODO(nona): Implement it. 703 // TODO(nona): Implement it.
701 break; 704 break;
702 } 705 }
703 } 706 }
704 } 707 }
705 708
706 // TODO(nona): Support item.children. 709 // TODO(nona): Support item.children.
707 } 710 }
708 711
709 } // namespace chromeos 712 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | ui/events/event.cc » ('j') | ui/events/event.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698