Chromium Code Reviews| 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 #ifndef UI_EVENTS_TEST_EVENT_GENERATOR_H_ | 5 #ifndef UI_EVENTS_TEST_EVENT_GENERATOR_H_ |
| 6 #define UI_EVENTS_TEST_EVENT_GENERATOR_H_ | 6 #define UI_EVENTS_TEST_EVENT_GENERATOR_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 // various methods that take a location but can be manipulated directly, | 131 // various methods that take a location but can be manipulated directly, |
| 132 // typically for touch. | 132 // typically for touch. |
| 133 void set_current_location(const gfx::Point& location) { | 133 void set_current_location(const gfx::Point& location) { |
| 134 current_location_ = location; | 134 current_location_ = location; |
| 135 } | 135 } |
| 136 const gfx::Point& current_location() const { return current_location_; } | 136 const gfx::Point& current_location() const { return current_location_; } |
| 137 | 137 |
| 138 void set_async(bool async) { async_ = async; } | 138 void set_async(bool async) { async_ = async; } |
| 139 bool async() const { return async_; } | 139 bool async() const { return async_; } |
| 140 | 140 |
| 141 // Dispatch events through the application instead of directly to the | 141 // Events could be dispatched using different methods. |
|
tapted
2016/11/18 07:28:04
I'd add a sentence like
"The choice is a tradeoff
themblsha
2016/11/18 13:31:50
Done.
| |
| 142 // target window. Currently only supported on Mac. | 142 // Currently only supported on Mac. |
| 143 void set_targeting_application(bool targeting_application) { | 143 enum class Target { |
| 144 targeting_application_ = targeting_application; | 144 // Dispatch through the application. |
|
tapted
2016/11/18 07:28:04
"Least robust."
themblsha
2016/11/18 13:31:50
Done.
| |
| 145 APPLICATION, | |
| 146 // Dispatch directly to target window. | |
| 147 WINDOW, | |
| 148 // Default. Emulates default Window dispatch. | |
|
tapted
2016/11/18 07:28:04
"Most robust."
themblsha
2016/11/18 13:31:50
Done.
| |
| 149 WIDGET, | |
| 150 }; | |
| 151 | |
| 152 // Selects dispatch method. Currently only supported on Mac. | |
| 153 void set_target(Target target) { | |
| 154 target_ = target; | |
| 145 } | 155 } |
| 146 bool targeting_application() const { return targeting_application_; } | 156 Target target() const { return target_; } |
| 147 | 157 |
| 148 // Resets the event flags bitmask. | 158 // Resets the event flags bitmask. |
| 149 void set_flags(int flags) { flags_ = flags; } | 159 void set_flags(int flags) { flags_ = flags; } |
| 150 int flags() const { return flags_; } | 160 int flags() const { return flags_; } |
| 151 | 161 |
| 152 // Generates a left button press event. | 162 // Generates a left button press event. |
| 153 void PressLeftButton(); | 163 void PressLeftButton(); |
| 154 | 164 |
| 155 // Generates a left button release event. | 165 // Generates a left button release event. |
| 156 void ReleaseLeftButton(); | 166 void ReleaseLeftButton(); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 | 408 |
| 399 std::unique_ptr<EventGeneratorDelegate> delegate_; | 409 std::unique_ptr<EventGeneratorDelegate> delegate_; |
| 400 gfx::Point current_location_; | 410 gfx::Point current_location_; |
| 401 EventTarget* current_target_; | 411 EventTarget* current_target_; |
| 402 int flags_; | 412 int flags_; |
| 403 bool grab_; | 413 bool grab_; |
| 404 bool pen_pointer_mode_ = false; | 414 bool pen_pointer_mode_ = false; |
| 405 std::list<std::unique_ptr<Event>> pending_events_; | 415 std::list<std::unique_ptr<Event>> pending_events_; |
| 406 // Set to true to cause events to be posted asynchronously. | 416 // Set to true to cause events to be posted asynchronously. |
| 407 bool async_; | 417 bool async_; |
| 408 bool targeting_application_; | 418 Target target_; |
| 409 std::unique_ptr<base::TickClock> tick_clock_; | 419 std::unique_ptr<base::TickClock> tick_clock_; |
| 410 | 420 |
| 411 DISALLOW_COPY_AND_ASSIGN(EventGenerator); | 421 DISALLOW_COPY_AND_ASSIGN(EventGenerator); |
| 412 }; | 422 }; |
| 413 | 423 |
| 414 } // namespace test | 424 } // namespace test |
| 415 } // namespace ui | 425 } // namespace ui |
| 416 | 426 |
| 417 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ | 427 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ |
| OLD | NEW |