Index: ui/android/java/src/org/chromium/ui/NativeView.java |
diff --git a/ui/android/java/src/org/chromium/ui/NativeView.java b/ui/android/java/src/org/chromium/ui/NativeView.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..13ff45c8deef01c0c4ff1d806fe3843f076f313c |
--- /dev/null |
+++ b/ui/android/java/src/org/chromium/ui/NativeView.java |
@@ -0,0 +1,55 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
joth
2013/04/12 19:00:48
2012 is over (multiple places)
nilesh
2013/04/12 19:07:10
2013
aurimas (slooooooooow)
2013/04/12 22:00:41
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.ui; |
+ |
+import org.chromium.base.JNINamespace; |
+import org.chromium.ui.ContainerViewDelegate; |
+import org.chromium.ui.gfx.NativeWindow; |
+ |
+/** |
+ * NativeView class that is used to access the the ContainterViewDelegate. It should only be |
+ * used to attach decorations like Autofill popup. |
joth
2013/04/12 19:00:48
maybe useful to also document this guys purpose fr
aurimas (slooooooooow)
2013/04/12 22:00:41
Done.
|
+ */ |
+@JNINamespace("ui") |
+public class NativeView { |
+ // Native pointer to the c++ ViewAndroid object. |
+ private int mNativeViewAndroid = 0; |
+ private final NativeWindow mNativeWindow; |
+ public final ContainerViewDelegate mContainerViewDelegate; |
nilesh
2013/04/12 19:07:10
make it private final and add a getter if needed.
aurimas (slooooooooow)
2013/04/12 22:00:41
Done.
|
+ |
+ /** |
+ * Constructs a View object. |
+ */ |
+ public NativeView(NativeWindow nativeWindow, ContainerViewDelegate containerViewDelegate) { |
+ mNativeViewAndroid = 0; |
+ mNativeWindow = nativeWindow; |
+ mContainerViewDelegate = containerViewDelegate; |
+ } |
+ |
+ /** |
+ * Destroys the c++ ViewAndroid object if one has been created. |
+ */ |
+ public void destroy() { |
joth
2013/04/12 19:00:48
in webview we need to allow ContentViewCore to cle
aurimas (slooooooooow)
2013/04/12 22:00:41
So I was hoping that ContentViewCore.java is the o
joth
2013/04/16 04:02:42
It's all an illusion.
ContentViewCore.destroy() wi
|
+ if (mNativeViewAndroid != 0) { |
+ nativeDestroy(mNativeViewAndroid); |
+ mNativeViewAndroid = 0; |
+ } |
+ } |
+ |
+ /** |
+ * Returns a pointer to the c++ AndroidWindow object and calls the initializer if |
+ * the object has not been previously initialized. |
+ * @return A pointer to the c++ AndroidWindow. |
+ */ |
+ public int getNativePointer() { |
+ if (mNativeViewAndroid == 0) { |
+ mNativeViewAndroid = nativeInit(mNativeWindow.getNativePointer()); |
+ } |
+ return mNativeViewAndroid; |
+ } |
+ |
+ private native int nativeInit(int windowPtr); |
+ private native void nativeDestroy(int nativeViewAndroid); |
+} |