Chromium Code Reviews| Index: ui/android/java/src/org/chromium/ui/base/ViewRoot.java |
| diff --git a/ui/android/java/src/org/chromium/ui/base/ViewRoot.java b/ui/android/java/src/org/chromium/ui/base/ViewRoot.java |
| index c224e8e3ed8c9cdfd31b3ed2e783e090ea42a4e7..4697b199b231314c57b28d6cc3d187dd56b131b0 100644 |
| --- a/ui/android/java/src/org/chromium/ui/base/ViewRoot.java |
| +++ b/ui/android/java/src/org/chromium/ui/base/ViewRoot.java |
| @@ -9,10 +9,6 @@ import org.chromium.base.annotations.JNINamespace; |
| /** |
| * Class used to forward view, input events down to native. |
| - * |
| - * TODO(jinsukkim): Add its native counterpart inheriting from ViewAndroid |
| - * so that it will act as a root of ViewAndroid tree. It effectively |
| - * replaces WindowAndroid in terms of the role. |
| */ |
| @JNINamespace("ui") |
| public class ViewRoot { |
| @@ -20,13 +16,12 @@ public class ViewRoot { |
| // the native instance is alive. |
| private long mNativeView; |
| - @CalledByNative |
| - private static ViewRoot create(long nativeView) { |
| - return new ViewRoot(nativeView); |
| + public static ViewRoot create(WindowAndroid window) { |
|
boliu
2017/01/04 18:58:06
return null if window is null? or could throw an e
Jinsuk Kim
2017/01/05 11:03:12
Done. Chose to throw an exception.
|
| + return new ViewRoot(window); |
| } |
| - private ViewRoot(long nativeView) { |
| - mNativeView = nativeView; |
| + private ViewRoot(WindowAndroid window) { |
| + mNativeView = nativeInit(window == null ? 0 : window.getNativePointer()); |
| } |
| /** |
| @@ -41,10 +36,16 @@ public class ViewRoot { |
| } |
| @CalledByNative |
| + private long getNativePtr() { |
| + return mNativeView; |
| + } |
| + |
| + @CalledByNative |
| private void onDestroyNativeView() { |
| mNativeView = 0; |
| } |
| - private static native void nativeOnPhysicalBackingSizeChanged(long viewAndroid, |
| + private native long nativeInit(long windowNativePointer); |
| + private native void nativeOnPhysicalBackingSizeChanged(long nativeViewRoot, |
| int width, int height); |
| } |