Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / android / external_video_surface_container.h
blob52aec1aed62c186093605014ad63e1d8c5af004a
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.
5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_
8 #include <jni.h>
10 #include "base/callback.h"
11 #include "content/common/content_export.h"
13 namespace gfx {
14 class RectF;
17 namespace content {
18 class WebContents;
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 static const int kInvalidPlayerId = -1;
27 // Called when a media player wants to request an external video surface.
28 // Whenever the surface is created and visible, |surface_created_cb| will be
29 // called. And whenever it is destroyed or invisible, |surface_destroyed_cb|
30 // will be called.
31 virtual void RequestExternalVideoSurface(
32 int player_id,
33 const SurfaceCreatedCB& surface_created_cb,
34 const SurfaceDestroyedCB& surface_destroyed_cb) = 0;
36 // Returns id of player currently using the external video surface.
37 // Returns kInvalidPlayerId if no player uses the surface.
38 virtual int GetCurrentPlayerId() = 0;
40 // Called when a media player wants to release a certain player's external
41 // video surface.
42 virtual void ReleaseExternalVideoSurface(int player_id) = 0;
44 // Called when the position and size of the video element which uses
45 // the external video surface is changed.
46 // |rect| contains the new position and size in css pixels.
47 virtual void OnExternalVideoSurfacePositionChanged(
48 int player_id, const gfx::RectF& rect) = 0;
50 // Called when the page that contains the video element is scrolled or zoomed.
51 virtual void OnFrameInfoUpdated() = 0;
53 virtual ~ExternalVideoSurfaceContainer() {}
56 } // namespace content
58 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_H_