OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/media/router/discovery/media_sink_internal.h" | 5 #include "chrome/browser/media/router/discovery/media_sink_internal.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 | 9 |
10 namespace media_router { | 10 namespace media_router { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return *dial_data_ == *(other.dial_data_); | 57 return *dial_data_ == *(other.dial_data_); |
58 case SinkType::CAST: | 58 case SinkType::CAST: |
59 return *cast_data_ == *(other.cast_data_); | 59 return *cast_data_ == *(other.cast_data_); |
60 case SinkType::GENERIC: | 60 case SinkType::GENERIC: |
61 return true; | 61 return true; |
62 } | 62 } |
63 NOTREACHED(); | 63 NOTREACHED(); |
64 return false; | 64 return false; |
65 } | 65 } |
66 | 66 |
| 67 bool MediaSinkInternal::operator!=(const MediaSinkInternal& other) const { |
| 68 return !operator==(other); |
| 69 } |
| 70 |
| 71 bool MediaSinkInternal::operator<(const MediaSinkInternal& other) const { |
| 72 return sink_.id() < other.sink().id(); |
| 73 } |
| 74 |
67 void MediaSinkInternal::set_sink(const MediaSink& sink) { | 75 void MediaSinkInternal::set_sink(const MediaSink& sink) { |
68 sink_ = sink; | 76 sink_ = sink; |
69 } | 77 } |
70 | 78 |
71 void MediaSinkInternal::set_dial_data(const DialSinkExtraData& dial_data) { | 79 void MediaSinkInternal::set_dial_data(const DialSinkExtraData& dial_data) { |
72 DCHECK(sink_type_ != SinkType::CAST); | 80 DCHECK(sink_type_ != SinkType::CAST); |
73 InternalCleanup(); | 81 InternalCleanup(); |
74 | 82 |
75 sink_type_ = SinkType::DIAL; | 83 sink_type_ = SinkType::DIAL; |
76 dial_data_.Init(dial_data); | 84 dial_data_.Init(dial_data); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 CastSinkExtraData::CastSinkExtraData(const CastSinkExtraData& other) = default; | 174 CastSinkExtraData::CastSinkExtraData(const CastSinkExtraData& other) = default; |
167 CastSinkExtraData::~CastSinkExtraData() = default; | 175 CastSinkExtraData::~CastSinkExtraData() = default; |
168 | 176 |
169 bool CastSinkExtraData::operator==(const CastSinkExtraData& other) const { | 177 bool CastSinkExtraData::operator==(const CastSinkExtraData& other) const { |
170 return ip_address == other.ip_address && model_name == other.model_name && | 178 return ip_address == other.ip_address && model_name == other.model_name && |
171 capabilities == other.capabilities && | 179 capabilities == other.capabilities && |
172 cast_channel_id == other.cast_channel_id; | 180 cast_channel_id == other.cast_channel_id; |
173 } | 181 } |
174 | 182 |
175 } // namespace media_router | 183 } // namespace media_router |
OLD | NEW |