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

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: Fixed the findbugs warning. 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 17 matching lines...) Expand all
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
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 740
734 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { 741 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() {
735 JNIEnv* env = AttachCurrentThread(); 742 JNIEnv* env = AttachCurrentThread();
736 743
737 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 744 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
738 if (obj.is_null()) 745 if (obj.is_null())
739 return ScopedJavaLocalRef<jobject>(); 746 return ScopedJavaLocalRef<jobject>();
740 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); 747 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj());
741 } 748 }
742 749
743 void ContentViewCoreImpl::NotifyExternalSurface(
744 int player_id, bool is_request, const gfx::RectF& rect) {
745 JNIEnv* env = AttachCurrentThread();
746
747 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
748 if (obj.is_null())
749 return;
750
751 Java_ContentViewCore_notifyExternalSurface(
752 env,
753 obj.obj(),
754 static_cast<jint>(player_id),
755 static_cast<jboolean>(is_request),
756 static_cast<jfloat>(rect.x()),
757 static_cast<jfloat>(rect.y()),
758 static_cast<jfloat>(rect.width()),
759 static_cast<jfloat>(rect.height()));
760 }
761
762 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() { 750 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() {
763 JNIEnv* env = AttachCurrentThread(); 751 JNIEnv* env = AttachCurrentThread();
764 752
765 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 753 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
766 if (obj.is_null()) 754 if (obj.is_null())
767 return ScopedJavaLocalRef<jobject>(); 755 return ScopedJavaLocalRef<jobject>();
768 756
769 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj()); 757 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj());
770 } 758 }
771 759
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 web_contents_, false, url, delegate); 1476 web_contents_, false, url, delegate);
1489 delegate->set_interstitial_page(interstitial); 1477 delegate->set_interstitial_page(interstitial);
1490 interstitial->Show(); 1478 interstitial->Show();
1491 } 1479 }
1492 1480
1493 jboolean ContentViewCoreImpl::IsShowingInterstitialPage(JNIEnv* env, 1481 jboolean ContentViewCoreImpl::IsShowingInterstitialPage(JNIEnv* env,
1494 jobject obj) { 1482 jobject obj) {
1495 return web_contents_->ShowingInterstitialPage(); 1483 return web_contents_->ShowingInterstitialPage();
1496 } 1484 }
1497 1485
1498 void ContentViewCoreImpl::AttachExternalVideoSurface(JNIEnv* env,
1499 jobject obj,
1500 jint player_id,
1501 jobject jsurface) {
1502 #if defined(VIDEO_HOLE)
1503 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1504 web_contents_->GetRenderViewHost());
1505 if (rvhi && rvhi->media_player_manager()) {
1506 rvhi->media_player_manager()->AttachExternalVideoSurface(
1507 static_cast<int>(player_id), jsurface);
1508 }
1509 #endif // defined(VIDEO_HOLE)
1510 }
1511
1512 void ContentViewCoreImpl::DetachExternalVideoSurface(JNIEnv* env,
1513 jobject obj,
1514 jint player_id) {
1515 #if defined(VIDEO_HOLE)
1516 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1517 web_contents_->GetRenderViewHost());
1518 if (rvhi && rvhi->media_player_manager()) {
1519 rvhi->media_player_manager()->DetachExternalVideoSurface(
1520 static_cast<int>(player_id));
1521 }
1522 #endif // defined(VIDEO_HOLE)
1523 }
1524
1525 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, 1486 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env,
1526 jobject obj) { 1487 jobject obj) {
1527 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 1488 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
1528 return view && view->HasValidFrame(); 1489 return view && view->HasValidFrame();
1529 } 1490 }
1530 1491
1531 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { 1492 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) {
1532 RenderViewHost* host = web_contents_->GetRenderViewHost(); 1493 RenderViewHost* host = web_contents_->GetRenderViewHost();
1533 if (!host) 1494 if (!host)
1534 return; 1495 return;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 reinterpret_cast<ui::ViewAndroid*>(view_android), 1824 reinterpret_cast<ui::ViewAndroid*>(view_android),
1864 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1825 reinterpret_cast<ui::WindowAndroid*>(window_android));
1865 return reinterpret_cast<intptr_t>(view); 1826 return reinterpret_cast<intptr_t>(view);
1866 } 1827 }
1867 1828
1868 bool RegisterContentViewCore(JNIEnv* env) { 1829 bool RegisterContentViewCore(JNIEnv* env) {
1869 return RegisterNativesImpl(env); 1830 return RegisterNativesImpl(env);
1870 } 1831 }
1871 1832
1872 } // namespace content 1833 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698