| 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 CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class RectF; | 14 class RectF; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class WebContents; | 18 class WebContents; |
| 19 | 19 |
| 20 // An interface used for managing the video surface for the hole punching. | 20 // An interface used for managing the video surface for the hole punching. |
| 21 class CONTENT_EXPORT ExternalVideoSurfaceContainer { | 21 class CONTENT_EXPORT ExternalVideoSurfaceContainer { |
| 22 public: | 22 public: |
| 23 typedef base::Callback<void(int, jobject)> SurfaceCreatedCB; | 23 typedef base::Callback<void(int, jobject)> SurfaceCreatedCB; |
| 24 typedef base::Callback<void(int)> SurfaceDestroyedCB; | 24 typedef base::Callback<void(int)> SurfaceDestroyedCB; |
| 25 static const int kAnyPlayer = -2; |
| 25 | 26 |
| 26 // Called when a media player wants to request an external video surface. | 27 // Called when a media player wants to request an external video surface. |
| 27 // Whenever the surface is created and visible, |surface_created_cb| will be | 28 // Whenever the surface is created and visible, |surface_created_cb| will be |
| 28 // called. And whenever it is destroyed or invisible, |surface_destroyed_cb| | 29 // called. And whenever it is destroyed or invisible, |surface_destroyed_cb| |
| 29 // will be called. | 30 // will be called. |
| 30 virtual void RequestExternalVideoSurface( | 31 virtual void RequestExternalVideoSurface( |
| 31 int player_id, | 32 int player_id, |
| 32 const SurfaceCreatedCB& surface_created_cb, | 33 const SurfaceCreatedCB& surface_created_cb, |
| 33 const SurfaceDestroyedCB& surface_destroyed_cb) = 0; | 34 const SurfaceDestroyedCB& surface_destroyed_cb) = 0; |
| 34 | 35 |
| 35 // Called when a media player wants to release an external video surface. | 36 // Called when a media player wants to release an external video surface. |
| 36 virtual void ReleaseExternalVideoSurface(int player_id) = 0; | 37 virtual void ReleaseExternalVideoSurface(int player_id) = 0; |
| 37 | 38 |
| 38 // Called when the position and size of the video element which uses | 39 // Called when the position and size of the video element which uses |
| 39 // the external video surface is changed. | 40 // the external video surface is changed. |
| 40 // |rect| contains the new position and size in css pixels. | 41 // |rect| contains the new position and size in css pixels. |
| 41 virtual void OnExternalVideoSurfacePositionChanged( | 42 virtual void OnExternalVideoSurfacePositionChanged( |
| 42 int player_id, const gfx::RectF& rect) = 0; | 43 int player_id, const gfx::RectF& rect) = 0; |
| 43 | 44 |
| 44 // Called when the page that contains the video element is scrolled or zoomed. | 45 // Called when the page that contains the video element is scrolled or zoomed. |
| 45 virtual void OnFrameInfoUpdated() = 0; | 46 virtual void OnFrameInfoUpdated() = 0; |
| 46 | 47 |
| 47 virtual ~ExternalVideoSurfaceContainer() {} | 48 virtual ~ExternalVideoSurfaceContainer() {} |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace content | 51 } // namespace content |
| 51 | 52 |
| 52 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_ | 53 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_ |
| OLD | NEW |