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