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