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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 736 |
737 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { | 737 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { |
738 JNIEnv* env = AttachCurrentThread(); | 738 JNIEnv* env = AttachCurrentThread(); |
739 | 739 |
740 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 740 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
741 if (obj.is_null()) | 741 if (obj.is_null()) |
742 return ScopedJavaLocalRef<jobject>(); | 742 return ScopedJavaLocalRef<jobject>(); |
743 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); | 743 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); |
744 } | 744 } |
745 | 745 |
746 void ContentViewCoreImpl::NotifyExternalSurface( | 746 void ContentViewCoreImpl::RequestExternalVideoSurface(int player_id) { |
747 int player_id, bool is_request, const gfx::RectF& rect) { | |
748 JNIEnv* env = AttachCurrentThread(); | 747 JNIEnv* env = AttachCurrentThread(); |
749 | 748 |
750 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 749 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
751 if (obj.is_null()) | 750 if (obj.is_null()) |
752 return; | 751 return; |
753 | 752 |
754 Java_ContentViewCore_notifyExternalSurface( | 753 Java_ContentViewCore_requestExternalVideoSurface( |
| 754 env, |
| 755 obj.obj(), |
| 756 static_cast<jint>(player_id)); |
| 757 } |
| 758 |
| 759 void ContentViewCoreImpl::ReleaseExternalVideoSurface(int player_id) { |
| 760 JNIEnv* env = AttachCurrentThread(); |
| 761 |
| 762 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 763 if (obj.is_null()) |
| 764 return; |
| 765 |
| 766 Java_ContentViewCore_releaseExternalVideoSurface( |
| 767 env, |
| 768 obj.obj(), |
| 769 static_cast<jint>(player_id)); |
| 770 } |
| 771 |
| 772 void ContentViewCoreImpl::NotifyExternalVideoSurfacePositionChanged( |
| 773 int player_id, const gfx::RectF& rect) { |
| 774 JNIEnv* env = AttachCurrentThread(); |
| 775 |
| 776 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 777 if (obj.is_null()) |
| 778 return; |
| 779 |
| 780 Java_ContentViewCore_notifyExternalVideoSurfacePositionChanged( |
755 env, | 781 env, |
756 obj.obj(), | 782 obj.obj(), |
757 static_cast<jint>(player_id), | 783 static_cast<jint>(player_id), |
758 static_cast<jboolean>(is_request), | |
759 static_cast<jfloat>(rect.x()), | 784 static_cast<jfloat>(rect.x()), |
760 static_cast<jfloat>(rect.y()), | 785 static_cast<jfloat>(rect.y()), |
761 static_cast<jfloat>(rect.width()), | 786 static_cast<jfloat>(rect.width()), |
762 static_cast<jfloat>(rect.height())); | 787 static_cast<jfloat>(rect.height())); |
763 } | 788 } |
764 | 789 |
765 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() { | 790 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() { |
766 JNIEnv* env = AttachCurrentThread(); | 791 JNIEnv* env = AttachCurrentThread(); |
767 | 792 |
768 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 793 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1891 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1867 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1892 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1868 return reinterpret_cast<intptr_t>(view); | 1893 return reinterpret_cast<intptr_t>(view); |
1869 } | 1894 } |
1870 | 1895 |
1871 bool RegisterContentViewCore(JNIEnv* env) { | 1896 bool RegisterContentViewCore(JNIEnv* env) { |
1872 return RegisterNativesImpl(env); | 1897 return RegisterNativesImpl(env); |
1873 } | 1898 } |
1874 | 1899 |
1875 } // namespace content | 1900 } // namespace content |
OLD | NEW |