Chromium Code Reviews| 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..e908d464792cbda6b42bc967d80033f16a5f7fbf |
| --- /dev/null |
| +++ b/ui/android/java/src/org/chromium/ui/base/EventHandler.java |
| @@ -0,0 +1,40 @@ |
| +// 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 { |
|
Ted C
2016/12/15 23:36:44
from the discussion yesterday, I think EventDispta
Jinsuk Kim
2016/12/16 02:04:17
Thanks for the discussion for better naming. Done.
|
| + // The corresponding native ViewAndroid. This object can only be used while |
| + // the native instance is alive. |
| + private long mNativeView; |
| + |
| + @CalledByNative |
| + private static EventHandler create(long nativeView) { |
| + return new EventHandler(nativeView); |
| + } |
| + |
| + private EventHandler(long nativeView) { |
| + mNativeView = nativeView; |
| + } |
| + |
| + public void onPhysicalBackingSizeChanged(int width, int height) { |
|
Ted C
2016/12/15 23:36:44
can you add javadoc here...physical backing size i
Jinsuk Kim
2016/12/16 02:04:17
Done.
|
| + assert mNativeView != 0; |
| + nativeOnPhysicalBackingSizeChanged(mNativeView, width, height); |
| + } |
| + |
| + @CalledByNative |
| + private void onDestroyNativeView() { |
| + mNativeView = 0; |
| + } |
| + |
| + private static native void nativeOnPhysicalBackingSizeChanged(long viewAndroid, |
| + int width, int height); |
| +} |