OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "android_webview/native/external_video_surface_container_impl.h" | 5 #include "components/external_video_surface/browser/android/external_video_surfa
ce_container_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "content/public/browser/android/content_view_core.h" | 8 #include "content/public/browser/android/content_view_core.h" |
9 #include "jni/ExternalVideoSurfaceContainer_jni.h" | 9 #include "jni/ExternalVideoSurfaceContainer_jni.h" |
10 #include "ui/gfx/geometry/rect_f.h" | 10 #include "ui/gfx/geometry/rect_f.h" |
11 | 11 |
12 using base::android::AttachCurrentThread; | 12 using base::android::AttachCurrentThread; |
13 using content::ContentViewCore; | 13 using content::ContentViewCore; |
14 | 14 |
15 namespace android_webview { | 15 namespace external_video_surface { |
| 16 |
| 17 // static |
| 18 bool ExternalVideoSurfaceContainerImpl::RegisterJni(JNIEnv* env) { |
| 19 return RegisterNativesImpl(env); |
| 20 } |
16 | 21 |
17 // static | 22 // static |
18 ExternalVideoSurfaceContainerImpl* ExternalVideoSurfaceContainerImpl::Create( | 23 ExternalVideoSurfaceContainerImpl* ExternalVideoSurfaceContainerImpl::Create( |
19 content::WebContents* web_contents) { | 24 content::WebContents* web_contents) { |
20 ContentViewCore* cvc = ContentViewCore::FromWebContents(web_contents); | 25 ContentViewCore* cvc = ContentViewCore::FromWebContents(web_contents); |
21 if (!cvc) | 26 if (!cvc) |
22 return nullptr; | 27 return nullptr; |
23 base::android::ScopedJavaLocalRef<jobject> jcvc = cvc->GetJavaObject(); | 28 base::android::ScopedJavaLocalRef<jobject> jcvc = cvc->GetJavaObject(); |
24 if (jcvc.is_null()) | 29 if (jcvc.is_null()) |
25 return nullptr; | 30 return nullptr; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (!surface_created_cb_.is_null()) | 103 if (!surface_created_cb_.is_null()) |
99 surface_created_cb_.Run(static_cast<int>(player_id), jsurface); | 104 surface_created_cb_.Run(static_cast<int>(player_id), jsurface); |
100 } | 105 } |
101 | 106 |
102 void ExternalVideoSurfaceContainerImpl::SurfaceDestroyed( | 107 void ExternalVideoSurfaceContainerImpl::SurfaceDestroyed( |
103 JNIEnv* env, jobject obj, jint player_id) { | 108 JNIEnv* env, jobject obj, jint player_id) { |
104 if (!surface_destroyed_cb_.is_null()) | 109 if (!surface_destroyed_cb_.is_null()) |
105 surface_destroyed_cb_.Run(static_cast<int>(player_id)); | 110 surface_destroyed_cb_.Run(static_cast<int>(player_id)); |
106 } | 111 } |
107 | 112 |
108 bool RegisterExternalVideoSurfaceContainer(JNIEnv* env) { | 113 } // namespace external_video_surface |
109 return RegisterNativesImpl(env); | |
110 } | |
111 | |
112 } // namespace android_webview | |
OLD | NEW |