OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
17 #include "content/browser/android/interstitial_page_delegate_android.h" | 17 #include "content/browser/android/interstitial_page_delegate_android.h" |
18 #include "content/browser/android/load_url_params.h" | 18 #include "content/browser/android/load_url_params.h" |
| 19 #include "content/browser/android/media_player_manager_android.h" |
19 #include "content/browser/android/sync_input_event_filter.h" | 20 #include "content/browser/android/sync_input_event_filter.h" |
20 #include "content/browser/android/touch_point.h" | 21 #include "content/browser/android/touch_point.h" |
21 #include "content/browser/renderer_host/compositor_impl_android.h" | 22 #include "content/browser/renderer_host/compositor_impl_android.h" |
22 #include "content/browser/renderer_host/java/java_bound_object.h" | 23 #include "content/browser/renderer_host/java/java_bound_object.h" |
23 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 24 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
24 #include "content/browser/renderer_host/render_view_host_impl.h" | 25 #include "content/browser/renderer_host/render_view_host_impl.h" |
25 #include "content/browser/renderer_host/render_widget_host_impl.h" | 26 #include "content/browser/renderer_host/render_widget_host_impl.h" |
26 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 27 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
27 #include "content/browser/ssl/ssl_host_state.h" | 28 #include "content/browser/ssl/ssl_host_state.h" |
28 #include "content/browser/web_contents/interstitial_page_impl.h" | 29 #include "content/browser/web_contents/interstitial_page_impl.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 ScopedJavaLocalRef<jobject> java_bitmap = | 582 ScopedJavaLocalRef<jobject> java_bitmap = |
582 gfx::ConvertToJavaBitmap(&zoomed_bitmap); | 583 gfx::ConvertToJavaBitmap(&zoomed_bitmap); |
583 DCHECK(!java_bitmap.is_null()); | 584 DCHECK(!java_bitmap.is_null()); |
584 | 585 |
585 Java_ContentViewCore_showDisambiguationPopup(env, | 586 Java_ContentViewCore_showDisambiguationPopup(env, |
586 obj.obj(), | 587 obj.obj(), |
587 rect_object.obj(), | 588 rect_object.obj(), |
588 java_bitmap.obj()); | 589 java_bitmap.obj()); |
589 } | 590 } |
590 | 591 |
| 592 void ContentViewCoreImpl::RequestExternalVideoSurface(int player_id) { |
| 593 JNIEnv* env = AttachCurrentThread(); |
| 594 |
| 595 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 596 if (obj.is_null()) |
| 597 return; |
| 598 |
| 599 Java_ContentViewCore_requestExternalVideoSurface( |
| 600 env, obj.obj(), static_cast<jint>(player_id)); |
| 601 } |
| 602 |
591 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 603 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
592 JNIEnv* env = AttachCurrentThread(); | 604 JNIEnv* env = AttachCurrentThread(); |
593 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 605 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
594 if (j_obj.is_null()) | 606 if (j_obj.is_null()) |
595 return gfx::Size(); | 607 return gfx::Size(); |
596 return gfx::Size( | 608 return gfx::Size( |
597 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), | 609 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), |
598 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); | 610 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); |
599 } | 611 } |
600 | 612 |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 return web_contents_->ShowingInterstitialPage(); | 1182 return web_contents_->ShowingInterstitialPage(); |
1171 } | 1183 } |
1172 | 1184 |
1173 jboolean ContentViewCoreImpl::ConsumePendingRendererFrame(JNIEnv* env, | 1185 jboolean ContentViewCoreImpl::ConsumePendingRendererFrame(JNIEnv* env, |
1174 jobject obj) { | 1186 jobject obj) { |
1175 bool had_pending_frame = renderer_frame_pending_; | 1187 bool had_pending_frame = renderer_frame_pending_; |
1176 renderer_frame_pending_ = false; | 1188 renderer_frame_pending_ = false; |
1177 return had_pending_frame; | 1189 return had_pending_frame; |
1178 } | 1190 } |
1179 | 1191 |
| 1192 void ContentViewCoreImpl::AttachExternalVideoSurface(JNIEnv* env, |
| 1193 jobject obj, |
| 1194 jint player_id, |
| 1195 jobject jsurface) { |
| 1196 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
| 1197 web_contents_->GetRenderViewHost()); |
| 1198 if (rvhi && rvhi->media_player_manager()) { |
| 1199 rvhi->media_player_manager()->AttachExternalVideoSurface( |
| 1200 static_cast<int>(player_id), jsurface); |
| 1201 } |
| 1202 } |
| 1203 |
| 1204 void ContentViewCoreImpl::DetachExternalVideoSurface(JNIEnv* env, |
| 1205 jobject obj, |
| 1206 jint player_id) { |
| 1207 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
| 1208 web_contents_->GetRenderViewHost()); |
| 1209 if (rvhi && rvhi->media_player_manager()) { |
| 1210 rvhi->media_player_manager()->DetachExternalVideoSurface( |
| 1211 static_cast<int>(player_id)); |
| 1212 } |
| 1213 } |
| 1214 |
1180 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, | 1215 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, |
1181 jobject obj) { | 1216 jobject obj) { |
1182 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1217 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
1183 return view && view->HasValidFrame(); | 1218 return view && view->HasValidFrame(); |
1184 } | 1219 } |
1185 | 1220 |
1186 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { | 1221 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { |
1187 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 1222 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
1188 host->ExitFullscreen(); | 1223 host->ExitFullscreen(); |
1189 } | 1224 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 reinterpret_cast<WebContents*>(native_web_contents), | 1443 reinterpret_cast<WebContents*>(native_web_contents), |
1409 reinterpret_cast<ui::WindowAndroid*>(native_window)); | 1444 reinterpret_cast<ui::WindowAndroid*>(native_window)); |
1410 return reinterpret_cast<jint>(view); | 1445 return reinterpret_cast<jint>(view); |
1411 } | 1446 } |
1412 | 1447 |
1413 bool RegisterContentViewCore(JNIEnv* env) { | 1448 bool RegisterContentViewCore(JNIEnv* env) { |
1414 return RegisterNativesImpl(env); | 1449 return RegisterNativesImpl(env); |
1415 } | 1450 } |
1416 | 1451 |
1417 } // namespace content | 1452 } // namespace content |
OLD | NEW |