OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ |
| 6 #define ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "content/public/browser/android/external_video_surface_container.h" |
| 14 #include "content/public/browser/web_contents_user_data.h" |
| 15 |
| 16 namespace android_webview { |
| 17 |
| 18 class ExternalVideoSurfaceContainerImpl |
| 19 : public content::ExternalVideoSurfaceContainer, |
| 20 public content::WebContentsUserData<ExternalVideoSurfaceContainerImpl> { |
| 21 public: |
| 22 typedef base::Callback<void(int, jobject)> SurfaceCreatedCB; |
| 23 typedef base::Callback<void(int)> SurfaceDestroyedCB; |
| 24 |
| 25 ExternalVideoSurfaceContainerImpl(content::WebContents* contents); |
| 26 |
| 27 // ExternalVideoSurfaceContainer implementation. |
| 28 virtual void RequestExternalVideoSurface( |
| 29 int player_id, |
| 30 const SurfaceCreatedCB& surface_created_cb, |
| 31 const SurfaceDestroyedCB& surface_destroyed_cb) OVERRIDE; |
| 32 virtual void ReleaseExternalVideoSurface(int player_id) OVERRIDE; |
| 33 virtual void OnFrameInfoUpdated() OVERRIDE; |
| 34 virtual void OnExternalVideoSurfacePositionChanged( |
| 35 int player_id, const gfx::RectF& rect) OVERRIDE; |
| 36 |
| 37 // Methods called from Java. |
| 38 void SurfaceCreated( |
| 39 JNIEnv* env, jobject obj, jint player_id, jobject jsurface); |
| 40 void SurfaceDestroyed(JNIEnv* env, jobject obj, jint player_id); |
| 41 |
| 42 private: |
| 43 virtual ~ExternalVideoSurfaceContainerImpl(); |
| 44 |
| 45 base::android::ScopedJavaGlobalRef<jobject> jobject_; |
| 46 |
| 47 SurfaceCreatedCB surface_created_cb_; |
| 48 SurfaceDestroyedCB surface_destroyed_cb_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceContainerImpl); |
| 51 }; |
| 52 |
| 53 bool RegisterExternalVideoSurfaceContainer(JNIEnv* env); |
| 54 |
| 55 } // namespace android_webview |
| 56 |
| 57 #endif // ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ |
OLD | NEW |