OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/android/window_android.h" | 5 #include "ui/base/android/window_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_helper.h" | 9 #include "base/android/jni_helper.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "jni/WindowAndroid_jni.h" | 11 #include "jni/WindowAndroid_jni.h" |
12 #include "ui/base/android/window_android_observer.h" | 12 #include "ui/base/android/window_android_observer.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 using base::android::AttachCurrentThread; | 16 using base::android::AttachCurrentThread; |
17 using base::android::ScopedJavaLocalRef; | 17 using base::android::ScopedJavaLocalRef; |
18 | 18 |
19 WindowAndroid::WindowAndroid(JNIEnv* env, jobject obj) | 19 WindowAndroid::WindowAndroid(JNIEnv* env, jobject obj) |
20 : weak_java_window_(env, obj) { | 20 : weak_java_window_(env, obj) { |
21 } | 21 } |
22 | 22 |
23 void WindowAndroid::Destroy(JNIEnv* env, jobject obj) { | 23 void WindowAndroid::Destroy(JNIEnv* env, jobject obj) { |
24 delete this; | 24 delete this; |
25 } | 25 } |
26 | 26 |
27 ScopedJavaLocalRef<jobject> WindowAndroid::GetJavaObject() { | 27 ScopedJavaLocalRef<jobject> WindowAndroid::GetJavaObject() const { |
28 return weak_java_window_.get(AttachCurrentThread()); | 28 return weak_java_window_.get(AttachCurrentThread()); |
29 } | 29 } |
30 | 30 |
31 bool WindowAndroid::RegisterWindowAndroid(JNIEnv* env) { | 31 bool WindowAndroid::RegisterWindowAndroid(JNIEnv* env) { |
32 return RegisterNativesImpl(env); | 32 return RegisterNativesImpl(env); |
33 } | 33 } |
34 | 34 |
35 WindowAndroid::~WindowAndroid() { | 35 WindowAndroid::~WindowAndroid() { |
36 } | 36 } |
37 | 37 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // ---------------------------------------------------------------------------- | 82 // ---------------------------------------------------------------------------- |
83 // Native JNI methods | 83 // Native JNI methods |
84 // ---------------------------------------------------------------------------- | 84 // ---------------------------------------------------------------------------- |
85 | 85 |
86 jlong Init(JNIEnv* env, jobject obj) { | 86 jlong Init(JNIEnv* env, jobject obj) { |
87 WindowAndroid* window = new WindowAndroid(env, obj); | 87 WindowAndroid* window = new WindowAndroid(env, obj); |
88 return reinterpret_cast<intptr_t>(window); | 88 return reinterpret_cast<intptr_t>(window); |
89 } | 89 } |
90 | 90 |
91 } // namespace ui | 91 } // namespace ui |
OLD | NEW |