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

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

Issue 1884883005: Prepare SyntheticPointerAction to handle touch actions for multiple fingers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make a new class SyntheticPointerActionController Created 4 years, 7 months 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"
20 #include "content/common/input/synthetic_pointer_action_params.h"
19 21
20 namespace content { 22 namespace content {
21 23
22 class SyntheticGestureTarget; 24 class SyntheticGestureTarget;
23 25
24 // Controls a synthetic gesture. 26 // Controls a synthetic gesture.
25 // Repeatedly invokes the gesture object's ForwardInputEvent method to send 27 // Repeatedly invokes the gesture object's ForwardInputEvent method to send
26 // input events to the platform until the gesture has finished. 28 // input events to the platform until the gesture has finished.
27 class CONTENT_EXPORT SyntheticGestureController { 29 class CONTENT_EXPORT SyntheticGestureController {
28 public: 30 public:
29 explicit SyntheticGestureController( 31 explicit SyntheticGestureController(
30 std::unique_ptr<SyntheticGestureTarget> gesture_target); 32 std::unique_ptr<SyntheticGestureTarget> gesture_target);
31 virtual ~SyntheticGestureController(); 33 virtual ~SyntheticGestureController();
32 34
33 typedef base::Callback<void(SyntheticGesture::Result)> 35 typedef base::Callback<void(SyntheticGesture::Result)>
34 OnGestureCompleteCallback; 36 OnGestureCompleteCallback;
35 void QueueSyntheticGesture( 37 void QueueSyntheticGesture(
36 std::unique_ptr<SyntheticGesture> synthetic_gesture, 38 std::unique_ptr<SyntheticGesture> synthetic_gesture,
37 const OnGestureCompleteCallback& completion_callback); 39 const OnGestureCompleteCallback& completion_callback);
38 40
41 void QueueSyntheticPointerAction(
42 const SyntheticPointerActionParams& gesture_params,
43 const OnGestureCompleteCallback& completion_callback);
44
39 // Forward input events of the currently processed gesture. 45 // Forward input events of the currently processed gesture.
40 void Flush(base::TimeTicks timestamp); 46 void Flush(base::TimeTicks timestamp);
41 47
42 // To be called when all events generated from the current gesture have been 48 // 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). 49 // fully flushed from the input pipeline (i.e., sent, processed and ack'ed).
44 void OnDidFlushInput(); 50 void OnDidFlushInput();
45 51
52 void ResetSyntheticPointer();
53
46 private: 54 private:
55 friend class MockSyntheticGestureController;
56
47 void StartGesture(const SyntheticGesture& gesture); 57 void StartGesture(const SyntheticGesture& gesture);
48 void StopGesture(const SyntheticGesture& gesture, 58 void StopGesture(const SyntheticGesture& gesture,
49 const OnGestureCompleteCallback& completion_callback, 59 const OnGestureCompleteCallback& completion_callback,
50 SyntheticGesture::Result result); 60 SyntheticGesture::Result result);
51 61
52 std::unique_ptr<SyntheticGestureTarget> gesture_target_; 62 std::unique_ptr<SyntheticGestureTarget> gesture_target_;
53 std::unique_ptr<SyntheticGesture::Result> pending_gesture_result_; 63 std::unique_ptr<SyntheticGesture::Result> pending_gesture_result_;
64 SyntheticPointerActionController pointer_action_controller_;
54 65
55 // A queue of gesture/callback pairs. Implemented as two queues to 66 // A queue of gesture/callback pairs. Implemented as two queues to
56 // simplify the ownership of SyntheticGesture pointers. 67 // simplify the ownership of SyntheticGesture pointers.
57 class GestureAndCallbackQueue { 68 class GestureAndCallbackQueue {
58 public: 69 public:
59 GestureAndCallbackQueue(); 70 GestureAndCallbackQueue();
60 ~GestureAndCallbackQueue(); 71 ~GestureAndCallbackQueue();
61 void Push(std::unique_ptr<SyntheticGesture> gesture, 72 void Push(std::unique_ptr<SyntheticGesture> gesture,
62 const OnGestureCompleteCallback& callback) { 73 const OnGestureCompleteCallback& callback) {
63 gestures_.push_back(std::move(gesture)); 74 gestures_.push_back(std::move(gesture));
(...skipping 17 matching lines...) Expand all
81 ScopedVector<SyntheticGesture> gestures_; 92 ScopedVector<SyntheticGesture> gestures_;
82 std::queue<OnGestureCompleteCallback> callbacks_; 93 std::queue<OnGestureCompleteCallback> callbacks_;
83 } pending_gesture_queue_; 94 } pending_gesture_queue_;
84 95
85 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); 96 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController);
86 }; 97 };
87 98
88 } // namespace content 99 } // namespace content
89 100
90 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ 101 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698