Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_POINTER_ACTION_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ |
| 7 | 7 |
| 8 #include <array> | |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 11 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 11 #include "content/browser/renderer_host/input/synthetic_pointer.h" | 12 #include "content/browser/renderer_host/input/synthetic_pointer.h" |
| 12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 13 #include "content/common/input/synthetic_pointer_action_params.h" | 14 #include "content/common/input/synthetic_pointer_action_params.h" |
| 14 | 15 |
| 16 using blink::WebTouchEvent; | |
| 17 | |
| 15 namespace content { | 18 namespace content { |
| 16 | 19 |
| 17 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture { | 20 class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture { |
| 18 public: | 21 public: |
| 22 using IndexMap = std::array<int, WebTouchEvent::touchesLengthCap>; | |
| 23 | |
| 19 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params); | 24 explicit SyntheticPointerAction(const SyntheticPointerActionParams& params); |
| 20 SyntheticPointerAction(const SyntheticPointerActionParams& params, | 25 SyntheticPointerAction( |
| 21 SyntheticPointer* synthetic_pointer); | 26 std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list, |
| 27 SyntheticPointer* synthetic_pointer, | |
| 28 IndexMap* index_map); | |
| 22 ~SyntheticPointerAction() override; | 29 ~SyntheticPointerAction() override; |
| 23 | 30 |
| 24 SyntheticGesture::Result ForwardInputEvents( | 31 SyntheticGesture::Result ForwardInputEvents( |
| 25 const base::TimeTicks& timestamp, | 32 const base::TimeTicks& timestamp, |
| 26 SyntheticGestureTarget* target) override; | 33 SyntheticGestureTarget* target) override; |
| 27 | 34 |
| 28 void ForwardTouchOrMouseInputEvents(const base::TimeTicks& timestamp, | 35 SyntheticGesture::Result ForwardTouchOrMouseInputEvents( |
| 29 SyntheticGestureTarget* target); | 36 const base::TimeTicks& timestamp, |
| 37 SyntheticGestureTarget* target); | |
| 38 | |
| 39 void SetSyntheticPointer(SyntheticPointer* synthetic_pointer) { | |
| 40 synthetic_pointer_ = synthetic_pointer; | |
| 41 } | |
| 42 | |
| 43 int GetPointIndex(int index) const; | |
| 44 | |
| 45 void SetPointIndex(int index, int point_index) { | |
| 46 (*index_map_)[index] = point_index; | |
| 47 } | |
| 30 | 48 |
| 31 private: | 49 private: |
| 50 // This is passed from SyntheticPointerActionController, which will reset its | |
| 51 // value to push a new patch of action parameters. | |
|
tdresser
2016/05/31 13:44:26
patch -> batch
lanwei
2016/06/02 13:26:26
Done.
| |
| 52 // This contains a list of pointer actions which will be dispatched together. | |
| 53 const std::unique_ptr<std::vector<SyntheticPointerActionParams>> param_list_; | |
| 54 // These two objects are owned by SyntheticPointerActionController, which | |
| 55 // will manage their lifetime by initiating them when it starts processing a | |
| 56 // pointer action sequence and resets them when it finishes. | |
|
tdresser
2016/05/31 13:44:26
resets -> resetting
lanwei
2016/06/02 13:26:27
Done.
| |
| 57 SyntheticPointer* synthetic_pointer_; | |
| 58 IndexMap* index_map_; | |
| 59 | |
| 32 SyntheticPointerActionParams params_; | 60 SyntheticPointerActionParams params_; |
| 33 SyntheticPointer* synthetic_pointer_; | |
| 34 | 61 |
| 35 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction); | 62 DISALLOW_COPY_AND_ASSIGN(SyntheticPointerAction); |
| 36 }; | 63 }; |
| 37 | 64 |
| 38 } // namespace content | 65 } // namespace content |
| 39 | 66 |
| 40 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ | 67 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_POINTER_ACTION_H_ |
| OLD | NEW |