Chromium Code Reviews| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 if (!j_obj.is_null()) { | 269 if (!j_obj.is_null()) { |
| 270 Java_ContentViewCore_onNativeContentViewCoreDestroyed( | 270 Java_ContentViewCore_onNativeContentViewCoreDestroyed( |
| 271 env, j_obj, reinterpret_cast<intptr_t>(this)); | 271 env, j_obj, reinterpret_cast<intptr_t>(this)); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 void ContentViewCoreImpl::UpdateWindowAndroid( | 275 void ContentViewCoreImpl::UpdateWindowAndroid( |
| 276 JNIEnv* env, | 276 JNIEnv* env, |
| 277 const base::android::JavaParamRef<jobject>& obj, | 277 const base::android::JavaParamRef<jobject>& obj, |
| 278 jlong window_android) { | 278 jlong window_android) { |
| 279 if (!window_android || view_.GetWindowAndroid()) { | |
| 280 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, observer_list_, | |
|
Ted C
2016/09/20 19:57:07
per my other comment, let's try to avoid this by s
mthiesse
2016/09/20 20:56:08
Done.
| |
| 281 OnDetachedFromWindow()); | |
| 282 view_.RemoveFromParent(); | |
| 283 } | |
| 279 if (window_android) { | 284 if (window_android) { |
| 280 DCHECK(!view_.GetWindowAndroid()); | |
| 281 ui::WindowAndroid* window = | 285 ui::WindowAndroid* window = |
| 282 reinterpret_cast<ui::WindowAndroid*>(window_android); | 286 reinterpret_cast<ui::WindowAndroid*>(window_android); |
| 283 window->AddChild(&view_); | 287 window->AddChild(&view_); |
| 284 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | 288 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, observer_list_, |
| 285 observer_list_, | |
| 286 OnAttachedToWindow()); | 289 OnAttachedToWindow()); |
| 287 } else { | |
| 288 FOR_EACH_OBSERVER(ContentViewCoreImplObserver, | |
| 289 observer_list_, | |
| 290 OnDetachedFromWindow()); | |
| 291 view_.RemoveFromParent(); | |
| 292 } | 290 } |
| 293 } | 291 } |
| 294 | 292 |
| 295 base::android::ScopedJavaLocalRef<jobject> | 293 base::android::ScopedJavaLocalRef<jobject> |
| 296 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, | 294 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, |
| 297 const JavaParamRef<jobject>& obj) { | 295 const JavaParamRef<jobject>& obj) { |
| 298 return web_contents_->GetJavaWebContents(); | 296 return web_contents_->GetJavaWebContents(); |
| 299 } | 297 } |
| 300 | 298 |
| 301 base::android::ScopedJavaLocalRef<jobject> | 299 base::android::ScopedJavaLocalRef<jobject> |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1603 return ScopedJavaLocalRef<jobject>(); | 1601 return ScopedJavaLocalRef<jobject>(); |
| 1604 | 1602 |
| 1605 return view->GetJavaObject(); | 1603 return view->GetJavaObject(); |
| 1606 } | 1604 } |
| 1607 | 1605 |
| 1608 bool RegisterContentViewCore(JNIEnv* env) { | 1606 bool RegisterContentViewCore(JNIEnv* env) { |
| 1609 return RegisterNativesImpl(env); | 1607 return RegisterNativesImpl(env); |
| 1610 } | 1608 } |
| 1611 | 1609 |
| 1612 } // namespace content | 1610 } // namespace content |
| OLD | NEW |