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) { | |
281 window_android_ = reinterpret_cast<ui::WindowAndroid*>(window_android); | |
282 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | |
283 observer_list_, | |
284 OnAttachedToWindow()); | |
285 } else { | |
286 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | |
287 observer_list_, | |
gone
2016/02/24 21:01:37
nit: indentation is wonky.
Yusuf
2016/02/24 21:07:37
Done.
| |
288 OnDetachedFromWindow()); | |
289 window_android_ = NULL; | |
290 } | |
291 } | |
292 | |
276 base::android::ScopedJavaLocalRef<jobject> | 293 base::android::ScopedJavaLocalRef<jobject> |
277 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, | 294 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, |
278 const JavaParamRef<jobject>& obj) { | 295 const JavaParamRef<jobject>& obj) { |
279 return web_contents_->GetJavaWebContents(); | 296 return web_contents_->GetJavaWebContents(); |
280 } | 297 } |
281 | 298 |
282 base::android::ScopedJavaLocalRef<jobject> | 299 base::android::ScopedJavaLocalRef<jobject> |
283 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, | 300 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, |
284 const JavaParamRef<jobject>& obj) { | 301 const JavaParamRef<jobject>& obj) { |
285 if (!window_android_) | 302 if (!window_android_) |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1521 return ScopedJavaLocalRef<jobject>(); | 1538 return ScopedJavaLocalRef<jobject>(); |
1522 | 1539 |
1523 return view->GetJavaObject(); | 1540 return view->GetJavaObject(); |
1524 } | 1541 } |
1525 | 1542 |
1526 bool RegisterContentViewCore(JNIEnv* env) { | 1543 bool RegisterContentViewCore(JNIEnv* env) { |
1527 return RegisterNativesImpl(env); | 1544 return RegisterNativesImpl(env); |
1528 } | 1545 } |
1529 | 1546 |
1530 } // namespace content | 1547 } // namespace content |
OLD | NEW |