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" | |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 | 15 |
| 16 struct MEDIA_EXPORT OverlayInfo { | |
| 17 OverlayInfo(); | |
| 18 OverlayInfo(const OverlayInfo&); | |
| 19 | |
| 20 // Copy all values specified in |other| into |this|, and leave unchanged any | |
| 21 // that |other| doesn't specify. | |
| 22 void MergeWith(const OverlayInfo& other); | |
| 23 | |
| 24 // An unset routing token indicates "do not use any routing token". A null | |
| 25 // routing token isn't serializable, else we'd probably use that instead. | |
| 26 using RoutingToken = base::Optional<base::UnguessableToken>; | |
|
watk
2017/05/25 18:09:35
Move to the top.
From the style guide:
Within ea
liberato (no reviews please)
2017/05/25 21:26:56
Done.
| |
| 27 | |
| 28 // If any of these are not provided, then the intention is that this message | |
| 29 // does not make any claims about them. For example, one might receive an | |
| 30 // OverlayInfo with |routing_token| supplied, then a later one with | |
| 31 // |is_fullscreen| supplied. The first message makes no claims about whether | |
| 32 // one is in fullscreen or not. The second one does not provide any update | |
| 33 // to the routing token. | |
| 34 | |
| 35 // Of course, one message may specify more than one of these. | |
| 36 | |
| 37 // If provided, this is the SurfaceManager surface id, or | |
| 38 // SurfaceManager::kNoSurfaceID to indicate that no surface should be used. | |
| 39 base::Optional<int> surface_id; | |
| 40 | |
| 41 // If provided, the mojo AndroidOverlay routing token or "use no token" if | |
| 42 // !(*routing_token). Note the extra indirection; |routing_token| is, itself, | |
| 43 // a base::Optional. | |
| 44 base::Optional<RoutingToken> routing_token; | |
| 45 | |
| 46 // If provided, indicates whether we're in fullscreen mode or not. | |
| 47 base::Optional<bool> is_fullscreen; | |
| 48 | |
| 49 // NOTE: if one adds any other members, then be sure to update MergeWith to | |
| 50 // copy them as well. Also add a test to overlay_info_unittest. | |
| 51 | |
| 52 // Convenience functions to return true if and only if this specifies a | |
| 53 // surface ID / routing token that is not kNoSurfaceID / empty. I.e., if we | |
| 54 // provide enough info to create an overlay. | |
| 55 bool HasValidSurfaceId() const; | |
|
watk
2017/05/25 18:09:35
Move above member variables
liberato (no reviews please)
2017/05/25 21:26:56
Done.
| |
| 56 bool HasValidRoutingToken() const; | |
| 57 }; | |
| 58 | |
| 15 // Request information to construct an overlay. This can be either a surface_id | 59 // Request information to construct an overlay. This can be either a surface_id |
| 16 // or an AndroidOverlay routing token. | 60 // or an AndroidOverlay routing token. |
|
watk
2017/05/25 18:09:35
Second sentence out of date (mostly)
liberato (no reviews please)
2017/05/25 21:26:56
Done.
| |
| 17 using ProvideOverlayInfoCB = | 61 using ProvideOverlayInfoCB = base::Callback<void(const OverlayInfo&)>; |
| 18 base::Callback<void(int, const base::Optional<base::UnguessableToken>&)>; | |
| 19 using RequestOverlayInfoCB = | 62 using RequestOverlayInfoCB = |
| 20 base::Callback<void(bool, const ProvideOverlayInfoCB&)>; | 63 base::Callback<void(bool, const ProvideOverlayInfoCB&)>; |
| 21 | 64 |
| 22 } // namespace media | 65 } // namespace media |
| 23 | 66 |
| 24 #endif // MEDIA_BASE_OVERLAY_INFO_H_ | 67 #endif // MEDIA_BASE_OVERLAY_INFO_H_ |
| OLD | NEW |