OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MEDIA_BASE_SURFACE_MANAGER_H_ | 5 #ifndef MEDIA_BASE_SURFACE_MANAGER_H_ |
6 #define MEDIA_BASE_SURFACE_MANAGER_H_ | 6 #define MEDIA_BASE_SURFACE_MANAGER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 using SurfaceCreatedCB = base::Callback<void(int)>; | 15 using SurfaceCreatedCB = base::Callback<void(int)>; |
16 using RequestSurfaceCB = base::Callback<void(const SurfaceCreatedCB&)>; | 16 using RequestSurfaceCB = base::Callback<void(bool, const SurfaceCreatedCB&)>; |
17 | 17 |
18 class MEDIA_EXPORT SurfaceManager { | 18 class MEDIA_EXPORT SurfaceManager { |
19 public: | 19 public: |
20 enum { kNoSurfaceID = -1 }; | 20 enum { kNoSurfaceID = -1 }; |
21 | 21 |
22 SurfaceManager() {} | 22 SurfaceManager() {} |
23 virtual ~SurfaceManager() {} | 23 virtual ~SurfaceManager() {} |
24 | 24 |
25 // Create a fullscreen surface. The id will be returned with | 25 // Create a fullscreen surface. The id will be returned with |
26 // |surface_created_cb|. If this is called more than once before the first | 26 // |surface_created_cb|. If this is called more than once before the first |
27 // |surface_created_cb| is called, the surface will be delivered to the last | 27 // |surface_created_cb| is called, the surface will be delivered to the last |
28 // caller. If this is called after the fullscreen surface is created, the | 28 // caller. If this is called after the fullscreen surface is created, the |
29 // existing surface will be returned. The client should ensure that the | 29 // existing surface will be returned. The client should ensure that the |
30 // previous consumer is no longer using the surface. | 30 // previous consumer is no longer using the surface. |
31 virtual void CreateFullscreenSurface( | 31 virtual void CreateFullscreenSurface( |
32 const gfx::Size& video_natural_size, | 32 const gfx::Size& video_natural_size, |
33 const SurfaceCreatedCB& surface_created_cb) = 0; | 33 const SurfaceCreatedCB& surface_created_cb) = 0; |
34 | 34 |
35 // Call this when the natural size of the fullscreen video changes. The | 35 // Call this when the natural size of the fullscreen video changes. The |
36 // surface will be resized to match the aspect ratio. | 36 // surface will be resized to match the aspect ratio. |
37 virtual void NaturalSizeChanged(const gfx::Size& size) = 0; | 37 virtual void NaturalSizeChanged(const gfx::Size& size) = 0; |
38 | 38 |
39 private: | 39 private: |
40 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 40 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
41 }; | 41 }; |
42 | 42 |
43 } // namespace media | 43 } // namespace media |
44 | 44 |
45 #endif // MEDIA_BASE_SURFACE_MANAGER_H_ | 45 #endif // MEDIA_BASE_SURFACE_MANAGER_H_ |
OLD | NEW |