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

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

Issue 1284433002: Revise ui::DomKey to unify character and non-character codes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsDead 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
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 ui::KeyboardCode key_code = static_cast<ui::KeyboardCode>(event.key_code); 302 ui::KeyboardCode key_code = static_cast<ui::KeyboardCode>(event.key_code);
303 if (key_code == ui::VKEY_UNKNOWN) 303 if (key_code == ui::VKEY_UNKNOWN)
304 key_code = ui::DomKeycodeToKeyboardCode(event.code); 304 key_code = ui::DomKeycodeToKeyboardCode(event.code);
305 305
306 int flags = ui::EF_NONE; 306 int flags = ui::EF_NONE;
307 flags |= event.alt_key ? ui::EF_ALT_DOWN : ui::EF_NONE; 307 flags |= event.alt_key ? ui::EF_ALT_DOWN : ui::EF_NONE;
308 flags |= event.ctrl_key ? ui::EF_CONTROL_DOWN : ui::EF_NONE; 308 flags |= event.ctrl_key ? ui::EF_CONTROL_DOWN : ui::EF_NONE;
309 flags |= event.shift_key ? ui::EF_SHIFT_DOWN : ui::EF_NONE; 309 flags |= event.shift_key ? ui::EF_SHIFT_DOWN : ui::EF_NONE;
310 flags |= event.caps_lock ? ui::EF_CAPS_LOCK_DOWN : ui::EF_NONE; 310 flags |= event.caps_lock ? ui::EF_CAPS_LOCK_DOWN : ui::EF_NONE;
311 311
312 base::char16 ch = 0;
313 // 4-bytes UTF-8 string is at least 2-characters UTF-16 string.
314 // And Key char can only be single UTF-16 character.
315 if (!event.key.empty() && event.key.size() < 4) {
316 base::string16 key_char = base::UTF8ToUTF16(event.key);
317 if (key_char.size() == 1)
318 ch = key_char[0];
319 }
320 ui::KeyEvent ui_event( 312 ui::KeyEvent ui_event(
321 type, key_code, 313 type, key_code,
322 ui::KeycodeConverter::CodeStringToDomCode(event.code.c_str()), flags, 314 ui::KeycodeConverter::CodeStringToDomCode(event.code.c_str()), flags,
323 ui::KeycodeConverter::KeyStringToDomKey(event.key.c_str()), ch, 315 ui::KeycodeConverter::KeyStringToDomKey(event.key.c_str()),
324 ui::EventTimeForNow()); 316 ui::EventTimeForNow());
325 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_, 317 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_,
326 &ui_event); 318 &ui_event);
327 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&ui_event); 319 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&ui_event);
328 if (details.dispatcher_destroyed) 320 if (details.dispatcher_destroyed)
329 break; 321 break;
330 } 322 }
331 323
332 return true; 324 return true;
333 } 325 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 // TODO(nona): Implement it. 703 // TODO(nona): Implement it.
712 break; 704 break;
713 } 705 }
714 } 706 }
715 } 707 }
716 708
717 // TODO(nona): Support item.children. 709 // TODO(nona): Support item.children.
718 } 710 }
719 711
720 } // namespace chromeos 712 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/events/keyboard_driven_event_rewriter.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698