| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_ANDROID_UI_GESTURE_TARGET_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_ANDROID_UI_GESTURE_TARGET_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/android/jni_android.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" |
| 13 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| 14 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 15 #include "third_party/WebKit/public/platform/WebMouseEvent.h" |
| 16 |
| 17 namespace vr_shell { |
| 18 |
| 19 class AndroidUiGestureTarget { |
| 20 public: |
| 21 AndroidUiGestureTarget(jobject event_synthesizer, float dpr_ratio); |
| 22 ~AndroidUiGestureTarget(); |
| 23 |
| 24 void DispatchWebInputEvent(std::unique_ptr<blink::WebInputEvent> event); |
| 25 |
| 26 private: |
| 27 // Enum values below need to be kept in sync with MotionEventSynthesizer.java. |
| 28 enum Action { |
| 29 Invalid = -1, |
| 30 Start = 0, |
| 31 Move = 1, |
| 32 Cancel = 2, |
| 33 End = 3, |
| 34 Scroll = 4, |
| 35 HoverEnter = 5, |
| 36 HoverExit = 6, |
| 37 HoverMove = 7, |
| 38 }; |
| 39 |
| 40 void SetPointer(JNIEnv* env, int x, int y); |
| 41 void SetScrollDeltas(JNIEnv* env, int x, int y, int dx, int dy); |
| 42 void Inject(JNIEnv* env, Action action, double time_in_seconds); |
| 43 |
| 44 jobject event_synthesizer_; |
| 45 int scroll_x_ = 0; |
| 46 int scroll_y_ = 0; |
| 47 float scroll_ratio_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(AndroidUiGestureTarget); |
| 50 }; |
| 51 |
| 52 } // namespace vr_shell |
| 53 |
| 54 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_ANDROID_UI_GESTURE_TARGET_H_ |
| OLD | NEW |