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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "content/browser/renderer_host/java/java_bound_object.h" | 28 #include "content/browser/renderer_host/java/java_bound_object.h" |
29 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 29 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
30 #include "content/browser/renderer_host/render_view_host_impl.h" | 30 #include "content/browser/renderer_host/render_view_host_impl.h" |
31 #include "content/browser/renderer_host/render_widget_host_impl.h" | 31 #include "content/browser/renderer_host/render_widget_host_impl.h" |
32 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 32 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
33 #include "content/browser/ssl/ssl_host_state.h" | 33 #include "content/browser/ssl/ssl_host_state.h" |
34 #include "content/browser/web_contents/web_contents_view_android.h" | 34 #include "content/browser/web_contents/web_contents_view_android.h" |
35 #include "content/common/input/web_input_event_traits.h" | 35 #include "content/common/input/web_input_event_traits.h" |
36 #include "content/common/input_messages.h" | 36 #include "content/common/input_messages.h" |
37 #include "content/common/view_messages.h" | 37 #include "content/common/view_messages.h" |
| 38 #include "content/public/browser/android/external_video_surface_container.h" |
38 #include "content/public/browser/browser_accessibility_state.h" | 39 #include "content/public/browser/browser_accessibility_state.h" |
39 #include "content/public/browser/browser_context.h" | 40 #include "content/public/browser/browser_context.h" |
40 #include "content/public/browser/favicon_status.h" | 41 #include "content/public/browser/favicon_status.h" |
41 #include "content/public/browser/notification_details.h" | 42 #include "content/public/browser/notification_details.h" |
42 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
43 #include "content/public/browser/notification_source.h" | 44 #include "content/public/browser/notification_source.h" |
44 #include "content/public/browser/notification_types.h" | 45 #include "content/public/browser/notification_types.h" |
45 #include "content/public/browser/web_contents.h" | 46 #include "content/public/browser/web_contents.h" |
46 #include "content/public/common/content_client.h" | 47 #include "content/public/common/content_client.h" |
47 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 page_scale_factor, | 489 page_scale_factor, |
489 page_scale_factor_limits.x(), | 490 page_scale_factor_limits.x(), |
490 page_scale_factor_limits.y(), | 491 page_scale_factor_limits.y(), |
491 content_size.width(), | 492 content_size.width(), |
492 content_size.height(), | 493 content_size.height(), |
493 viewport_size.width(), | 494 viewport_size.width(), |
494 viewport_size.height(), | 495 viewport_size.height(), |
495 controls_offset.y(), | 496 controls_offset.y(), |
496 content_offset.y(), | 497 content_offset.y(), |
497 overdraw_bottom_height); | 498 overdraw_bottom_height); |
| 499 #if defined(VIDEO_HOLE) |
| 500 ExternalVideoSurfaceContainer* surface_container = |
| 501 ExternalVideoSurfaceContainer::FromWebContents(web_contents_); |
| 502 if (surface_container) |
| 503 surface_container->OnFrameInfoUpdated(); |
| 504 #endif // defined(VIDEO_HOLE) |
498 } | 505 } |
499 | 506 |
500 void ContentViewCoreImpl::SetTitle(const base::string16& title) { | 507 void ContentViewCoreImpl::SetTitle(const base::string16& title) { |
501 JNIEnv* env = AttachCurrentThread(); | 508 JNIEnv* env = AttachCurrentThread(); |
502 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 509 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
503 if (obj.is_null()) | 510 if (obj.is_null()) |
504 return; | 511 return; |
505 ScopedJavaLocalRef<jstring> jtitle = | 512 ScopedJavaLocalRef<jstring> jtitle = |
506 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); | 513 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); |
507 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); | 514 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 744 |
738 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { | 745 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { |
739 JNIEnv* env = AttachCurrentThread(); | 746 JNIEnv* env = AttachCurrentThread(); |
740 | 747 |
741 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 748 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
742 if (obj.is_null()) | 749 if (obj.is_null()) |
743 return ScopedJavaLocalRef<jobject>(); | 750 return ScopedJavaLocalRef<jobject>(); |
744 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); | 751 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); |
745 } | 752 } |
746 | 753 |
747 void ContentViewCoreImpl::NotifyExternalSurface( | |
748 int player_id, bool is_request, const gfx::RectF& rect) { | |
749 JNIEnv* env = AttachCurrentThread(); | |
750 | |
751 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
752 if (obj.is_null()) | |
753 return; | |
754 | |
755 Java_ContentViewCore_notifyExternalSurface( | |
756 env, | |
757 obj.obj(), | |
758 static_cast<jint>(player_id), | |
759 static_cast<jboolean>(is_request), | |
760 static_cast<jfloat>(rect.x()), | |
761 static_cast<jfloat>(rect.y()), | |
762 static_cast<jfloat>(rect.width()), | |
763 static_cast<jfloat>(rect.height())); | |
764 } | |
765 | |
766 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() { | 754 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() { |
767 JNIEnv* env = AttachCurrentThread(); | 755 JNIEnv* env = AttachCurrentThread(); |
768 | 756 |
769 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 757 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
770 if (obj.is_null()) | 758 if (obj.is_null()) |
771 return ScopedJavaLocalRef<jobject>(); | 759 return ScopedJavaLocalRef<jobject>(); |
772 | 760 |
773 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj()); | 761 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj()); |
774 } | 762 } |
775 | 763 |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 web_contents_, false, url, delegate); | 1482 web_contents_, false, url, delegate); |
1495 delegate->set_interstitial_page(interstitial); | 1483 delegate->set_interstitial_page(interstitial); |
1496 interstitial->Show(); | 1484 interstitial->Show(); |
1497 } | 1485 } |
1498 | 1486 |
1499 jboolean ContentViewCoreImpl::IsShowingInterstitialPage(JNIEnv* env, | 1487 jboolean ContentViewCoreImpl::IsShowingInterstitialPage(JNIEnv* env, |
1500 jobject obj) { | 1488 jobject obj) { |
1501 return web_contents_->ShowingInterstitialPage(); | 1489 return web_contents_->ShowingInterstitialPage(); |
1502 } | 1490 } |
1503 | 1491 |
1504 void ContentViewCoreImpl::AttachExternalVideoSurface(JNIEnv* env, | |
1505 jobject obj, | |
1506 jint player_id, | |
1507 jobject jsurface) { | |
1508 #if defined(VIDEO_HOLE) | |
1509 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | |
1510 web_contents_->GetRenderViewHost()); | |
1511 if (rvhi && rvhi->media_player_manager()) { | |
1512 rvhi->media_player_manager()->AttachExternalVideoSurface( | |
1513 static_cast<int>(player_id), jsurface); | |
1514 } | |
1515 #endif // defined(VIDEO_HOLE) | |
1516 } | |
1517 | |
1518 void ContentViewCoreImpl::DetachExternalVideoSurface(JNIEnv* env, | |
1519 jobject obj, | |
1520 jint player_id) { | |
1521 #if defined(VIDEO_HOLE) | |
1522 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | |
1523 web_contents_->GetRenderViewHost()); | |
1524 if (rvhi && rvhi->media_player_manager()) { | |
1525 rvhi->media_player_manager()->DetachExternalVideoSurface( | |
1526 static_cast<int>(player_id)); | |
1527 } | |
1528 #endif // defined(VIDEO_HOLE) | |
1529 } | |
1530 | |
1531 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, | 1492 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, |
1532 jobject obj) { | 1493 jobject obj) { |
1533 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1494 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
1534 return view && view->HasValidFrame(); | 1495 return view && view->HasValidFrame(); |
1535 } | 1496 } |
1536 | 1497 |
1537 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { | 1498 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { |
1538 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 1499 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
1539 if (!host) | 1500 if (!host) |
1540 return; | 1501 return; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1830 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1870 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1831 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1871 return reinterpret_cast<intptr_t>(view); | 1832 return reinterpret_cast<intptr_t>(view); |
1872 } | 1833 } |
1873 | 1834 |
1874 bool RegisterContentViewCore(JNIEnv* env) { | 1835 bool RegisterContentViewCore(JNIEnv* env) { |
1875 return RegisterNativesImpl(env); | 1836 return RegisterNativesImpl(env); |
1876 } | 1837 } |
1877 | 1838 |
1878 } // namespace content | 1839 } // namespace content |
OLD | NEW |