Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 132233042: Enable the embedded L1/EME support in WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 #include "content/browser/renderer_host/java/java_bound_object.h" 29 #include "content/browser/renderer_host/java/java_bound_object.h"
30 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" 30 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h"
31 #include "content/browser/renderer_host/render_view_host_impl.h" 31 #include "content/browser/renderer_host/render_view_host_impl.h"
32 #include "content/browser/renderer_host/render_widget_host_impl.h" 32 #include "content/browser/renderer_host/render_widget_host_impl.h"
33 #include "content/browser/renderer_host/render_widget_host_view_android.h" 33 #include "content/browser/renderer_host/render_widget_host_view_android.h"
34 #include "content/browser/ssl/ssl_host_state.h" 34 #include "content/browser/ssl/ssl_host_state.h"
35 #include "content/browser/web_contents/web_contents_view_android.h" 35 #include "content/browser/web_contents/web_contents_view_android.h"
36 #include "content/common/input/web_input_event_traits.h" 36 #include "content/common/input/web_input_event_traits.h"
37 #include "content/common/input_messages.h" 37 #include "content/common/input_messages.h"
38 #include "content/common/view_messages.h" 38 #include "content/common/view_messages.h"
39 #include "content/public/browser/android/external_video_surface_container.h"
39 #include "content/public/browser/browser_accessibility_state.h" 40 #include "content/public/browser/browser_accessibility_state.h"
40 #include "content/public/browser/browser_context.h" 41 #include "content/public/browser/browser_context.h"
41 #include "content/public/browser/favicon_status.h" 42 #include "content/public/browser/favicon_status.h"
42 #include "content/public/browser/notification_details.h" 43 #include "content/public/browser/notification_details.h"
43 #include "content/public/browser/notification_service.h" 44 #include "content/public/browser/notification_service.h"
44 #include "content/public/browser/notification_source.h" 45 #include "content/public/browser/notification_source.h"
45 #include "content/public/browser/notification_types.h" 46 #include "content/public/browser/notification_types.h"
46 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
47 #include "content/public/common/content_client.h" 48 #include "content/public/common/content_client.h"
48 #include "content/public/common/content_switches.h" 49 #include "content/public/common/content_switches.h"
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 page_scale_factor, 498 page_scale_factor,
498 page_scale_factor_limits.x(), 499 page_scale_factor_limits.x(),
499 page_scale_factor_limits.y(), 500 page_scale_factor_limits.y(),
500 content_size.width(), 501 content_size.width(),
501 content_size.height(), 502 content_size.height(),
502 viewport_size.width(), 503 viewport_size.width(),
503 viewport_size.height(), 504 viewport_size.height(),
504 controls_offset.y(), 505 controls_offset.y(),
505 content_offset.y(), 506 content_offset.y(),
506 overdraw_bottom_height); 507 overdraw_bottom_height);
508 #if defined(VIDEO_HOLE)
509 ExternalVideoSurfaceContainer* surface_container =
510 ExternalVideoSurfaceContainer::FromWebContents(web_contents_);
511 if (surface_container)
512 surface_container->OnFrameInfoUpdated();
513 #endif // defined(VIDEO_HOLE)
507 } 514 }
508 515
509 void ContentViewCoreImpl::SetTitle(const base::string16& title) { 516 void ContentViewCoreImpl::SetTitle(const base::string16& title) {
510 JNIEnv* env = AttachCurrentThread(); 517 JNIEnv* env = AttachCurrentThread();
511 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 518 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
512 if (obj.is_null()) 519 if (obj.is_null())
513 return; 520 return;
514 ScopedJavaLocalRef<jstring> jtitle = 521 ScopedJavaLocalRef<jstring> jtitle =
515 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); 522 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title));
516 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); 523 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj());
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 743
737 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { 744 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() {
738 JNIEnv* env = AttachCurrentThread(); 745 JNIEnv* env = AttachCurrentThread();
739 746
740 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 747 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
741 if (obj.is_null()) 748 if (obj.is_null())
742 return ScopedJavaLocalRef<jobject>(); 749 return ScopedJavaLocalRef<jobject>();
743 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); 750 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj());
744 } 751 }
745 752
746 void ContentViewCoreImpl::NotifyExternalSurface(
747 int player_id, bool is_request, const gfx::RectF& rect) {
748 JNIEnv* env = AttachCurrentThread();
749
750 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
751 if (obj.is_null())
752 return;
753
754 Java_ContentViewCore_notifyExternalSurface(
755 env,
756 obj.obj(),
757 static_cast<jint>(player_id),
758 static_cast<jboolean>(is_request),
759 static_cast<jfloat>(rect.x()),
760 static_cast<jfloat>(rect.y()),
761 static_cast<jfloat>(rect.width()),
762 static_cast<jfloat>(rect.height()));
763 }
764
765 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() { 753 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() {
766 JNIEnv* env = AttachCurrentThread(); 754 JNIEnv* env = AttachCurrentThread();
767 755
768 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 756 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
769 if (obj.is_null()) 757 if (obj.is_null())
770 return ScopedJavaLocalRef<jobject>(); 758 return ScopedJavaLocalRef<jobject>();
771 759
772 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj()); 760 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj());
773 } 761 }
774 762
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 web_contents_, false, url, delegate); 1479 web_contents_, false, url, delegate);
1492 delegate->set_interstitial_page(interstitial); 1480 delegate->set_interstitial_page(interstitial);
1493 interstitial->Show(); 1481 interstitial->Show();
1494 } 1482 }
1495 1483
1496 jboolean ContentViewCoreImpl::IsShowingInterstitialPage(JNIEnv* env, 1484 jboolean ContentViewCoreImpl::IsShowingInterstitialPage(JNIEnv* env,
1497 jobject obj) { 1485 jobject obj) {
1498 return web_contents_->ShowingInterstitialPage(); 1486 return web_contents_->ShowingInterstitialPage();
1499 } 1487 }
1500 1488
1501 void ContentViewCoreImpl::AttachExternalVideoSurface(JNIEnv* env,
1502 jobject obj,
1503 jint player_id,
1504 jobject jsurface) {
1505 #if defined(VIDEO_HOLE)
1506 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1507 web_contents_->GetRenderViewHost());
1508 if (rvhi && rvhi->media_player_manager()) {
1509 rvhi->media_player_manager()->AttachExternalVideoSurface(
1510 static_cast<int>(player_id), jsurface);
1511 }
1512 #endif // defined(VIDEO_HOLE)
1513 }
1514
1515 void ContentViewCoreImpl::DetachExternalVideoSurface(JNIEnv* env,
1516 jobject obj,
1517 jint player_id) {
1518 #if defined(VIDEO_HOLE)
1519 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1520 web_contents_->GetRenderViewHost());
1521 if (rvhi && rvhi->media_player_manager()) {
1522 rvhi->media_player_manager()->DetachExternalVideoSurface(
1523 static_cast<int>(player_id));
1524 }
1525 #endif // defined(VIDEO_HOLE)
1526 }
1527
1528 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, 1489 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env,
1529 jobject obj) { 1490 jobject obj) {
1530 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 1491 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
1531 return view && view->HasValidFrame(); 1492 return view && view->HasValidFrame();
1532 } 1493 }
1533 1494
1534 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { 1495 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) {
1535 RenderViewHost* host = web_contents_->GetRenderViewHost(); 1496 RenderViewHost* host = web_contents_->GetRenderViewHost();
1536 if (!host) 1497 if (!host)
1537 return; 1498 return;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 reinterpret_cast<ui::ViewAndroid*>(view_android), 1827 reinterpret_cast<ui::ViewAndroid*>(view_android),
1867 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1828 reinterpret_cast<ui::WindowAndroid*>(window_android));
1868 return reinterpret_cast<intptr_t>(view); 1829 return reinterpret_cast<intptr_t>(view);
1869 } 1830 }
1870 1831
1871 bool RegisterContentViewCore(JNIEnv* env) { 1832 bool RegisterContentViewCore(JNIEnv* env) {
1872 return RegisterNativesImpl(env); 1833 return RegisterNativesImpl(env);
1873 } 1834 }
1874 1835
1875 } // namespace content 1836 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698