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

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: Created 5 years, 4 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()),
kpschoedel 2015/08/07 20:42:11 KeyStringToDomKey() now handles the case where |ke
Wez 2015/08/13 22:31:48 What does it return if the string passed is neithe
kpschoedel 2015/08/17 20:16:14 DomKey::NONE; this is noted in the declaration com
Wez 2015/08/18 22:34:32 Acknowledged.
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 input_method->DispatchKeyEvent(&ui_event); 319 input_method->DispatchKeyEvent(&ui_event);
328 } 320 }
329 321
330 return true; 322 return true;
331 } 323 }
332 324
333 const InputMethodEngine::CandidateWindowProperty& 325 const InputMethodEngine::CandidateWindowProperty&
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 // TODO(nona): Implement it. 700 // TODO(nona): Implement it.
709 break; 701 break;
710 } 702 }
711 } 703 }
712 } 704 }
713 705
714 // TODO(nona): Support item.children. 706 // TODO(nona): Support item.children.
715 } 707 }
716 708
717 } // namespace chromeos 709 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698