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

Side by Side Diff: ui/android/java/src/org/chromium/ui/ViewAndroid.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: Remove space + useless comment 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) 2013 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.ViewAndroidDelegate;
9 import org.chromium.ui.WindowAndroid;
10
11 /**
12 * From the Chromium architecture point of view, ViewAndroid and its native coun terpart
13 * serve purpose of representing Android view where Chrome expects to have a cro ss platform
14 * handle to the system view type. As Views are Java object on Android, this Vie wAndroid
15 * and its native counterpart provide the expected abstractions on the C++ side and allow
16 * it to be flexibly glued to an actual Android Java View at runtime.
17 *
18 * It should only be used where access to Android Views is needed from the C++ c ode.
19 */
20 @JNINamespace("ui")
21 public class ViewAndroid {
22 // Native pointer to the c++ ViewAndroid object.
23 private int mNativeViewAndroid = 0;
24 private final WindowAndroid mNativeWindow;
nilesh 2013/04/19 20:52:30 mWindowAndroid
aurimas (slooooooooow) 2013/04/19 21:32:04 Done.
25 private final ViewAndroidDelegate mViewAndroidDelegate;
26
27 /**
28 * Constructs a View object.
29 */
30 public ViewAndroid(WindowAndroid nativeWindow, ViewAndroidDelegate viewAndro idDelegate) {
31 mNativeWindow = nativeWindow;
32 mViewAndroidDelegate = viewAndroidDelegate;
33 mNativeViewAndroid = nativeInit(mNativeWindow.getNativePointer());
34 }
35
36 public ViewAndroidDelegate getViewAndroidDelegate() {
37 return mViewAndroidDelegate;
38 }
39
40 /**
41 * Destroys the c++ ViewAndroid object if one has been created.
42 */
43 public void destroy() {
44 if (mNativeViewAndroid != 0) {
45 nativeDestroy(mNativeViewAndroid);
46 mNativeViewAndroid = 0;
47 }
48 }
49
50 /**
51 * Returns a pointer to the c++ AndroidWindow object.
52 * @return A pointer to the c++ AndroidWindow.
53 */
54 public int getNativePointer() {
55 return mNativeViewAndroid;
56 }
57
58 private native int nativeInit(int windowPtr);
59 private native void nativeDestroy(int nativeViewAndroid);
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698