| Index: chrome/browser/media/router/typed_media_sink.cc
|
| diff --git a/chrome/browser/media/router/typed_media_sink.cc b/chrome/browser/media/router/typed_media_sink.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..859500a6f021f1eb53a4f6aae102ce0c2ac91571
|
| --- /dev/null
|
| +++ b/chrome/browser/media/router/typed_media_sink.cc
|
| @@ -0,0 +1,58 @@
|
| +// 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 "chrome/browser/media/router/typed_media_sink.h"
|
| +
|
| +#include "base/logging.h"
|
| +
|
| +namespace media_router {
|
| +
|
| +TypedMediaSink::TypedMediaSink(const MediaSink& sink,
|
| + const DialSinkExtraData& dial_data)
|
| + : sink_(sink), type_(SinkType::DIAL), dial_data_(dial_data) {}
|
| +
|
| +TypedMediaSink::TypedMediaSink(const MediaSink& sink,
|
| + const CastSinkExtraData& cast_data)
|
| + : sink_(sink), type_(SinkType::CAST), cast_data_(cast_data) {}
|
| +
|
| +TypedMediaSink::TypedMediaSink()
|
| + : type_(SinkType::UNKNOWN), dial_data_(DialSinkExtraData()) {}
|
| +
|
| +TypedMediaSink::~TypedMediaSink() {}
|
| +
|
| +TypedMediaSink& TypedMediaSink::operator=(const TypedMediaSink& other) {
|
| + sink_ = other.sink_;
|
| + ip_address_ = other.ip_address_;
|
| + model_name_ = other.model_name_;
|
| + type_ = other.type_;
|
| +
|
| + if (other.is_dial_sink())
|
| + dial_data_ = other.dial_data_;
|
| + if (other.is_cast_sink())
|
| + cast_data_ = other.cast_data_;
|
| +
|
| + return *this;
|
| +}
|
| +
|
| +void TypedMediaSink::set_dial_data(const DialSinkExtraData& dial_data) {
|
| + type_ = SinkType::DIAL;
|
| + dial_data_ = dial_data;
|
| +}
|
| +
|
| +const DialSinkExtraData& TypedMediaSink::dial_data() const {
|
| + DCHECK(is_dial_sink());
|
| + return dial_data_;
|
| +}
|
| +
|
| +void TypedMediaSink::set_cast_data(const CastSinkExtraData& cast_data) {
|
| + type_ = SinkType::CAST;
|
| + cast_data_ = cast_data;
|
| +}
|
| +
|
| +const CastSinkExtraData& TypedMediaSink::cast_data() const {
|
| + DCHECK(is_cast_sink());
|
| + return cast_data_;
|
| +}
|
| +
|
| +} // namespace media_router
|
|
|