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

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_controller.h

Issue 2336803003: Make SyntheticPointerAction to flush the pointer action sequence (Closed)
Patch Set: controller Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
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/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "content/browser/renderer_host/input/synthetic_gesture.h" 16 #include "content/browser/renderer_host/input/synthetic_gesture.h"
17 #include "content/browser/renderer_host/input/synthetic_pointer_action_controlle r.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "content/common/input/synthetic_gesture_params.h" 19 #include "content/common/input/synthetic_gesture_params.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 class SyntheticGestureTarget; 23 class SyntheticGestureTarget;
23 24
24 // Controls a synthetic gesture. 25 // Controls a synthetic gesture.
25 // Repeatedly invokes the gesture object's ForwardInputEvent method to send 26 // Repeatedly invokes the gesture object's ForwardInputEvent method to send
26 // input events to the platform until the gesture has finished. 27 // input events to the platform until the gesture has finished.
27 class CONTENT_EXPORT SyntheticGestureController { 28 class CONTENT_EXPORT SyntheticGestureController {
28 public: 29 public:
29 explicit SyntheticGestureController( 30 explicit SyntheticGestureController(
30 std::unique_ptr<SyntheticGestureTarget> gesture_target); 31 std::unique_ptr<SyntheticGestureTarget> gesture_target);
31 virtual ~SyntheticGestureController(); 32 virtual ~SyntheticGestureController();
32 33
33 typedef base::Callback<void(SyntheticGesture::Result)> 34 typedef base::Callback<void(SyntheticGesture::Result)>
34 OnGestureCompleteCallback; 35 OnGestureCompleteCallback;
35 void QueueSyntheticGesture( 36 void QueueSyntheticGesture(
36 std::unique_ptr<SyntheticGesture> synthetic_gesture, 37 std::unique_ptr<SyntheticGesture> synthetic_gesture,
37 const OnGestureCompleteCallback& completion_callback); 38 const OnGestureCompleteCallback& completion_callback);
38 39
39 // Forward input events of the currently processed gesture. 40 // Forward input events of the currently processed gesture.
40 void Flush(base::TimeTicks timestamp); 41 void Flush(base::TimeTicks timestamp);
41 42
42 // To be called when all events generated from the current gesture have been 43 // To be called when all events generated from the current gesture have been
43 // fully flushed from the input pipeline (i.e., sent, processed and ack'ed). 44 // fully flushed from the input pipeline (i.e., sent, processed and ack'ed).
44 void OnDidFlushInput(); 45 void OnDidFlushInput();
45 46
47 std::unique_ptr<SyntheticGesture> CreateSyntheticPointerAction(
48 const SyntheticPointerActionListParams& gesture_params);
49
46 private: 50 private:
47 void StartGesture(const SyntheticGesture& gesture); 51 void StartGesture(const SyntheticGesture& gesture);
48 void StopGesture(const SyntheticGesture& gesture, 52 void StopGesture(const SyntheticGesture& gesture,
49 const OnGestureCompleteCallback& completion_callback, 53 const OnGestureCompleteCallback& completion_callback,
50 SyntheticGesture::Result result); 54 SyntheticGesture::Result result);
51 55
52 std::unique_ptr<SyntheticGestureTarget> gesture_target_; 56 std::unique_ptr<SyntheticGestureTarget> gesture_target_;
53 std::unique_ptr<SyntheticGesture::Result> pending_gesture_result_; 57 std::unique_ptr<SyntheticGesture::Result> pending_gesture_result_;
58 SyntheticPointerActionController pointer_action_controller_;
54 59
55 // A queue of gesture/callback pairs. Implemented as two queues to 60 // A queue of gesture/callback pairs. Implemented as two queues to
56 // simplify the ownership of SyntheticGesture pointers. 61 // simplify the ownership of SyntheticGesture pointers.
57 class GestureAndCallbackQueue { 62 class GestureAndCallbackQueue {
58 public: 63 public:
59 GestureAndCallbackQueue(); 64 GestureAndCallbackQueue();
60 ~GestureAndCallbackQueue(); 65 ~GestureAndCallbackQueue();
61 void Push(std::unique_ptr<SyntheticGesture> gesture, 66 void Push(std::unique_ptr<SyntheticGesture> gesture,
62 const OnGestureCompleteCallback& callback) { 67 const OnGestureCompleteCallback& callback) {
63 gestures_.push_back(std::move(gesture)); 68 gestures_.push_back(std::move(gesture));
(...skipping 17 matching lines...) Expand all
81 ScopedVector<SyntheticGesture> gestures_; 86 ScopedVector<SyntheticGesture> gestures_;
82 std::queue<OnGestureCompleteCallback> callbacks_; 87 std::queue<OnGestureCompleteCallback> callbacks_;
83 } pending_gesture_queue_; 88 } pending_gesture_queue_;
84 89
85 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); 90 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController);
86 }; 91 };
87 92
88 } // namespace content 93 } // namespace content
89 94
90 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ 95 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698