| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/base/overlay_info.h" |
| 6 #include "media/base/surface_manager.h" |
| 7 |
| 8 namespace media { |
| 9 |
| 10 OverlayInfo::OverlayInfo() = default; |
| 11 OverlayInfo::OverlayInfo(const OverlayInfo&) = default; |
| 12 |
| 13 // static |
| 14 OverlayInfo OverlayInfo::SurfaceChange(int surface_id) { |
| 15 OverlayInfo info; |
| 16 info.surface_id = surface_id; |
| 17 return info; |
| 18 } |
| 19 |
| 20 // static |
| 21 OverlayInfo OverlayInfo::RoutingTokenChange( |
| 22 base::Optional<base::UnguessableToken> token) { |
| 23 OverlayInfo info; |
| 24 info.routing_token = token; |
| 25 return info; |
| 26 } |
| 27 |
| 28 // static |
| 29 OverlayInfo OverlayInfo::FullscreenChange(bool is_fullscreen) { |
| 30 OverlayInfo info; |
| 31 info.is_fullscreen = is_fullscreen; |
| 32 return info; |
| 33 } |
| 34 |
| 35 void OverlayInfo::MergeWith(const OverlayInfo& other) { |
| 36 if (other.surface_id) |
| 37 surface_id = other.surface_id; |
| 38 if (other.routing_token) |
| 39 routing_token = other.routing_token; |
| 40 if (other.is_fullscreen) |
| 41 is_fullscreen = other.is_fullscreen; |
| 42 } |
| 43 |
| 44 bool OverlayInfo::HasValidSurfaceId() const { |
| 45 return surface_id && *surface_id != SurfaceManager::kNoSurfaceID; |
| 46 } |
| 47 |
| 48 bool OverlayInfo::HasValidRoutingToken() const { |
| 49 return routing_token && *routing_token; |
| 50 } |
| 51 |
| 52 } // namespace media |
| OLD | NEW |