OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_EVENTS_TEST_TEST_EVENT_TARGETER_H_ |
| 6 #define UI_EVENTS_TEST_TEST_EVENT_TARGETER_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" |
| 10 #include "ui/events/event_targeter.h" |
| 11 |
| 12 namespace ui { |
| 13 namespace test { |
| 14 |
| 15 class TestEventTarget; |
| 16 |
| 17 // An EventTargeter which is used to allow a bubbling behaviour in event |
| 18 // dispatch: if an event is not handled after being dispatched to its |
| 19 // |initial_target|, the event is dispatched to the next-best target as |
| 20 // specified by FindNextBestTarget(). |
| 21 // Bubbling behaviour is controlled by |should_bubble| at creation time. |
| 22 class TestEventTargeter : public EventTargeter { |
| 23 public: |
| 24 TestEventTargeter(TestEventTarget* initial_target, bool should_bubble); |
| 25 ~TestEventTargeter() override; |
| 26 |
| 27 void set_target(TestEventTarget* target); |
| 28 |
| 29 private: |
| 30 // EventTargeter: |
| 31 EventTarget* FindTargetForEvent(EventTarget* root, Event* event) override; |
| 32 EventTarget* FindNextBestTarget(EventTarget* previous_target, |
| 33 Event* event) override; |
| 34 |
| 35 TestEventTarget* target_; |
| 36 bool should_bubble_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(TestEventTargeter); |
| 39 }; |
| 40 |
| 41 } // namespace test |
| 42 } // namespace ui |
| 43 |
| 44 #endif // UI_EVENTS_TEST_TEST_EVENT_TARGETER_H_ |
OLD | NEW |