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