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

Side by Side Diff: ui/android/java/src/org/chromium/ui/NativeView.java

Issue 14018004: [Android] Refactor NativeView to be able to use it for AutofillDialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
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 * TODO: Insert description here. (generated by aurimas)
13 */
14 @JNINamespace("ui")
15 public class NativeView {
16 // Native pointer to the c++ ViewAndroid object.
17 private int mNativeViewAndroid = 0;
18 private final NativeWindow mNativeWindow;
19 public final ContainerViewDelegate mContainerViewDelegate;
20
21 /**
22 * Constructs a View object.
23 */
24 public NativeView(NativeWindow nativeWindow, ContainerViewDelegate container ViewDelegate) {
25 mNativeViewAndroid = 0;
26 mNativeWindow = nativeWindow;
27 mContainerViewDelegate = containerViewDelegate;
28 }
29
30 /**
31 * Destroys the c++ ViewAndroid object if one has been created.
32 */
33 public void destroy() {
34 if (mNativeViewAndroid != 0) {
35 nativeDestroy(mNativeViewAndroid);
36 mNativeViewAndroid = 0;
37 }
38 }
39
40 /**
41 * Returns a pointer to the c++ AndroidWindow object and calls the initializ er if
42 * the object has not been previously initialized.
43 * @return A pointer to the c++ AndroidWindow.
44 */
45 public int getNativePointer() {
46 if (mNativeViewAndroid == 0) {
47 mNativeViewAndroid = nativeInit(mNativeWindow.getNativePointer());
48 }
49 return mNativeViewAndroid;
50 }
51
52 private native int nativeInit(int windowPtr);
53 private native void nativeDestroy(int nativeViewAndroid);
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698