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

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: 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
« no previous file with comments | « ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20 matching lines...) Expand all
31 #include "url/gurl.h" 31 #include "url/gurl.h"
32 32
33 namespace { 33 namespace {
34 34
35 const char kKeyDown[] ="keydown"; 35 const char kKeyDown[] ="keydown";
36 const char kKeyUp[] = "keyup"; 36 const char kKeyUp[] = "keyup";
37 37
38 void SendProcessKeyEvent(ui::EventType type, 38 void SendProcessKeyEvent(ui::EventType type,
39 aura::WindowTreeHost* host) { 39 aura::WindowTreeHost* host) {
40 ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE, 40 ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE,
41 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS, 0, 41 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS,
42 ui::EventTimeForNow()); 42 ui::EventTimeForNow());
43 ui::EventDispatchDetails details = 43 ui::EventDispatchDetails details =
44 host->event_processor()->OnEventFromSource(&event); 44 host->event_processor()->OnEventFromSource(&event);
45 CHECK(!details.dispatcher_destroyed); 45 CHECK(!details.dispatcher_destroyed);
46 } 46 }
47 47
48 base::LazyInstance<base::Time> g_keyboard_load_time_start = 48 base::LazyInstance<base::Time> g_keyboard_load_time_start =
49 LAZY_INSTANCE_INITIALIZER; 49 LAZY_INSTANCE_INITIALIZER;
50 50
51 bool g_accessibility_keyboard_enabled = false; 51 bool g_accessibility_keyboard_enabled = false;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 if (swipe_direction & kCursorMoveUp) 247 if (swipe_direction & kCursorMoveUp)
248 domcodey = ui::DomCode::ARROW_UP; 248 domcodey = ui::DomCode::ARROW_UP;
249 else if (swipe_direction & kCursorMoveDown) 249 else if (swipe_direction & kCursorMoveDown)
250 domcodey = ui::DomCode::ARROW_DOWN; 250 domcodey = ui::DomCode::ARROW_DOWN;
251 251
252 // First deal with the x movement. 252 // First deal with the x movement.
253 if (domcodex != ui::DomCode::NONE) { 253 if (domcodex != ui::DomCode::NONE) {
254 ui::KeyboardCode codex = ui::VKEY_UNKNOWN; 254 ui::KeyboardCode codex = ui::VKEY_UNKNOWN;
255 ui::DomKey domkeyx = ui::DomKey::NONE; 255 ui::DomKey domkeyx = ui::DomKey::NONE;
256 base::char16 cx; 256 ignore_result(DomCodeToUsLayoutDomKey(domcodex, ui::EF_NONE, &domkeyx,
257 ignore_result(DomCodeToUsLayoutMeaning(domcodex, ui::EF_NONE, &domkeyx, 257 &codex));
258 &cx, &codex));
259 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codex, domcodex, 258 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codex, domcodex,
260 modifier_flags, domkeyx, cx, 259 modifier_flags, domkeyx,
261 ui::EventTimeForNow()); 260 ui::EventTimeForNow());
262 ui::EventDispatchDetails details = 261 ui::EventDispatchDetails details =
263 host->event_processor()->OnEventFromSource(&press_event); 262 host->event_processor()->OnEventFromSource(&press_event);
264 CHECK(!details.dispatcher_destroyed); 263 CHECK(!details.dispatcher_destroyed);
265 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codex, domcodex, 264 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codex, domcodex,
266 modifier_flags, domkeyx, cx, 265 modifier_flags, domkeyx,
267 ui::EventTimeForNow()); 266 ui::EventTimeForNow());
268 details = host->event_processor()->OnEventFromSource(&release_event); 267 details = host->event_processor()->OnEventFromSource(&release_event);
269 CHECK(!details.dispatcher_destroyed); 268 CHECK(!details.dispatcher_destroyed);
270 } 269 }
271 270
272 // Then deal with the y movement. 271 // Then deal with the y movement.
273 if (domcodey != ui::DomCode::NONE) { 272 if (domcodey != ui::DomCode::NONE) {
274 ui::KeyboardCode codey = ui::VKEY_UNKNOWN; 273 ui::KeyboardCode codey = ui::VKEY_UNKNOWN;
275 ui::DomKey domkeyy = ui::DomKey::NONE; 274 ui::DomKey domkeyy = ui::DomKey::NONE;
276 base::char16 cy; 275 ignore_result(DomCodeToUsLayoutDomKey(domcodey, ui::EF_NONE, &domkeyy,
277 ignore_result(DomCodeToUsLayoutMeaning(domcodey, ui::EF_NONE, &domkeyy, 276 &codey));
278 &cy, &codey));
279 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codey, domcodey, 277 ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codey, domcodey,
280 modifier_flags, domkeyy, cy, 278 modifier_flags, domkeyy,
281 ui::EventTimeForNow()); 279 ui::EventTimeForNow());
282 ui::EventDispatchDetails details = 280 ui::EventDispatchDetails details =
283 host->event_processor()->OnEventFromSource(&press_event); 281 host->event_processor()->OnEventFromSource(&press_event);
284 CHECK(!details.dispatcher_destroyed); 282 CHECK(!details.dispatcher_destroyed);
285 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codey, domcodey, 283 ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codey, domcodey,
286 modifier_flags, domkeyy, cy, 284 modifier_flags, domkeyy,
287 ui::EventTimeForNow()); 285 ui::EventTimeForNow());
288 details = host->event_processor()->OnEventFromSource(&release_event); 286 details = host->event_processor()->OnEventFromSource(&release_event);
289 CHECK(!details.dispatcher_destroyed); 287 CHECK(!details.dispatcher_destroyed);
290 } 288 }
291 return true; 289 return true;
292 } 290 }
293 291
294 bool SendKeyEvent(const std::string type, 292 bool SendKeyEvent(const std::string type,
295 int key_value, 293 int key_value,
296 int key_code, 294 int key_code,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 473 }
476 474
477 void LogKeyboardControlEvent(KeyboardControlEvent event) { 475 void LogKeyboardControlEvent(KeyboardControlEvent event) {
478 UMA_HISTOGRAM_ENUMERATION( 476 UMA_HISTOGRAM_ENUMERATION(
479 "VirtualKeyboard.KeyboardControlEvent", 477 "VirtualKeyboard.KeyboardControlEvent",
480 event, 478 event,
481 keyboard::KEYBOARD_CONTROL_MAX); 479 keyboard::KEYBOARD_CONTROL_MAX);
482 } 480 }
483 481
484 } // namespace keyboard 482 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698