OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 | 266 |
267 JNIEnv* env = base::android::AttachCurrentThread(); | 267 JNIEnv* env = base::android::AttachCurrentThread(); |
268 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 268 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
269 java_ref_.reset(); | 269 java_ref_.reset(); |
270 if (!j_obj.is_null()) { | 270 if (!j_obj.is_null()) { |
271 Java_ContentViewCore_onNativeContentViewCoreDestroyed( | 271 Java_ContentViewCore_onNativeContentViewCoreDestroyed( |
272 env, j_obj.obj(), reinterpret_cast<intptr_t>(this)); | 272 env, j_obj.obj(), reinterpret_cast<intptr_t>(this)); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 void ContentViewCoreImpl::UpdateWindowAndroid( | |
277 JNIEnv* env, | |
278 const base::android::JavaParamRef<jobject>& obj, | |
279 jlong window_android) { | |
280 if (!window_android) { | |
gone
2016/02/24 18:40:37
1) Do you not have to set window_android_ to null?
Yusuf
2016/02/24 19:40:36
1) Yes, I should. (and it still works! Phew!)
2)Do
| |
281 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | |
282 observer_list_, | |
283 OnDetachedFromWindow()); | |
284 } else { | |
285 window_android_ = reinterpret_cast<ui::WindowAndroid*>(window_android); | |
286 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | |
287 observer_list_, | |
288 OnAttachedToWindow()); | |
289 } | |
290 } | |
291 | |
276 base::android::ScopedJavaLocalRef<jobject> | 292 base::android::ScopedJavaLocalRef<jobject> |
277 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, | 293 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, |
278 const JavaParamRef<jobject>& obj) { | 294 const JavaParamRef<jobject>& obj) { |
279 return web_contents_->GetJavaWebContents(); | 295 return web_contents_->GetJavaWebContents(); |
280 } | 296 } |
281 | 297 |
282 base::android::ScopedJavaLocalRef<jobject> | 298 base::android::ScopedJavaLocalRef<jobject> |
283 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, | 299 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, |
284 const JavaParamRef<jobject>& obj) { | 300 const JavaParamRef<jobject>& obj) { |
285 if (!window_android_) | 301 if (!window_android_) |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1521 return ScopedJavaLocalRef<jobject>(); | 1537 return ScopedJavaLocalRef<jobject>(); |
1522 | 1538 |
1523 return view->GetJavaObject(); | 1539 return view->GetJavaObject(); |
1524 } | 1540 } |
1525 | 1541 |
1526 bool RegisterContentViewCore(JNIEnv* env) { | 1542 bool RegisterContentViewCore(JNIEnv* env) { |
1527 return RegisterNativesImpl(env); | 1543 return RegisterNativesImpl(env); |
1528 } | 1544 } |
1529 | 1545 |
1530 } // namespace content | 1546 } // namespace content |
OLD | NEW |