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 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/manual_constructor.h" | 10 #include "base/memory/manual_constructor.h" |
11 #include "chrome/browser/media/router/media_sink.h" | 11 #include "chrome/browser/media/router/media_sink.h" |
12 #include "net/base/ip_address.h" | 12 #include "net/base/ip_address.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace media_router { | 15 namespace media_router { |
16 | 16 |
17 // Extra data for DIAL media sink. | 17 // Extra data for DIAL media sink. |
18 struct DialSinkExtraData { | 18 struct DialSinkExtraData { |
19 net::IPAddress ip_address; | 19 net::IPAddress ip_address; |
20 | 20 |
21 // Model name of the sink. | 21 // Model name of the sink. |
22 std::string model_name; | 22 std::string model_name; |
23 | 23 |
24 // The base URL used for DIAL operations. | 24 // The base URL used for DIAL operations. |
25 GURL app_url; | 25 GURL app_url; |
26 | 26 |
27 DialSinkExtraData(); | 27 DialSinkExtraData(); |
| 28 // Used by unit tests. |
| 29 DialSinkExtraData(const std::string& ip_address, |
| 30 const std::string& model_name, |
| 31 const std::string& app_url); |
28 DialSinkExtraData(const DialSinkExtraData& other); | 32 DialSinkExtraData(const DialSinkExtraData& other); |
29 ~DialSinkExtraData(); | 33 ~DialSinkExtraData(); |
30 | 34 |
31 bool operator==(const DialSinkExtraData& other) const; | 35 bool operator==(const DialSinkExtraData& other) const; |
32 }; | 36 }; |
33 | 37 |
34 // Extra data for Cast media sink. | 38 // Extra data for Cast media sink. |
35 struct CastSinkExtraData { | 39 struct CastSinkExtraData { |
36 net::IPAddress ip_address; | 40 net::IPAddress ip_address; |
37 | 41 |
(...skipping 28 matching lines...) Expand all Loading... |
66 MediaSinkInternal(const MediaSink& sink, const DialSinkExtraData& dial_data); | 70 MediaSinkInternal(const MediaSink& sink, const DialSinkExtraData& dial_data); |
67 MediaSinkInternal(const MediaSink& sink, const CastSinkExtraData& cast_data); | 71 MediaSinkInternal(const MediaSink& sink, const CastSinkExtraData& cast_data); |
68 | 72 |
69 // Used to push instance of this class into vector. | 73 // Used to push instance of this class into vector. |
70 MediaSinkInternal(const MediaSinkInternal& other); | 74 MediaSinkInternal(const MediaSinkInternal& other); |
71 | 75 |
72 ~MediaSinkInternal(); | 76 ~MediaSinkInternal(); |
73 | 77 |
74 MediaSinkInternal& operator=(const MediaSinkInternal& other); | 78 MediaSinkInternal& operator=(const MediaSinkInternal& other); |
75 bool operator==(const MediaSinkInternal& other) const; | 79 bool operator==(const MediaSinkInternal& other) const; |
| 80 bool operator!=(const MediaSinkInternal& other) const; |
76 | 81 |
77 // Used by mojo. | 82 // Used by mojo. |
78 void set_sink_id(const MediaSink::Id& sink_id) { sink_.set_sink_id(sink_id); } | 83 void set_sink_id(const MediaSink::Id& sink_id) { sink_.set_sink_id(sink_id); } |
79 void set_name(const std::string& name) { sink_.set_name(name); } | 84 void set_name(const std::string& name) { sink_.set_name(name); } |
80 void set_description(const std::string& description) { | 85 void set_description(const std::string& description) { |
81 sink_.set_description(description); | 86 sink_.set_description(description); |
82 } | 87 } |
83 void set_domain(const std::string& domain) { sink_.set_domain(domain); } | 88 void set_domain(const std::string& domain) { sink_.set_domain(domain); } |
84 void set_icon_type(MediaSink::IconType icon_type) { | 89 void set_icon_type(MediaSink::IconType icon_type) { |
85 sink_.set_icon_type(icon_type); | 90 sink_.set_icon_type(icon_type); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 base::ManualConstructor<DialSinkExtraData> dial_data_; | 124 base::ManualConstructor<DialSinkExtraData> dial_data_; |
120 | 125 |
121 // Set if sink is Cast sink. | 126 // Set if sink is Cast sink. |
122 base::ManualConstructor<CastSinkExtraData> cast_data_; | 127 base::ManualConstructor<CastSinkExtraData> cast_data_; |
123 }; | 128 }; |
124 }; | 129 }; |
125 | 130 |
126 } // namespace media_router | 131 } // namespace media_router |
127 | 132 |
128 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ | 133 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ |
OLD | NEW |