Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_OVERLAY_INFO_H_ | 5 #ifndef MEDIA_BASE_OVERLAY_INFO_H_ |
| 6 #define MEDIA_BASE_OVERLAY_INFO_H_ | 6 #define MEDIA_BASE_OVERLAY_INFO_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 "base/optional.h" | 10 #include "base/optional.h" |
| 11 #include "base/unguessable_token.h" | 11 #include "base/unguessable_token.h" |
| 12 #include "media/base/media_export.h" | |
| 13 #include "media/base/surface_manager.h" | |
|
tguilbert
2017/05/24 22:47:58
Remove surface_manager.h?
liberato (no reviews please)
2017/05/25 05:42:49
Done.
| |
| 12 | 14 |
| 13 namespace media { | 15 namespace media { |
| 14 | 16 |
| 17 struct MEDIA_EXPORT OverlayInfo { | |
| 18 OverlayInfo(); | |
| 19 OverlayInfo(const OverlayInfo&); | |
| 20 | |
| 21 static OverlayInfo SurfaceChange(int surface_id); | |
|
tguilbert
2017/05/24 22:47:58
I assume these will be used somewhere at some poin
liberato (no reviews please)
2017/05/25 05:42:49
wmpi was going to use them, but i guess it doesn't
| |
| 22 static OverlayInfo RoutingTokenChange( | |
| 23 base::Optional<base::UnguessableToken> token); | |
| 24 static OverlayInfo FullscreenChange(bool is_fullscreen); | |
| 25 | |
| 26 // Copy all values specified in |other| into |this|, and leave unchanged any | |
| 27 // that |other| doesn't specify. | |
| 28 void MergeWith(const OverlayInfo& other); | |
| 29 | |
| 30 // An unset routing token indicates "do not use any routing token". A null | |
| 31 // routing token isn't serializable, else we'd probably use that instead. | |
| 32 using RoutingToken = base::Optional<base::UnguessableToken>; | |
| 33 | |
| 34 // If any of these are not provided, then the intention is that this message | |
| 35 // does not make any claims about them. For example, one might receive an | |
| 36 // OverlayInfo with |routing_token| supplied, then a later one with | |
| 37 // |is_fullscreen| supplied. The first message makes no claims about whether | |
| 38 // one is in fullscreen or not. The second one does not provide any update | |
| 39 // to the routing token. | |
| 40 | |
| 41 // Of course, one message may specify more than one of these. | |
| 42 | |
| 43 // If provided, this is the SurfaceManager surface id, or | |
| 44 // SurfaceManager:;kNoSurfaceID to indicate that no surface should be used. | |
|
tguilbert
2017/05/24 22:47:58
NIT: Typo. s/:;/::
liberato (no reviews please)
2017/05/25 05:42:49
Done.
| |
| 45 base::Optional<int> surface_id; | |
| 46 | |
| 47 // If provided, the mojo AndroidOverlay routing token or "use no token" if | |
| 48 // !(*routing_token). Note the extra indirection; |routing_token| is, itself, | |
| 49 // a base::Optional. | |
| 50 base::Optional<RoutingToken> routing_token; | |
| 51 | |
| 52 // If provided, indicates whether we're in fullscreen mode or not. | |
| 53 base::Optional<bool> is_fullscreen; | |
| 54 | |
| 55 // NOTE: if one adds any other members, then be sure to update MergeWith to | |
| 56 // copy them as well. | |
| 57 | |
| 58 // Convenience functions to return true if and only if this specifies a | |
| 59 // surface ID / routing token that is not kNoSurfaceID / empty. I.e., if we | |
| 60 // provide enough info to create an overlay. | |
| 61 bool HasValidSurfaceId() const; | |
| 62 bool HasValidRoutingToken() const; | |
| 63 }; | |
| 64 | |
| 15 // Request information to construct an overlay. This can be either a surface_id | 65 // Request information to construct an overlay. This can be either a surface_id |
| 16 // or an AndroidOverlay routing token. | 66 // or an AndroidOverlay routing token. |
| 17 using ProvideOverlayInfoCB = | 67 using ProvideOverlayInfoCB = base::Callback<void(const OverlayInfo&)>; |
| 18 base::Callback<void(int, const base::Optional<base::UnguessableToken>&)>; | |
| 19 using RequestOverlayInfoCB = | 68 using RequestOverlayInfoCB = |
| 20 base::Callback<void(bool, const ProvideOverlayInfoCB&)>; | 69 base::Callback<void(bool, const ProvideOverlayInfoCB&)>; |
| 21 | 70 |
| 22 } // namespace media | 71 } // namespace media |
| 23 | 72 |
| 24 #endif // MEDIA_BASE_OVERLAY_INFO_H_ | 73 #endif // MEDIA_BASE_OVERLAY_INFO_H_ |
| OLD | NEW |