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

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

Issue 2560633002: exo: Implement v6 of touch protocol including shape and frame event (Closed)
Patch Set: Fixed pen pointer mode conflict after rebase Created 4 years 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
« no previous file with comments | « components/exo/wayland/server.cc ('k') | ui/events/test/event_generator.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 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>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "ui/events/event_constants.h" 15 #include "ui/events/event.h"
16 #include "ui/events/keycodes/keyboard_codes.h" 16 #include "ui/events/keycodes/keyboard_codes.h"
17 #include "ui/gfx/geometry/point.h" 17 #include "ui/gfx/geometry/point.h"
18 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
19 19
20 namespace base { 20 namespace base {
21 class TickClock; 21 class TickClock;
22 } 22 }
23 23
24 namespace gfx { 24 namespace gfx {
25 class PointF; 25 class PointF;
26 } 26 }
27 27
28 namespace ui { 28 namespace ui {
29 class Event;
30 class EventSource; 29 class EventSource;
31 class EventTarget; 30 class EventTarget;
32 class KeyEvent;
33 31
34 namespace test { 32 namespace test {
35 33
36 typedef base::Callback<void(EventType, const gfx::Vector2dF&)> 34 typedef base::Callback<void(EventType, const gfx::Vector2dF&)>
37 ScrollStepCallback; 35 ScrollStepCallback;
38 36
39 class EventGenerator; 37 class EventGenerator;
40 38
41 // A delegate interface for EventGenerator to abstract platform-specific event 39 // A delegate interface for EventGenerator to abstract platform-specific event
42 // targeting and coordinate conversion. 40 // targeting and coordinate conversion.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 void MoveMouseToCenterOf(EventTarget* window); 229 void MoveMouseToCenterOf(EventTarget* window);
232 230
233 // Enter pen-pointer mode, which will cause any generated mouse events to have 231 // Enter pen-pointer mode, which will cause any generated mouse events to have
234 // a pointer type ui::EventPointerType::POINTER_TYPE_PEN. 232 // a pointer type ui::EventPointerType::POINTER_TYPE_PEN.
235 void EnterPenPointerMode(); 233 void EnterPenPointerMode();
236 234
237 // Exit pen-pointer mode. Generated mouse events will use the default pointer 235 // Exit pen-pointer mode. Generated mouse events will use the default pointer
238 // type event. 236 // type event.
239 void ExitPenPointerMode(); 237 void ExitPenPointerMode();
240 238
239 // Set radius of touch PointerDetails.
240 void SetTouchRadius(float x, float y);
241
241 // Generates a touch press event. 242 // Generates a touch press event.
242 void PressTouch(); 243 void PressTouch();
243 244
244 // Generates a touch press event with |touch_id|. 245 // Generates a touch press event with |touch_id|.
245 void PressTouchId(int touch_id); 246 void PressTouchId(int touch_id);
246 247
247 // Generates a ET_TOUCH_MOVED event to |point|. 248 // Generates a ET_TOUCH_MOVED event to |point|.
248 void MoveTouch(const gfx::Point& point); 249 void MoveTouch(const gfx::Point& point);
249 250
251 // Generates a ET_TOUCH_MOVED event moving by (x, y) from current location.
252 void MoveTouchBy(int x, int y) {
253 MoveTouch(current_location_ + gfx::Vector2d(x, y));
254 }
255
250 // Generates a ET_TOUCH_MOVED event to |point| with |touch_id|. 256 // Generates a ET_TOUCH_MOVED event to |point| with |touch_id|.
251 void MoveTouchId(const gfx::Point& point, int touch_id); 257 void MoveTouchId(const gfx::Point& point, int touch_id);
252 258
259 // Generates a ET_TOUCH_MOVED event moving (x, y) from current location with
260 // |touch_id|.
261 void MoveTouchIdBy(int touch_id, int x, int y) {
262 MoveTouchId(current_location_ + gfx::Vector2d(x, y), touch_id);
263 }
264
253 // Generates a touch release event. 265 // Generates a touch release event.
254 void ReleaseTouch(); 266 void ReleaseTouch();
255 267
256 // Generates a touch release event with |touch_id|. 268 // Generates a touch release event with |touch_id|.
257 void ReleaseTouchId(int touch_id); 269 void ReleaseTouchId(int touch_id);
258 270
259 // Generates press, move and release event to move touch 271 // Generates press, move and release event to move touch
260 // to be the given |point|. 272 // to be the given |point|.
261 void PressMoveAndReleaseTouchTo(const gfx::Point& point); 273 void PressMoveAndReleaseTouchTo(const gfx::Point& point);
262 274
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 void DoDispatchEvent(Event* event, bool async); 422 void DoDispatchEvent(Event* event, bool async);
411 423
412 const EventGeneratorDelegate* delegate() const; 424 const EventGeneratorDelegate* delegate() const;
413 EventGeneratorDelegate* delegate(); 425 EventGeneratorDelegate* delegate();
414 426
415 std::unique_ptr<EventGeneratorDelegate> delegate_; 427 std::unique_ptr<EventGeneratorDelegate> delegate_;
416 gfx::Point current_location_; 428 gfx::Point current_location_;
417 EventTarget* current_target_; 429 EventTarget* current_target_;
418 int flags_; 430 int flags_;
419 bool grab_; 431 bool grab_;
420 bool pen_pointer_mode_ = false; 432 ui::PointerDetails touch_pointer_details_;
433
421 std::list<std::unique_ptr<Event>> pending_events_; 434 std::list<std::unique_ptr<Event>> pending_events_;
422 // Set to true to cause events to be posted asynchronously. 435 // Set to true to cause events to be posted asynchronously.
423 bool async_; 436 bool async_;
424 Target target_; 437 Target target_;
425 std::unique_ptr<base::TickClock> tick_clock_; 438 std::unique_ptr<base::TickClock> tick_clock_;
426 439
427 DISALLOW_COPY_AND_ASSIGN(EventGenerator); 440 DISALLOW_COPY_AND_ASSIGN(EventGenerator);
428 }; 441 };
429 442
430 } // namespace test 443 } // namespace test
431 } // namespace ui 444 } // namespace ui
432 445
433 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_ 446 #endif // UI_EVENTS_TEST_EVENT_GENERATOR_H_
OLDNEW
« no previous file with comments | « components/exo/wayland/server.cc ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698