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

Side by Side Diff: ui/keyboard/keyboard_util.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/keyboard/keyboard_util.h" 5 #include "ui/keyboard/keyboard_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 18 matching lines...) Expand all
29 #include "url/gurl.h" 29 #include "url/gurl.h"
30 30
31 namespace { 31 namespace {
32 32
33 const char kKeyDown[] ="keydown"; 33 const char kKeyDown[] ="keydown";
34 const char kKeyUp[] = "keyup"; 34 const char kKeyUp[] = "keyup";
35 35
36 void SendProcessKeyEvent(ui::EventType type, 36 void SendProcessKeyEvent(ui::EventType type,
37 aura::WindowTreeHost* host) { 37 aura::WindowTreeHost* host) {
38 ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE, 38 ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE,
39 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS, 0, 39 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS,
40 ui::EventTimeForNow()); 40 ui::EventTimeForNow());
41 ui::EventDispatchDetails details = 41 ui::EventDispatchDetails details =
42 host->event_processor()->OnEventFromSource(&event); 42 host->event_processor()->OnEventFromSource(&event);
43 CHECK(!details.dispatcher_destroyed); 43 CHECK(!details.dispatcher_destroyed);
44 } 44 }
45 45
46 base::LazyInstance<base::Time> g_keyboard_load_time_start = 46 base::LazyInstance<base::Time> g_keyboard_load_time_start =
47 LAZY_INSTANCE_INITIALIZER; 47 LAZY_INSTANCE_INITIALIZER;
48 48
49 bool g_accessibility_keyboard_enabled = false; 49 bool g_accessibility_keyboard_enabled = false;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 if (swipe_direction & kCursorMoveUp) 225 if (swipe_direction & kCursorMoveUp)
226 domcodey = ui::DomCode::ARROW_UP; 226 domcodey = ui::DomCode::ARROW_UP;
227 else if (swipe_direction & kCursorMoveDown) 227 else if (swipe_direction & kCursorMoveDown)
228 domcodey = ui::DomCode::ARROW_DOWN; 228 domcodey = ui::DomCode::ARROW_DOWN;
229 229
230 // First deal with the x movement. 230 // First deal with the x movement.
231 if (domcodex != ui::DomCode::NONE) { 231 if (domcodex != ui::DomCode::NONE) {
232 ui::KeyboardCode codex = ui::VKEY_UNKNOWN; 232 ui::KeyboardCode codex = ui::VKEY_UNKNOWN;
233 ui::DomKey domkeyx = ui::DomKey::NONE; 233 ui::DomKey domkeyx = ui::DomKey::NONE;
234 base::char16 cx; 234 ignore_result(DomCodeToUsLayoutDomKey(domcodex, ui::EF_NONE, &domkeyx,
235 ignore_result(DomCodeToUsLayoutMeaning(domcodex, ui::EF_NONE, &domkeyx, 235 &codex));
236 &cx, &codex));
237 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codex, domcodex, 236 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codex, domcodex,
238 modifier_flags, domkeyx, cx, 237 modifier_flags, domkeyx,
239 ui::EventTimeForNow()); 238 ui::EventTimeForNow());
240 ui::EventDispatchDetails details = 239 ui::EventDispatchDetails details =
241 host->event_processor()->OnEventFromSource(&press_event); 240 host->event_processor()->OnEventFromSource(&press_event);
242 CHECK(!details.dispatcher_destroyed); 241 CHECK(!details.dispatcher_destroyed);
243 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codex, domcodex, 242 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codex, domcodex,
244 modifier_flags, domkeyx, cx, 243 modifier_flags, domkeyx,
245 ui::EventTimeForNow()); 244 ui::EventTimeForNow());
246 details = host->event_processor()->OnEventFromSource(&release_event); 245 details = host->event_processor()->OnEventFromSource(&release_event);
247 CHECK(!details.dispatcher_destroyed); 246 CHECK(!details.dispatcher_destroyed);
248 } 247 }
249 248
250 // Then deal with the y movement. 249 // Then deal with the y movement.
251 if (domcodey != ui::DomCode::NONE) { 250 if (domcodey != ui::DomCode::NONE) {
252 ui::KeyboardCode codey = ui::VKEY_UNKNOWN; 251 ui::KeyboardCode codey = ui::VKEY_UNKNOWN;
253 ui::DomKey domkeyy = ui::DomKey::NONE; 252 ui::DomKey domkeyy = ui::DomKey::NONE;
254 base::char16 cy; 253 ignore_result(DomCodeToUsLayoutDomKey(domcodey, ui::EF_NONE, &domkeyy,
255 ignore_result(DomCodeToUsLayoutMeaning(domcodey, ui::EF_NONE, &domkeyy, 254 &codey));
256 &cy, &codey));
257 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codey, domcodey, 255 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codey, domcodey,
258 modifier_flags, domkeyy, cy, 256 modifier_flags, domkeyy,
259 ui::EventTimeForNow()); 257 ui::EventTimeForNow());
260 ui::EventDispatchDetails details = 258 ui::EventDispatchDetails details =
261 host->event_processor()->OnEventFromSource(&press_event); 259 host->event_processor()->OnEventFromSource(&press_event);
262 CHECK(!details.dispatcher_destroyed); 260 CHECK(!details.dispatcher_destroyed);
263 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codey, domcodey, 261 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codey, domcodey,
264 modifier_flags, domkeyy, cy, 262 modifier_flags, domkeyy,
265 ui::EventTimeForNow()); 263 ui::EventTimeForNow());
266 details = host->event_processor()->OnEventFromSource(&release_event); 264 details = host->event_processor()->OnEventFromSource(&release_event);
267 CHECK(!details.dispatcher_destroyed); 265 CHECK(!details.dispatcher_destroyed);
268 } 266 }
269 return true; 267 return true;
270 } 268 }
271 269
272 bool SendKeyEvent(const std::string type, 270 bool SendKeyEvent(const std::string type,
273 int key_value, 271 int key_value,
274 int key_code, 272 int key_code,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 451 }
454 452
455 void LogKeyboardControlEvent(KeyboardControlEvent event) { 453 void LogKeyboardControlEvent(KeyboardControlEvent event) {
456 UMA_HISTOGRAM_ENUMERATION( 454 UMA_HISTOGRAM_ENUMERATION(
457 "VirtualKeyboard.KeyboardControlEvent", 455 "VirtualKeyboard.KeyboardControlEvent",
458 event, 456 event,
459 keyboard::KEYBOARD_CONTROL_MAX); 457 keyboard::KEYBOARD_CONTROL_MAX);
460 } 458 }
461 459
462 } // namespace keyboard 460 } // namespace keyboard
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698