| Index: media/base/overlay_info.cc
|
| diff --git a/media/base/overlay_info.cc b/media/base/overlay_info.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4b4a17db7989de804e5a6f66e09f8b513d735e74
|
| --- /dev/null
|
| +++ b/media/base/overlay_info.cc
|
| @@ -0,0 +1,52 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "media/base/overlay_info.h"
|
| +#include "media/base/surface_manager.h"
|
| +
|
| +namespace media {
|
| +
|
| +OverlayInfo::OverlayInfo() = default;
|
| +OverlayInfo::OverlayInfo(const OverlayInfo&) = default;
|
| +
|
| +// static
|
| +OverlayInfo OverlayInfo::SurfaceChange(int surface_id) {
|
| + OverlayInfo info;
|
| + info.surface_id = surface_id;
|
| + return info;
|
| +}
|
| +
|
| +// static
|
| +OverlayInfo OverlayInfo::RoutingTokenChange(
|
| + base::Optional<base::UnguessableToken> token) {
|
| + OverlayInfo info;
|
| + info.routing_token = token;
|
| + return info;
|
| +}
|
| +
|
| +// static
|
| +OverlayInfo OverlayInfo::FullscreenChange(bool is_fullscreen) {
|
| + OverlayInfo info;
|
| + info.is_fullscreen = is_fullscreen;
|
| + return info;
|
| +}
|
| +
|
| +void OverlayInfo::MergeWith(const OverlayInfo& other) {
|
| + if (other.surface_id)
|
| + surface_id = other.surface_id;
|
| + if (other.routing_token)
|
| + routing_token = other.routing_token;
|
| + if (other.is_fullscreen)
|
| + is_fullscreen = other.is_fullscreen;
|
| +}
|
| +
|
| +bool OverlayInfo::HasValidSurfaceId() const {
|
| + return surface_id && *surface_id != SurfaceManager::kNoSurfaceID;
|
| +}
|
| +
|
| +bool OverlayInfo::HasValidRoutingToken() const {
|
| + return routing_token && *routing_token;
|
| +}
|
| +
|
| +} // namespace media
|
|
|