| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 if (!j_obj.is_null()) { | 268 if (!j_obj.is_null()) { |
| 269 Java_ContentViewCore_onNativeContentViewCoreDestroyed( | 269 Java_ContentViewCore_onNativeContentViewCoreDestroyed( |
| 270 env, j_obj, reinterpret_cast<intptr_t>(this)); | 270 env, j_obj, reinterpret_cast<intptr_t>(this)); |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 | 273 |
| 274 void ContentViewCoreImpl::UpdateWindowAndroid( | 274 void ContentViewCoreImpl::UpdateWindowAndroid( |
| 275 JNIEnv* env, | 275 JNIEnv* env, |
| 276 const base::android::JavaParamRef<jobject>& obj, | 276 const base::android::JavaParamRef<jobject>& obj, |
| 277 jlong window_android) { | 277 jlong window_android) { |
| 278 if (!window_android || view_.GetWindowAndroid()) { |
| 279 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, observer_list_, |
| 280 OnDetachedFromWindow()); |
| 281 view_.RemoveFromParent(); |
| 282 } |
| 278 if (window_android) { | 283 if (window_android) { |
| 279 DCHECK(!view_.GetWindowAndroid()); | |
| 280 ui::WindowAndroid* window = | 284 ui::WindowAndroid* window = |
| 281 reinterpret_cast<ui::WindowAndroid*>(window_android); | 285 reinterpret_cast<ui::WindowAndroid*>(window_android); |
| 282 window->AddChild(&view_); | 286 window->AddChild(&view_); |
| 283 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | 287 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, observer_list_, |
| 284 observer_list_, | |
| 285 OnAttachedToWindow()); | 288 OnAttachedToWindow()); |
| 286 } else { | |
| 287 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | |
| 288 observer_list_, | |
| 289 OnDetachedFromWindow()); | |
| 290 view_.RemoveFromParent(); | |
| 291 } | 289 } |
| 292 } | 290 } |
| 293 | 291 |
| 294 base::android::ScopedJavaLocalRef<jobject> | 292 base::android::ScopedJavaLocalRef<jobject> |
| 295 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, | 293 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, |
| 296 const JavaParamRef<jobject>& obj) { | 294 const JavaParamRef<jobject>& obj) { |
| 297 return web_contents_->GetJavaWebContents(); | 295 return web_contents_->GetJavaWebContents(); |
| 298 } | 296 } |
| 299 | 297 |
| 300 base::android::ScopedJavaLocalRef<jobject> | 298 base::android::ScopedJavaLocalRef<jobject> |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 return ScopedJavaLocalRef<jobject>(); | 1600 return ScopedJavaLocalRef<jobject>(); |
| 1603 | 1601 |
| 1604 return view->GetJavaObject(); | 1602 return view->GetJavaObject(); |
| 1605 } | 1603 } |
| 1606 | 1604 |
| 1607 bool RegisterContentViewCore(JNIEnv* env) { | 1605 bool RegisterContentViewCore(JNIEnv* env) { |
| 1608 return RegisterNativesImpl(env); | 1606 return RegisterNativesImpl(env); |
| 1609 } | 1607 } |
| 1610 | 1608 |
| 1611 } // namespace content | 1609 } // namespace content |
| OLD | NEW |