| OLD | NEW |
| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } | 589 } |
| 590 if (pending_events_.empty()) { | 590 if (pending_events_.empty()) { |
| 591 base::MessageLoopProxy::current()->PostTask( | 591 base::MessageLoopProxy::current()->PostTask( |
| 592 FROM_HERE, | 592 FROM_HERE, |
| 593 base::Bind(&EventGenerator::DispatchNextPendingEvent, | 593 base::Bind(&EventGenerator::DispatchNextPendingEvent, |
| 594 base::Unretained(this))); | 594 base::Unretained(this))); |
| 595 } | 595 } |
| 596 pending_events_.push_back(pending_event); | 596 pending_events_.push_back(pending_event); |
| 597 } else { | 597 } else { |
| 598 ui::EventDispatchDetails details = current_root_window_->OnEventFromSource( | 598 ui::EventDispatchDetails details = current_root_window_->OnEventFromSource( |
| 599 static_cast<ui::KeyEvent*>(event)); | 599 event); |
| 600 CHECK(!details.dispatcher_destroyed); | 600 CHECK(!details.dispatcher_destroyed); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 void EventGenerator::DispatchNextPendingEvent() { | 604 void EventGenerator::DispatchNextPendingEvent() { |
| 605 DCHECK(!pending_events_.empty()); | 605 DCHECK(!pending_events_.empty()); |
| 606 ui::Event* event = pending_events_.front(); | 606 ui::Event* event = pending_events_.front(); |
| 607 DoDispatchEvent(event, false); | 607 DoDispatchEvent(event, false); |
| 608 pending_events_.pop_front(); | 608 pending_events_.pop_front(); |
| 609 delete event; | 609 delete event; |
| 610 if (!pending_events_.empty()) { | 610 if (!pending_events_.empty()) { |
| 611 base::MessageLoopProxy::current()->PostTask( | 611 base::MessageLoopProxy::current()->PostTask( |
| 612 FROM_HERE, | 612 FROM_HERE, |
| 613 base::Bind(&EventGenerator::DispatchNextPendingEvent, | 613 base::Bind(&EventGenerator::DispatchNextPendingEvent, |
| 614 base::Unretained(this))); | 614 base::Unretained(this))); |
| 615 } | 615 } |
| 616 } | 616 } |
| 617 | 617 |
| 618 | 618 |
| 619 } // namespace test | 619 } // namespace test |
| 620 } // namespace aura | 620 } // namespace aura |
| OLD | NEW |