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

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

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/aura_test_base.cc ('k') | ui/aura/window_targeter_unittest.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/test/event_generator.h" 5 #include "ui/aura/test/event_generator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "ui/aura/client/screen_position_client.h" 10 #include "ui/aura/client/screen_position_client.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 return; 580 return;
581 } 581 }
582 if (pending_events_.empty()) { 582 if (pending_events_.empty()) {
583 base::MessageLoopProxy::current()->PostTask( 583 base::MessageLoopProxy::current()->PostTask(
584 FROM_HERE, 584 FROM_HERE,
585 base::Bind(&EventGenerator::DispatchNextPendingEvent, 585 base::Bind(&EventGenerator::DispatchNextPendingEvent,
586 base::Unretained(this))); 586 base::Unretained(this)));
587 } 587 }
588 pending_events_.push_back(pending_event); 588 pending_events_.push_back(pending_event);
589 } else { 589 } else {
590 WindowTreeHostDelegate* root_window_host_delegate = 590 ui::EventDispatchDetails details = current_root_window_->OnEventFromSource(
591 current_root_window_->AsWindowTreeHostDelegate(); 591 static_cast<ui::KeyEvent*>(event));
592 if (event->IsKeyEvent()) { 592 CHECK(!details.dispatcher_destroyed);
593 root_window_host_delegate->OnHostKeyEvent(
594 static_cast<ui::KeyEvent*>(event));
595 } else if (event->IsMouseEvent()) {
596 root_window_host_delegate->OnHostMouseEvent(
597 static_cast<ui::MouseEvent*>(event));
598 } else if (event->IsTouchEvent()) {
599 root_window_host_delegate->OnHostTouchEvent(
600 static_cast<ui::TouchEvent*>(event));
601 } else if (event->IsScrollEvent()) {
602 root_window_host_delegate->OnHostScrollEvent(
603 static_cast<ui::ScrollEvent*>(event));
604 } else {
605 NOTREACHED() << "Invalid event type";
606 }
607 } 593 }
608 } 594 }
609 595
610 void EventGenerator::DispatchNextPendingEvent() { 596 void EventGenerator::DispatchNextPendingEvent() {
611 DCHECK(!pending_events_.empty()); 597 DCHECK(!pending_events_.empty());
612 ui::Event* event = pending_events_.front(); 598 ui::Event* event = pending_events_.front();
613 DoDispatchEvent(event, false); 599 DoDispatchEvent(event, false);
614 pending_events_.pop_front(); 600 pending_events_.pop_front();
615 delete event; 601 delete event;
616 if (!pending_events_.empty()) { 602 if (!pending_events_.empty()) {
617 base::MessageLoopProxy::current()->PostTask( 603 base::MessageLoopProxy::current()->PostTask(
618 FROM_HERE, 604 FROM_HERE,
619 base::Bind(&EventGenerator::DispatchNextPendingEvent, 605 base::Bind(&EventGenerator::DispatchNextPendingEvent,
620 base::Unretained(this))); 606 base::Unretained(this)));
621 } 607 }
622 } 608 }
623 609
624 610
625 } // namespace test 611 } // namespace test
626 } // namespace aura 612 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_base.cc ('k') | ui/aura/window_targeter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698