| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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 "chrome/browser/media/router/media_route.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "chrome/browser/media/router/media_controller.h" |
| 9 #include "chrome/browser/media/router/media_source.h" |
| 10 |
| 11 namespace media_router { |
| 12 |
| 13 const RouteRequestId kInvalidRouteRequestId = -1; |
| 14 |
| 15 MediaRoute::MediaRoute(const MediaRouteId& media_route_id, |
| 16 const MediaSource& media_source, |
| 17 const MediaSinkId& sink_id, |
| 18 const std::string& description, |
| 19 bool is_local) |
| 20 : media_route_id_(media_route_id), |
| 21 media_source_(media_source), |
| 22 sink_id_(sink_id), |
| 23 description_(description), |
| 24 is_local_(is_local), |
| 25 state_(MEDIA_ROUTE_STATE_NEW) { |
| 26 } |
| 27 |
| 28 MediaRoute::~MediaRoute() { |
| 29 } |
| 30 |
| 31 bool MediaRoute::operator==(const MediaRoute& other) const { |
| 32 return media_route_id_ == other.media_route_id_ && |
| 33 media_source_ == other.media_source_ && |
| 34 sink_id_ == sink_id_ && |
| 35 description_ == other.description_ && |
| 36 is_local_ == other.is_local_ && |
| 37 state_ == other.state_; |
| 38 } |
| 39 |
| 40 bool MediaRoute::operator!=(const MediaRoute& other) const { |
| 41 return !(*this == other); |
| 42 } |
| 43 |
| 44 // static |
| 45 scoped_ptr<MediaRouteResponse> MediaRouteResponse::Success( |
| 46 const RouteRequestId& request_id, const MediaRoute& route) { |
| 47 return make_scoped_ptr(new MediaRouteResponse(request_id, route)); |
| 48 } |
| 49 |
| 50 // static |
| 51 scoped_ptr<MediaRouteResponse> MediaRouteResponse::Error( |
| 52 const RouteRequestId& request_id, const std::string& error) { |
| 53 return make_scoped_ptr(new MediaRouteResponse(request_id, error)); |
| 54 } |
| 55 |
| 56 MediaRouteResponse::~MediaRouteResponse() { |
| 57 } |
| 58 |
| 59 MediaRouteResponse::MediaRouteResponse( |
| 60 const RouteRequestId& request_id, const MediaRoute& route) |
| 61 : request_id_(request_id), route_(new MediaRoute(route)) { |
| 62 } |
| 63 |
| 64 MediaRouteResponse::MediaRouteResponse( |
| 65 const RouteRequestId& request_id, const std::string& error) |
| 66 : request_id_(request_id), error_(error) { |
| 67 } |
| 68 |
| 69 MediaRouteResponse::MediaRouteResponse(const MediaRouteResponse& other) |
| 70 : request_id_(other.request_id_), error_(other.error_) { |
| 71 if (other.route_.get()) |
| 72 route_.reset(new MediaRoute(*other.route_)); |
| 73 } |
| 74 |
| 75 } // namespace media_router |
| OLD | NEW |