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

Unified Diff: ui/android/java/src/org/chromium/ui/base/EventHandler.java

Issue 2502763003: Introduce ViewRoot to forward input/view events to native (Closed)
Patch Set: addressed comments Created 4 years 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: ui/android/java/src/org/chromium/ui/base/EventHandler.java
diff --git a/ui/android/java/src/org/chromium/ui/base/EventHandler.java b/ui/android/java/src/org/chromium/ui/base/EventHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..0a6376cad768c3673fb8aba89a3472cdde1b45e8
--- /dev/null
+++ b/ui/android/java/src/org/chromium/ui/base/EventHandler.java
@@ -0,0 +1,35 @@
+// Copyright 2016 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.
+
+package org.chromium.ui.base;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+
+/**
+ * Class used to forward view, input events down to native.
+ */
+@JNINamespace("ui")
+public class EventHandler {
+ // The corresponding native ViewAndroid. This object can only be used while
+ // the native instance is alive.
+ private long mNativeView;
+
+ public EventHandler(long nativeView) {
boliu 2016/12/08 05:01:06 hide the constructor so that only ui code can crea
Jinsuk Kim 2016/12/13 23:20:38 Done.
+ mNativeView = nativeView;
+ }
+
+ public void onPhysicalBackingSizeChanged(int width, int height) {
+ assert mNativeView != 0;
+ nativeOnPhysicalBackingSizeChanged(mNativeView, width, height);
+ }
+
+ @CalledByNative
+ private void onDestroyNativeView() {
+ mNativeView = 0;
+ }
+
+ private static native void nativeOnPhysicalBackingSizeChanged(long viewAndroid,
+ int width, int height);
+}

Powered by Google App Engine
This is Rietveld 408576698