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

Side by Side Diff: ui/android/view_android.cc

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 #include "view_android.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_helper.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "jni/NativeView_jni.h"
11 #include "ui/gfx/android/window_android.h"
12
13 namespace ui {
14
15 using base::android::AttachCurrentThread;
16 using base::android::ScopedJavaLocalRef;
17
18 ViewAndroid::ViewAndroid(JNIEnv* env, jobject obj, WindowAndroid* window)
19 : weak_java_view_(env, obj),
20 window_android_(window)
21 {
22 }
23
24 void ViewAndroid::Destroy(JNIEnv* env, jobject obj) {
25 delete this;
26 }
27
28 ScopedJavaLocalRef<jobject> ViewAndroid::GetJavaObject() {
29 JNIEnv* env = AttachCurrentThread();
30 return weak_java_view_.get(env);
31 }
32
33 WindowAndroid* ViewAndroid::GetWindowAndroid() {
34 return window_android_;
35 }
36
37 bool ViewAndroid::RegisterViewAndroid(JNIEnv* env) {
38 return RegisterNativesImpl(env);
39 }
40
41 ViewAndroid::~ViewAndroid() {
42 }
43
44 // ----------------------------------------------------------------------------
45 // Native JNI methods
46 // ----------------------------------------------------------------------------
47
48 jint Init(JNIEnv* env, jobject obj, jint window) {
49 ViewAndroid* view = new ViewAndroid(
50 env, obj, reinterpret_cast<ui::WindowAndroid*>(window));
51 return reinterpret_cast<jint>(view);
52 }
53
54 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698