| Index: chrome/browser/media/router/media_route.cc
|
| diff --git a/chrome/browser/media/router/media_route.cc b/chrome/browser/media/router/media_route.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7fc5be68b9e430bcf4f357b7dc470a3611704b04
|
| --- /dev/null
|
| +++ b/chrome/browser/media/router/media_route.cc
|
| @@ -0,0 +1,75 @@
|
| +// Copyright 2014 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/media_route.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "chrome/browser/media/router/media_controller.h"
|
| +#include "chrome/browser/media/router/media_source.h"
|
| +
|
| +namespace media_router {
|
| +
|
| +const RouteRequestId kInvalidRouteRequestId = -1;
|
| +
|
| +MediaRoute::MediaRoute(const MediaRouteId& media_route_id,
|
| + const MediaSource& media_source,
|
| + const MediaSinkId& sink_id,
|
| + const std::string& description,
|
| + bool is_local)
|
| + : media_route_id_(media_route_id),
|
| + media_source_(media_source),
|
| + sink_id_(sink_id),
|
| + description_(description),
|
| + is_local_(is_local),
|
| + state_(MEDIA_ROUTE_STATE_NEW) {
|
| +}
|
| +
|
| +MediaRoute::~MediaRoute() {
|
| +}
|
| +
|
| +bool MediaRoute::operator==(const MediaRoute& other) const {
|
| + return media_route_id_ == other.media_route_id_ &&
|
| + media_source_ == other.media_source_ &&
|
| + sink_id_ == sink_id_ &&
|
| + description_ == other.description_ &&
|
| + is_local_ == other.is_local_ &&
|
| + state_ == other.state_;
|
| +}
|
| +
|
| +bool MediaRoute::operator!=(const MediaRoute& other) const {
|
| + return !(*this == other);
|
| +}
|
| +
|
| +// static
|
| +scoped_ptr<MediaRouteResponse> MediaRouteResponse::Success(
|
| + const RouteRequestId& request_id, const MediaRoute& route) {
|
| + return make_scoped_ptr(new MediaRouteResponse(request_id, route));
|
| +}
|
| +
|
| +// static
|
| +scoped_ptr<MediaRouteResponse> MediaRouteResponse::Error(
|
| + const RouteRequestId& request_id, const std::string& error) {
|
| + return make_scoped_ptr(new MediaRouteResponse(request_id, error));
|
| +}
|
| +
|
| +MediaRouteResponse::~MediaRouteResponse() {
|
| +}
|
| +
|
| +MediaRouteResponse::MediaRouteResponse(
|
| + const RouteRequestId& request_id, const MediaRoute& route)
|
| + : request_id_(request_id), route_(new MediaRoute(route)) {
|
| +}
|
| +
|
| +MediaRouteResponse::MediaRouteResponse(
|
| + const RouteRequestId& request_id, const std::string& error)
|
| + : request_id_(request_id), error_(error) {
|
| +}
|
| +
|
| +MediaRouteResponse::MediaRouteResponse(const MediaRouteResponse& other)
|
| + : request_id_(other.request_id_), error_(other.error_) {
|
| + if (other.route_.get())
|
| + route_.reset(new MediaRoute(*other.route_));
|
| +}
|
| +
|
| +} // namespace media_router
|
|
|