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" | |
| 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); | |
| 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. | |
|
tguilbert
2017/05/24 19:14:54
NIT: I am not sure that I like this shorthand oper
liberato (no reviews please)
2017/05/24 21:21:07
| is commutative, but this is |= .
still, it's a
| |
| 28 OverlayInfo& operator|=(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. | |
| 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 | |
| 15 // Request information to construct an overlay. This can be either a surface_id | 56 // Request information to construct an overlay. This can be either a surface_id |
| 16 // or an AndroidOverlay routing token. | 57 // or an AndroidOverlay routing token. |
| 17 using ProvideOverlayInfoCB = | 58 using ProvideOverlayInfoCB = base::Callback<void(const OverlayInfo&)>; |
| 18 base::Callback<void(int, const base::Optional<base::UnguessableToken>&)>; | |
| 19 using RequestOverlayInfoCB = | 59 using RequestOverlayInfoCB = |
| 20 base::Callback<void(bool, const ProvideOverlayInfoCB&)>; | 60 base::Callback<void(bool, const ProvideOverlayInfoCB&)>; |
| 21 | 61 |
| 22 } // namespace media | 62 } // namespace media |
| 23 | 63 |
| 24 #endif // MEDIA_BASE_OVERLAY_INFO_H_ | 64 #endif // MEDIA_BASE_OVERLAY_INFO_H_ |
| OLD | NEW |