OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/events/event_rewriter.h" | 5 #include "chrome/browser/chromeos/events/event_rewriter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
| 9 #include "ash/sticky_keys/sticky_keys_controller.h" |
9 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
13 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
14 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
15 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
17 #include "chrome/browser/chromeos/login/users/user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/user_manager.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
20 #include "chromeos/chromeos_switches.h" | 22 #include "chromeos/chromeos_switches.h" |
21 #include "chromeos/ime/ime_keyboard.h" | 23 #include "chromeos/ime/ime_keyboard.h" |
22 #include "chromeos/ime/input_method_manager.h" | 24 #include "chromeos/ime/input_method_manager.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 }; | 148 }; |
147 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(flags); ++i) { | 149 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(flags); ++i) { |
148 if (ui_flags & flags[i].ui) | 150 if (ui_flags & flags[i].ui) |
149 *x_flags |= flags[i].x; | 151 *x_flags |= flags[i].x; |
150 else | 152 else |
151 *x_flags &= ~flags[i].x; | 153 *x_flags &= ~flags[i].x; |
152 } | 154 } |
153 } | 155 } |
154 #endif | 156 #endif |
155 | 157 |
| 158 bool IsSendEvent(const ui::Event& event) { |
| 159 #if defined(USE_X11) |
| 160 // Do not rewrite an event sent by ui_controls::SendKeyPress(). See |
| 161 // crbug.com/136465. |
| 162 XEvent* xev = event.native_event(); |
| 163 if (xev && xev->xany.send_event) |
| 164 return true; |
| 165 #endif |
| 166 return false; |
| 167 } |
| 168 |
156 } // namespace | 169 } // namespace |
157 | 170 |
158 EventRewriter::EventRewriter() | 171 EventRewriter::EventRewriter(ash::StickyKeysController* sticky_keys_controller) |
159 : last_device_id_(kBadDeviceId), | 172 : last_device_id_(kBadDeviceId), |
160 ime_keyboard_for_testing_(NULL), | 173 ime_keyboard_for_testing_(NULL), |
161 pref_service_for_testing_(NULL) { | 174 pref_service_for_testing_(NULL), |
| 175 sticky_keys_controller_(sticky_keys_controller) { |
162 #if defined(USE_X11) | 176 #if defined(USE_X11) |
163 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this); | 177 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this); |
164 if (base::SysInfo::IsRunningOnChromeOS()) { | 178 if (base::SysInfo::IsRunningOnChromeOS()) { |
165 XInputHierarchyChangedEventListener::GetInstance()->AddObserver(this); | 179 XInputHierarchyChangedEventListener::GetInstance()->AddObserver(this); |
166 } | 180 } |
167 #endif | 181 #endif |
168 } | 182 } |
169 | 183 |
170 EventRewriter::~EventRewriter() { | 184 EventRewriter::~EventRewriter() { |
171 #if defined(USE_X11) | 185 #if defined(USE_X11) |
(...skipping 11 matching lines...) Expand all Loading... |
183 } | 197 } |
184 | 198 |
185 void EventRewriter::RewriteLocatedEventForTesting(const ui::Event& event, | 199 void EventRewriter::RewriteLocatedEventForTesting(const ui::Event& event, |
186 int* flags) { | 200 int* flags) { |
187 RewriteLocatedEvent(event, flags); | 201 RewriteLocatedEvent(event, flags); |
188 } | 202 } |
189 | 203 |
190 ui::EventRewriteStatus EventRewriter::RewriteEvent( | 204 ui::EventRewriteStatus EventRewriter::RewriteEvent( |
191 const ui::Event& event, | 205 const ui::Event& event, |
192 scoped_ptr<ui::Event>* rewritten_event) { | 206 scoped_ptr<ui::Event>* rewritten_event) { |
193 #if defined(USE_X11) | 207 if ((event.type() == ui::ET_KEY_PRESSED) || |
194 // Do not rewrite an event sent by ui_controls::SendKeyPress(). See | 208 (event.type() == ui::ET_KEY_RELEASED)) { |
195 // crbug.com/136465. | 209 return RewriteKeyEvent(static_cast<const ui::KeyEvent&>(event), |
196 XEvent* xev = event.native_event(); | 210 rewritten_event); |
197 if (xev && xev->xany.send_event) | 211 } |
198 return ui::EVENT_REWRITE_CONTINUE; | 212 if ((event.type() == ui::ET_MOUSE_PRESSED) || |
199 #endif | 213 (event.type() == ui::ET_MOUSE_RELEASED)) { |
200 switch (event.type()) { | 214 return RewriteMouseButtonEvent(static_cast<const ui::MouseEvent&>(event), |
201 case ui::ET_KEY_PRESSED: | 215 rewritten_event); |
202 case ui::ET_KEY_RELEASED: | 216 } |
203 return RewriteKeyEvent(static_cast<const ui::KeyEvent&>(event), | 217 if (event.type() == ui::ET_MOUSEWHEEL) { |
| 218 return RewriteMouseWheelEvent( |
| 219 static_cast<const ui::MouseWheelEvent&>(event), rewritten_event); |
| 220 } |
| 221 if ((event.type() == ui::ET_TOUCH_PRESSED) || |
| 222 (event.type() == ui::ET_TOUCH_RELEASED)) { |
| 223 return RewriteTouchEvent(static_cast<const ui::TouchEvent&>(event), |
204 rewritten_event); | 224 rewritten_event); |
205 case ui::ET_MOUSE_PRESSED: | |
206 case ui::ET_MOUSE_RELEASED: | |
207 return RewriteMouseEvent(static_cast<const ui::MouseEvent&>(event), | |
208 rewritten_event); | |
209 case ui::ET_TOUCH_PRESSED: | |
210 case ui::ET_TOUCH_RELEASED: | |
211 return RewriteTouchEvent(static_cast<const ui::TouchEvent&>(event), | |
212 rewritten_event); | |
213 default: | |
214 return ui::EVENT_REWRITE_CONTINUE; | |
215 } | 225 } |
216 NOTREACHED(); | 226 if (event.IsScrollEvent()) { |
| 227 return RewriteScrollEvent(static_cast<const ui::ScrollEvent&>(event), |
| 228 rewritten_event); |
| 229 } |
| 230 return ui::EVENT_REWRITE_CONTINUE; |
217 } | 231 } |
218 | 232 |
219 ui::EventRewriteStatus EventRewriter::NextDispatchEvent( | 233 ui::EventRewriteStatus EventRewriter::NextDispatchEvent( |
220 const ui::Event& last_event, | 234 const ui::Event& last_event, |
221 scoped_ptr<ui::Event>* new_event) { | 235 scoped_ptr<ui::Event>* new_event) { |
| 236 if (sticky_keys_controller_) { |
| 237 // In the case of sticky keys, we know what the events obtained here are: |
| 238 // modifier key releases that match the ones previously discarded. So, we |
| 239 // know that they don't have to be passed through the post-sticky key |
| 240 // rewriting phases, |RewriteExtendedKeys()| and |RewriteFunctionKeys()|, |
| 241 // because those phases do nothing with modifier key releases. |
| 242 return sticky_keys_controller_->NextDispatchEvent(new_event); |
| 243 } |
222 NOTREACHED(); | 244 NOTREACHED(); |
223 return ui::EVENT_REWRITE_CONTINUE; | 245 return ui::EVENT_REWRITE_CONTINUE; |
224 } | 246 } |
225 | 247 |
226 #if defined(USE_X11) | 248 #if defined(USE_X11) |
227 void EventRewriter::DeviceKeyPressedOrReleased(int device_id) { | 249 void EventRewriter::DeviceKeyPressedOrReleased(int device_id) { |
228 if (!device_id_to_type_.count(device_id)) { | 250 if (!device_id_to_type_.count(device_id)) { |
229 // |device_id| is unknown. This means the device was connected before | 251 // |device_id| is unknown. This means the device was connected before |
230 // booting the OS. Query the name of the device and add it to the map. | 252 // booting the OS. Query the name of the device and add it to the map. |
231 DeviceAdded(device_id); | 253 DeviceAdded(device_id); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 remapped_state->flags = (input.flags & ~map.input_flags) | map.output_flags; | 348 remapped_state->flags = (input.flags & ~map.input_flags) | map.output_flags; |
327 return true; | 349 return true; |
328 } | 350 } |
329 return false; | 351 return false; |
330 } | 352 } |
331 | 353 |
332 ui::EventRewriteStatus EventRewriter::RewriteKeyEvent( | 354 ui::EventRewriteStatus EventRewriter::RewriteKeyEvent( |
333 const ui::KeyEvent& key_event, | 355 const ui::KeyEvent& key_event, |
334 scoped_ptr<ui::Event>* rewritten_event) { | 356 scoped_ptr<ui::Event>* rewritten_event) { |
335 MutableKeyState state = {key_event.flags(), key_event.key_code()}; | 357 MutableKeyState state = {key_event.flags(), key_event.key_code()}; |
336 RewriteModifierKeys(key_event, &state); | 358 bool is_send_event = IsSendEvent(key_event); |
337 RewriteNumPadKeys(key_event, &state); | 359 if (!is_send_event) { |
338 RewriteExtendedKeys(key_event, &state); | 360 RewriteModifierKeys(key_event, &state); |
339 RewriteFunctionKeys(key_event, &state); | 361 RewriteNumPadKeys(key_event, &state); |
| 362 } |
| 363 ui::EventRewriteStatus status = ui::EVENT_REWRITE_CONTINUE; |
| 364 if (sticky_keys_controller_) { |
| 365 status = sticky_keys_controller_->RewriteKeyEvent( |
| 366 key_event, state.key_code, &state.flags); |
| 367 if (status == ui::EVENT_REWRITE_DISCARD) |
| 368 return ui::EVENT_REWRITE_DISCARD; |
| 369 } |
| 370 if (!is_send_event) { |
| 371 RewriteExtendedKeys(key_event, &state); |
| 372 RewriteFunctionKeys(key_event, &state); |
| 373 } |
340 if ((key_event.flags() == state.flags) && | 374 if ((key_event.flags() == state.flags) && |
341 (key_event.key_code() == state.key_code)) { | 375 (key_event.key_code() == state.key_code) && |
| 376 (status == ui::EVENT_REWRITE_CONTINUE)) { |
342 return ui::EVENT_REWRITE_CONTINUE; | 377 return ui::EVENT_REWRITE_CONTINUE; |
343 } | 378 } |
| 379 // Sticky keys may have returned a result other than |EVENT_REWRITE_CONTINUE|, |
| 380 // in which case we need to preserve that return status. Alternatively, we |
| 381 // might be here because key_event changed, in which case we need to return |
| 382 // |EVENT_REWRITE_REWRITTEN|. |
| 383 if (status == ui::EVENT_REWRITE_CONTINUE) |
| 384 status = ui::EVENT_REWRITE_REWRITTEN; |
344 ui::KeyEvent* rewritten_key_event = new ui::KeyEvent(key_event); | 385 ui::KeyEvent* rewritten_key_event = new ui::KeyEvent(key_event); |
345 rewritten_event->reset(rewritten_key_event); | 386 rewritten_event->reset(rewritten_key_event); |
346 rewritten_key_event->set_flags(state.flags); | 387 rewritten_key_event->set_flags(state.flags); |
347 rewritten_key_event->set_key_code(state.key_code); | 388 rewritten_key_event->set_key_code(state.key_code); |
348 rewritten_key_event->set_character( | 389 rewritten_key_event->set_character( |
349 ui::GetCharacterFromKeyCode(state.key_code, state.flags)); | 390 ui::GetCharacterFromKeyCode(state.key_code, state.flags)); |
350 rewritten_key_event->NormalizeFlags(); | 391 rewritten_key_event->NormalizeFlags(); |
351 #if defined(USE_X11) | 392 #if defined(USE_X11) |
352 XEvent* xev = rewritten_key_event->native_event(); | 393 XEvent* xev = rewritten_key_event->native_event(); |
353 if (xev) { | 394 if (xev) { |
354 CHECK(xev->type == KeyPress || xev->type == KeyRelease); | 395 CHECK(xev->type == KeyPress || xev->type == KeyRelease); |
355 XKeyEvent* xkey = &(xev->xkey); | 396 XKeyEvent* xkey = &(xev->xkey); |
356 UpdateX11EventMask(rewritten_key_event->flags(), &xkey->state); | 397 UpdateX11EventMask(rewritten_key_event->flags(), &xkey->state); |
357 xkey->keycode = | 398 xkey->keycode = |
358 XKeysymToKeycode(gfx::GetXDisplay(), | 399 XKeysymToKeycode(gfx::GetXDisplay(), |
359 ui::XKeysymForWindowsKeyCode( | 400 ui::XKeysymForWindowsKeyCode( |
360 state.key_code, state.flags & ui::EF_SHIFT_DOWN)); | 401 state.key_code, state.flags & ui::EF_SHIFT_DOWN)); |
361 } | 402 } |
362 #endif | 403 #endif |
363 return ui::EVENT_REWRITE_REWRITTEN; | 404 return status; |
364 } | 405 } |
365 | 406 |
366 ui::EventRewriteStatus EventRewriter::RewriteMouseEvent( | 407 ui::EventRewriteStatus EventRewriter::RewriteMouseButtonEvent( |
367 const ui::MouseEvent& mouse_event, | 408 const ui::MouseEvent& mouse_event, |
368 scoped_ptr<ui::Event>* rewritten_event) { | 409 scoped_ptr<ui::Event>* rewritten_event) { |
369 int flags = mouse_event.flags(); | 410 int flags = mouse_event.flags(); |
370 RewriteLocatedEvent(mouse_event, &flags); | 411 RewriteLocatedEvent(mouse_event, &flags); |
371 if (mouse_event.flags() == flags) | 412 ui::EventRewriteStatus status = ui::EVENT_REWRITE_CONTINUE; |
| 413 if (sticky_keys_controller_) |
| 414 status = sticky_keys_controller_->RewriteMouseEvent(mouse_event, &flags); |
| 415 if ((mouse_event.flags() == flags) && |
| 416 (status == ui::EVENT_REWRITE_CONTINUE)) { |
372 return ui::EVENT_REWRITE_CONTINUE; | 417 return ui::EVENT_REWRITE_CONTINUE; |
| 418 } |
| 419 if (status == ui::EVENT_REWRITE_CONTINUE) |
| 420 status = ui::EVENT_REWRITE_REWRITTEN; |
373 ui::MouseEvent* rewritten_mouse_event = new ui::MouseEvent(mouse_event); | 421 ui::MouseEvent* rewritten_mouse_event = new ui::MouseEvent(mouse_event); |
374 rewritten_event->reset(rewritten_mouse_event); | 422 rewritten_event->reset(rewritten_mouse_event); |
375 rewritten_mouse_event->set_flags(flags); | 423 rewritten_mouse_event->set_flags(flags); |
376 #if defined(USE_X11) | 424 #if defined(USE_X11) |
377 XEvent* xev = rewritten_mouse_event->native_event(); | 425 XEvent* xev = rewritten_mouse_event->native_event(); |
378 if (xev) { | 426 if (xev) { |
379 switch (xev->type) { | 427 switch (xev->type) { |
380 case ButtonPress: | 428 case ButtonPress: |
381 case ButtonRelease: { | 429 case ButtonRelease: { |
382 XButtonEvent* xbutton = &(xev->xbutton); | 430 XButtonEvent* xbutton = &(xev->xbutton); |
383 UpdateX11EventMask(rewritten_mouse_event->flags(), &xbutton->state); | 431 UpdateX11EventMask(rewritten_mouse_event->flags(), &xbutton->state); |
384 break; | 432 break; |
385 } | 433 } |
386 case GenericEvent: { | 434 case GenericEvent: { |
387 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); | 435 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
388 CHECK(xievent->evtype == XI_ButtonPress || | 436 CHECK(xievent->evtype == XI_ButtonPress || |
389 xievent->evtype == XI_ButtonRelease); | 437 xievent->evtype == XI_ButtonRelease); |
390 UpdateX11EventMask( | 438 UpdateX11EventMask( |
391 rewritten_mouse_event->flags(), | 439 rewritten_mouse_event->flags(), |
392 reinterpret_cast<unsigned int*>(&xievent->mods.effective)); | 440 reinterpret_cast<unsigned int*>(&xievent->mods.effective)); |
393 break; | 441 break; |
394 } | 442 } |
395 default: | 443 default: |
396 NOTREACHED(); | 444 NOTREACHED(); |
397 } | 445 } |
398 } | 446 } |
399 #endif | 447 #endif |
400 return ui::EVENT_REWRITE_REWRITTEN; | 448 return status; |
| 449 } |
| 450 |
| 451 ui::EventRewriteStatus EventRewriter::RewriteMouseWheelEvent( |
| 452 const ui::MouseWheelEvent& wheel_event, |
| 453 scoped_ptr<ui::Event>* rewritten_event) { |
| 454 if (!sticky_keys_controller_) |
| 455 return ui::EVENT_REWRITE_CONTINUE; |
| 456 int flags = wheel_event.flags(); |
| 457 ui::EventRewriteStatus status = |
| 458 sticky_keys_controller_->RewriteMouseEvent(wheel_event, &flags); |
| 459 if ((wheel_event.flags() == flags) && |
| 460 (status == ui::EVENT_REWRITE_CONTINUE)) { |
| 461 return ui::EVENT_REWRITE_CONTINUE; |
| 462 } |
| 463 if (status == ui::EVENT_REWRITE_CONTINUE) |
| 464 status = ui::EVENT_REWRITE_REWRITTEN; |
| 465 ui::MouseWheelEvent* rewritten_wheel_event = |
| 466 new ui::MouseWheelEvent(wheel_event); |
| 467 rewritten_event->reset(rewritten_wheel_event); |
| 468 rewritten_wheel_event->set_flags(flags); |
| 469 #if defined(USE_X11) |
| 470 XEvent* xev = rewritten_wheel_event->native_event(); |
| 471 if (xev) { |
| 472 switch (xev->type) { |
| 473 case ButtonPress: |
| 474 case ButtonRelease: { |
| 475 XButtonEvent* xbutton = &(xev->xbutton); |
| 476 UpdateX11EventMask(rewritten_wheel_event->flags(), &xbutton->state); |
| 477 break; |
| 478 } |
| 479 case GenericEvent: { |
| 480 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
| 481 CHECK(xievent->evtype == XI_ButtonPress || |
| 482 xievent->evtype == XI_ButtonRelease); |
| 483 UpdateX11EventMask( |
| 484 rewritten_wheel_event->flags(), |
| 485 reinterpret_cast<unsigned int*>(&xievent->mods.effective)); |
| 486 break; |
| 487 } |
| 488 default: |
| 489 NOTREACHED(); |
| 490 } |
| 491 } |
| 492 #endif |
| 493 return status; |
401 } | 494 } |
402 | 495 |
403 ui::EventRewriteStatus EventRewriter::RewriteTouchEvent( | 496 ui::EventRewriteStatus EventRewriter::RewriteTouchEvent( |
404 const ui::TouchEvent& touch_event, | 497 const ui::TouchEvent& touch_event, |
405 scoped_ptr<ui::Event>* rewritten_event) { | 498 scoped_ptr<ui::Event>* rewritten_event) { |
406 int flags = touch_event.flags(); | 499 int flags = touch_event.flags(); |
407 RewriteLocatedEvent(touch_event, &flags); | 500 RewriteLocatedEvent(touch_event, &flags); |
408 if (touch_event.flags() == flags) | 501 if (touch_event.flags() == flags) |
409 return ui::EVENT_REWRITE_CONTINUE; | 502 return ui::EVENT_REWRITE_CONTINUE; |
410 ui::TouchEvent* rewritten_touch_event = new ui::TouchEvent(touch_event); | 503 ui::TouchEvent* rewritten_touch_event = new ui::TouchEvent(touch_event); |
411 rewritten_event->reset(rewritten_touch_event); | 504 rewritten_event->reset(rewritten_touch_event); |
412 rewritten_touch_event->set_flags(flags); | 505 rewritten_touch_event->set_flags(flags); |
413 #if defined(USE_X11) | 506 #if defined(USE_X11) |
414 XEvent* xev = rewritten_touch_event->native_event(); | 507 XEvent* xev = rewritten_touch_event->native_event(); |
415 if (xev) { | 508 if (xev) { |
416 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); | 509 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
417 if (xievent) { | 510 if (xievent) { |
418 UpdateX11EventMask( | 511 UpdateX11EventMask( |
419 rewritten_touch_event->flags(), | 512 rewritten_touch_event->flags(), |
420 reinterpret_cast<unsigned int*>(&xievent->mods.effective)); | 513 reinterpret_cast<unsigned int*>(&xievent->mods.effective)); |
421 } | 514 } |
422 } | 515 } |
423 #endif | 516 #endif |
424 return ui::EVENT_REWRITE_REWRITTEN; | 517 return ui::EVENT_REWRITE_REWRITTEN; |
425 } | 518 } |
426 | 519 |
| 520 ui::EventRewriteStatus EventRewriter::RewriteScrollEvent( |
| 521 const ui::ScrollEvent& scroll_event, |
| 522 scoped_ptr<ui::Event>* rewritten_event) { |
| 523 int flags = scroll_event.flags(); |
| 524 ui::EventRewriteStatus status = ui::EVENT_REWRITE_CONTINUE; |
| 525 if (sticky_keys_controller_) |
| 526 status = sticky_keys_controller_->RewriteScrollEvent(scroll_event, &flags); |
| 527 if (status == ui::EVENT_REWRITE_CONTINUE) |
| 528 return status; |
| 529 ui::ScrollEvent* rewritten_scroll_event = new ui::ScrollEvent(scroll_event); |
| 530 rewritten_event->reset(rewritten_scroll_event); |
| 531 rewritten_scroll_event->set_flags(flags); |
| 532 #if defined(USE_X11) |
| 533 XEvent* xev = rewritten_scroll_event->native_event(); |
| 534 if (xev) { |
| 535 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
| 536 if (xievent) { |
| 537 UpdateX11EventMask( |
| 538 rewritten_scroll_event->flags(), |
| 539 reinterpret_cast<unsigned int*>(&xievent->mods.effective)); |
| 540 } |
| 541 } |
| 542 #endif |
| 543 return status; |
| 544 } |
| 545 |
427 void EventRewriter::RewriteModifierKeys(const ui::KeyEvent& key_event, | 546 void EventRewriter::RewriteModifierKeys(const ui::KeyEvent& key_event, |
428 MutableKeyState* state) { | 547 MutableKeyState* state) { |
429 DCHECK(key_event.type() == ui::ET_KEY_PRESSED || | 548 DCHECK(key_event.type() == ui::ET_KEY_PRESSED || |
430 key_event.type() == ui::ET_KEY_RELEASED); | 549 key_event.type() == ui::ET_KEY_RELEASED); |
431 | 550 |
432 // Do nothing if we have just logged in as guest but have not restarted chrome | 551 // Do nothing if we have just logged in as guest but have not restarted chrome |
433 // process yet (so we are still on the login screen). In this situations we | 552 // process yet (so we are still on the login screen). In this situations we |
434 // have no user profile so can not do anything useful. | 553 // have no user profile so can not do anything useful. |
435 // Note that currently, unlike other accounts, when user logs in as guest, we | 554 // Note that currently, unlike other accounts, when user logs in as guest, we |
436 // restart chrome process. In future this is to be changed. | 555 // restart chrome process. In future this is to be changed. |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 | 933 |
815 XIFreeDeviceInfo(device_info); | 934 XIFreeDeviceInfo(device_info); |
816 } | 935 } |
817 | 936 |
818 void EventRewriter::DeviceRemoved(int device_id) { | 937 void EventRewriter::DeviceRemoved(int device_id) { |
819 device_id_to_type_.erase(device_id); | 938 device_id_to_type_.erase(device_id); |
820 } | 939 } |
821 #endif | 940 #endif |
822 | 941 |
823 } // namespace chromeos | 942 } // namespace chromeos |
OLD | NEW |