Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.ui; | |
| 6 | |
| 7 import org.chromium.base.JNINamespace; | |
| 8 import org.chromium.ui.ContainerViewDelegate; | |
| 9 import org.chromium.ui.gfx.NativeWindow; | |
| 10 | |
| 11 /** | |
| 12 * NativeView class that is used to access the the ContainterViewDelegate. It sh ould only be | |
| 13 * 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.
| |
| 14 */ | |
| 15 @JNINamespace("ui") | |
| 16 public class NativeView { | |
| 17 // Native pointer to the c++ ViewAndroid object. | |
| 18 private int mNativeViewAndroid = 0; | |
| 19 private final NativeWindow mNativeWindow; | |
| 20 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.
| |
| 21 | |
| 22 /** | |
| 23 * Constructs a View object. | |
| 24 */ | |
| 25 public NativeView(NativeWindow nativeWindow, ContainerViewDelegate container ViewDelegate) { | |
| 26 mNativeViewAndroid = 0; | |
| 27 mNativeWindow = nativeWindow; | |
| 28 mContainerViewDelegate = containerViewDelegate; | |
| 29 } | |
| 30 | |
| 31 /** | |
| 32 * Destroys the c++ ViewAndroid object if one has been created. | |
| 33 */ | |
| 34 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
| |
| 35 if (mNativeViewAndroid != 0) { | |
| 36 nativeDestroy(mNativeViewAndroid); | |
| 37 mNativeViewAndroid = 0; | |
| 38 } | |
| 39 } | |
| 40 | |
| 41 /** | |
| 42 * Returns a pointer to the c++ AndroidWindow object and calls the initializ er if | |
| 43 * the object has not been previously initialized. | |
| 44 * @return A pointer to the c++ AndroidWindow. | |
| 45 */ | |
| 46 public int getNativePointer() { | |
| 47 if (mNativeViewAndroid == 0) { | |
| 48 mNativeViewAndroid = nativeInit(mNativeWindow.getNativePointer()); | |
| 49 } | |
| 50 return mNativeViewAndroid; | |
| 51 } | |
| 52 | |
| 53 private native int nativeInit(int windowPtr); | |
| 54 private native void nativeDestroy(int nativeViewAndroid); | |
| 55 } | |
| OLD | NEW |