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

Unified Diff: chrome/browser/android/vr_shell/android_ui_gesture_target.h

Issue 2694103006: Inject vr controller events into Android Native UI. (Closed)
Patch Set: Fix presubmit Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
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..396a96322e68bf6f0bdbfd4698dfe9be3f27d483
--- /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 {
+ Invalid = -1,
+ Start = 0,
+ Move = 1,
+ Cancel = 2,
+ End = 3,
+ Scroll = 4,
+ HoverEnter = 5,
+ HoverExit = 6,
+ HoverMove = 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_
« no previous file with comments | « chrome/browser/android/vr_shell/PRESUBMIT.py ('k') | chrome/browser/android/vr_shell/android_ui_gesture_target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698