New issue
Advanced search Search tips

Issue 736704 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Public interface for MotionEventSynthesizer

Project Member Reported by jinsuk...@chromium.org, Jun 26 2017

Issue description

A thought that MotionEventSynthesizer can be refactored into a better (or I would say more intuitive?) form dawned on me while trying to remove its dependency on ContentViewCore. 

What caught my attention is that we don't have a proper interface for it even though there is an embedder that uses it (VrShell for non-native page). Java object (which is an implementation detail) is exposed directly to embedder. It is used by native, but is created in Java layer and passed as an Java object.  That makes the way native side (AndroidUiTarget/SyntheticGestureTarget) uses it a bit odd. i.e. callsites have to use JNI interface directly i.e. Java_MotionEventSynthesizer_setPointer(), etc.

I think this can be improved by following changes:

- Introduce a public interface on native side (content/public/browser/[android/] motion_event_synthesizer.h with a static factory method) so that the object can be created entirely on native side, and keep the rest (the Java and native impl class) implementation details. Maybe possible to move out to ui/.

- It is dependent on CVC/VrShell java layer to be able to access WindowAndroid (eventually to get the right scale factor). Native can handle it better by translating the coordinate to device-dependent physical pixel unit right before passing relevant parameters to Java layer. This helps eliminate the dependency, therefore will allow for the instantiation in the native side.

Any inputs are welcome.
 

Comment 1 by boliu@chromium.org, Jun 26 2017

yeah that sounds fine

vr is doing things even *more* wrong the typical chrome code by including content jni header file. the generated jni header files not meant to be included by more than one file. I'm kind of surprised it even compiles..
Project Member

Comment 2 by bugdroid1@chromium.org, Aug 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9604d8b285ec422d4ba9d66f3f8446ccc4deb521

commit 9604d8b285ec422d4ba9d66f3f8446ccc4deb521
Author: Jinsuk Kim <jinsukkim@chromium.org>
Date: Mon Aug 07 02:47:30 2017

Define public interface for MotionEventSynthesizer

MotionEventSynthesizer didn't have a proper public interface.
This CL provides one with a method |Create| for embedders to use.
Also defines action enum for both Java/native to share.

BUG= 626765 , 736704 

Change-Id: I1c4c14b3fe82314537ea75b2ac32311dc247d07c
Reviewed-on: https://chromium-review.googlesource.com/539457
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492260}
[add] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/AndroidUiGestureTarget.java
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/android/java_sources.gni
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/browser/android/vr_shell/BUILD.gn
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/browser/android/vr_shell/android_ui_gesture_target.cc
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/browser/android/vr_shell/android_ui_gesture_target.h
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/browser/android/vr_shell/vr_shell.cc
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/chrome/browser/android/vr_shell/vr_shell.h
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/browser/android/content_view_core.cc
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/browser/android/content_view_core.h
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/browser/renderer_host/input/synthetic_gesture_target_android.cc
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/browser/renderer_host/input/synthetic_gesture_target_android.h
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/browser/renderer_host/render_widget_host_view_android.cc
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/public/android/BUILD.gn
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/public/android/java/src/org/chromium/content/browser/MotionEventSynthesizer.java
[add] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/public/android/java/src/org/chromium/content/browser/SyntheticGestureTarget.java
[modify] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/public/browser/BUILD.gn
[add] https://crrev.com/9604d8b285ec422d4ba9d66f3f8446ccc4deb521/content/public/browser/android/motion_event_action.h

Status: Fixed (was: Assigned)

Sign in to add a comment