Chromium Code Reviews| Index: chrome/browser/android/vr_shell/android_ui_gesture_target.h |
| diff --git a/chrome/browser/android/vr_shell/android_ui_gesture_target.h b/chrome/browser/android/vr_shell/android_ui_gesture_target.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a0981a90f45eb277de3148aea2ffe3017733b682 |
| --- /dev/null |
| +++ b/chrome/browser/android/vr_shell/android_ui_gesture_target.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_ANDROID_UI_GESTURE_TARGET_H_ |
| +#define CHROME_BROWSER_ANDROID_VR_SHELL_ANDROID_UI_GESTURE_TARGET_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/android/jni_android.h" |
| +#include "base/macros.h" |
| +#include "base/time/time.h" |
| +#include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| +#include "third_party/WebKit/public/platform/WebInputEvent.h" |
| +#include "third_party/WebKit/public/platform/WebMouseEvent.h" |
| + |
| +namespace vr_shell { |
| + |
| +class AndroidUiGestureTarget { |
| + public: |
| + AndroidUiGestureTarget(jobject event_synthesizer, float dpr_ratio); |
| + ~AndroidUiGestureTarget(); |
| + |
| + void DispatchWebInputEvent(std::unique_ptr<blink::WebInputEvent> event); |
| + |
| + private: |
| + // Enum values below need to be kept in sync with MotionEventSynthesizer.java. |
| + enum Action { |
| + ActionInvalid = -1, |
|
cjgrant
2017/02/16 15:29:34
What about losing the Action prefix on these? vr_
mthiesse
2017/02/16 15:53:49
Done.
|
| + ActionStart = 0, |
| + ActionMove = 1, |
| + ActionCancel = 2, |
| + ActionEnd = 3, |
| + ActionScroll = 4, |
| + ActionHoverEnter = 5, |
| + ActionHoverExit = 6, |
| + ActionHoverMove = 7, |
| + }; |
| + |
| + void SetPointer(JNIEnv* env, int x, int y); |
| + void SetScrollDeltas(JNIEnv* env, int x, int y, int dx, int dy); |
| + void Inject(JNIEnv* env, Action action, double time_in_seconds); |
| + |
| + jobject event_synthesizer_; |
| + int scroll_x_ = 0; |
| + int scroll_y_ = 0; |
| + float scroll_ratio_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AndroidUiGestureTarget); |
| +}; |
| + |
| +} // namespace vr_shell |
| + |
| +#endif // CHROME_BROWSER_ANDROID_VR_SHELL_ANDROID_UI_GESTURE_TARGET_H_ |