OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/media_source.h" | 5 #include "chrome/browser/media/router/media_source.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
| 9 #include "url/gurl.h" |
| 10 |
9 namespace media_router { | 11 namespace media_router { |
10 | 12 |
11 MediaSource::MediaSource(const MediaSource::Id& source_id) : id_(source_id) { | 13 MediaSource::MediaSource(const MediaSource::Id& source_id) : id_(source_id) { |
12 } | 14 } |
13 | 15 |
| 16 MediaSource::MediaSource(const GURL& presentation_url) |
| 17 : id_(presentation_url.spec()) {} |
| 18 |
14 MediaSource::~MediaSource() {} | 19 MediaSource::~MediaSource() {} |
15 | 20 |
16 MediaSource::Id MediaSource::id() const { | 21 MediaSource::Id MediaSource::id() const { |
17 return id_; | 22 return id_; |
18 } | 23 } |
19 | 24 |
20 bool MediaSource::operator==(const MediaSource& other) const { | 25 bool MediaSource::operator==(const MediaSource& other) const { |
21 return id_ == other.id(); | 26 return id_ == other.id(); |
22 } | 27 } |
23 | 28 |
24 std::string MediaSource::ToString() const { | 29 std::string MediaSource::ToString() const { |
25 return "MediaSource[" + id_ + "]"; | 30 return "MediaSource[" + id_ + "]"; |
26 } | 31 } |
27 | 32 |
28 } // namespace media_router | 33 } // namespace media_router |
OLD | NEW |