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

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: Ruslan's nits 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"
nilesh 2013/04/12 19:07:10 ui/android/vew_android.h Does this compile?
aurimas (slooooooooow) 2013/04/12 22:00:41 Done.
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 {
joth 2013/04/12 19:00:48 on prev line
nilesh 2013/04/12 19:07:10 {} on line 20
aurimas (slooooooooow) 2013/04/12 22:00:41 Done.
22 }
23
24 void ViewAndroid::Destroy(JNIEnv* env, jobject obj) {
25 // This object can only be destroyed by it's native counterpart.
joth 2013/04/12 19:00:48 this smells like a programming error and should be
nilesh 2013/04/12 19:07:10 which object?
aurimas (slooooooooow) 2013/04/12 22:00:41 Done.
26 if (env->IsSameObject(weak_java_view_.get(env).obj(), obj))
joth 2013/04/12 19:00:48 in the window between GC and finalization, this me
aurimas (slooooooooow) 2013/04/12 22:00:41 Should I check if obj is !null too?
joth 2013/04/16 04:02:42 you got it ( PS#5.)
27 delete this;
28 }
29
30 ScopedJavaLocalRef<jobject> ViewAndroid::GetJavaObject() {
31 JNIEnv* env = AttachCurrentThread();
nilesh 2013/04/12 19:07:10 no need of variable env
aurimas (slooooooooow) 2013/04/12 22:00:41 Done.
32 return weak_java_view_.get(env);
33 }
34
35 WindowAndroid* ViewAndroid::GetWindowAndroid() {
36 return window_android_;
37 }
38
39 bool ViewAndroid::RegisterViewAndroid(JNIEnv* env) {
40 return RegisterNativesImpl(env);
41 }
42
43 ViewAndroid::~ViewAndroid() {
44 }
45
46 // ----------------------------------------------------------------------------
47 // Native JNI methods
nilesh 2013/04/12 19:07:10 remove this comment block. I dont think it is help
aurimas (slooooooooow) 2013/04/12 22:00:41 Done.
48 // ----------------------------------------------------------------------------
49
50 jint Init(JNIEnv* env, jobject obj, jint window) {
51 ViewAndroid* view = new ViewAndroid(
52 env, obj, reinterpret_cast<ui::WindowAndroid*>(window));
53 return reinterpret_cast<jint>(view);
54 }
55
56 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698