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