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

Side by Side Diff: ui/events/test/event_generator.cc

Issue 1185753008: Proposed alternative for supporting ChromeVox keyboard commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 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 "ui/events/test/event_generator.h" 5 #include "ui/events/test/event_generator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) { 511 void EventGenerator::ReleaseKey(ui::KeyboardCode key_code, int flags) {
512 DispatchKeyEvent(false, key_code, flags); 512 DispatchKeyEvent(false, key_code, flags);
513 } 513 }
514 514
515 void EventGenerator::Dispatch(ui::Event* event) { 515 void EventGenerator::Dispatch(ui::Event* event) {
516 DoDispatchEvent(event, async_); 516 DoDispatchEvent(event, async_);
517 } 517 }
518 518
519 void EventGenerator::AddEventRewriter(ui::EventRewriter* event_rewriter) {
520 delegate()->GetEventSource(current_target_)->AddEventRewriter(event_rewriter);
521 }
522
523 void EventGenerator::RemoveEventRewriter(ui::EventRewriter* event_rewriter) {
524 delegate()
525 ->GetEventSource(current_target_)
526 ->RemoveEventRewriter(event_rewriter);
527 }
528
519 void EventGenerator::SetTickClock(scoped_ptr<base::TickClock> tick_clock) { 529 void EventGenerator::SetTickClock(scoped_ptr<base::TickClock> tick_clock) {
520 tick_clock_ = tick_clock.Pass(); 530 tick_clock_ = tick_clock.Pass();
521 } 531 }
522 532
523 base::TimeDelta EventGenerator::Now() { 533 base::TimeDelta EventGenerator::Now() {
524 // This is the same as what EventTimeForNow() does, but here we do it 534 // This is the same as what EventTimeForNow() does, but here we do it
525 // with a tick clock that can be replaced with a simulated clock for tests. 535 // with a tick clock that can be replaced with a simulated clock for tests.
526 return base::TimeDelta::FromInternalValue( 536 return base::TimeDelta::FromInternalValue(
527 tick_clock_->NowTicks().ToInternalValue()); 537 tick_clock_->NowTicks().ToInternalValue());
528 } 538 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return default_delegate; 668 return default_delegate;
659 } 669 }
660 670
661 EventGeneratorDelegate* EventGenerator::delegate() { 671 EventGeneratorDelegate* EventGenerator::delegate() {
662 return const_cast<EventGeneratorDelegate*>( 672 return const_cast<EventGeneratorDelegate*>(
663 const_cast<const EventGenerator*>(this)->delegate()); 673 const_cast<const EventGenerator*>(this)->delegate());
664 } 674 }
665 675
666 } // namespace test 676 } // namespace test
667 } // namespace ui 677 } // namespace ui
OLDNEW
« ui/events/test/event_generator.h ('K') | « ui/events/test/event_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698