Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_TYPED_MEDIA_SINK_H_ | |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_TYPED_MEDIA_SINK_H_ | |
| 7 | |
| 8 #include "chrome/browser/media/router/media_sink.h" | |
| 9 #include "url/gurl.h" | |
| 10 | |
| 11 namespace media_router { | |
| 12 | |
| 13 // Extra data for dial media sink. | |
| 14 struct DialSinkExtraData { | |
| 15 // The base URL used for DIAL operations. | |
| 16 GURL app_url; | |
| 17 }; | |
| 18 | |
| 19 // Extra data for cast media sink. | |
| 20 struct CastSinkExtraData { | |
| 21 // A bit vector representing the capabilities of the sink. | |
| 22 int capabilities; | |
|
imcheng
2017/02/11 01:00:22
= 0;
zhaobin
2017/02/14 02:08:49
Done.
| |
| 23 | |
| 24 // ID of Cast channel opened for the sink. | |
| 25 int cast_channel_id; | |
|
imcheng
2017/02/11 01:00:22
ditto
zhaobin
2017/02/14 02:08:49
Done.
| |
| 26 }; | |
| 27 | |
| 28 // Represents a media sink discovered by MediaSinkService. | |
|
imcheng
2017/02/11 01:00:22
Comment that this is only used by MediaSinkService
zhaobin
2017/02/14 02:08:49
Done.
| |
| 29 class TypedMediaSink { | |
| 30 public: | |
| 31 // SinkType indicates if sink is discovered by DIAL / CAST media sink | |
| 32 // services. | |
| 33 enum class SinkType { | |
| 34 UNKNOWN = 0, | |
| 35 DIAL, | |
| 36 CAST, | |
| 37 }; | |
| 38 | |
| 39 TypedMediaSink(const MediaSink::Id& sink_id, | |
|
imcheng
2017/02/11 01:00:22
How about these two ctors in addition to the empty
zhaobin
2017/02/14 02:08:49
Done.
| |
| 40 const std::string& name, | |
| 41 const MediaSink::IconType icon_type); | |
| 42 TypedMediaSink(); | |
| 43 ~TypedMediaSink(); | |
| 44 | |
| 45 TypedMediaSink& operator=(const TypedMediaSink& other); | |
| 46 | |
| 47 void set_sink(const MediaSink& sink) { sink_ = sink; } | |
| 48 const MediaSink& sink() const { return sink_; } | |
| 49 void set_ip_address(const std::string& ip_address) { | |
| 50 ip_address_ = ip_address; | |
| 51 } | |
| 52 const std::string& ip_address() const { return ip_address_; } | |
| 53 void set_model_name(const std::string& model_name) { | |
| 54 model_name_ = model_name; | |
| 55 } | |
| 56 const base::Optional<std::string>& model_name() const { return model_name_; } | |
| 57 | |
| 58 void set_dial_sink_extra_data(const DialSinkExtraData& dial_sink_extra_data); | |
| 59 const DialSinkExtraData* dial_sink_extra_data() const; | |
| 60 void set_cast_sink_extra_data(const CastSinkExtraData& cast_sink_extra_data); | |
| 61 const CastSinkExtraData* cast_sink_extra_data() const; | |
| 62 | |
| 63 bool is_dial_sink() const { return type_ == SinkType::DIAL; } | |
| 64 bool is_cast_sink() const { return type_ == SinkType::CAST; } | |
| 65 | |
| 66 private: | |
| 67 MediaSink sink_; | |
| 68 | |
| 69 std::string ip_address_; | |
| 70 | |
| 71 // Model name of the sink, if it represents a physical device. | |
| 72 base::Optional<std::string> model_name_; | |
| 73 | |
| 74 // Type of the MediaSink. | |
| 75 SinkType type_; | |
| 76 | |
| 77 union { | |
| 78 // Set this field if |type_| == DIAL. | |
| 79 DialSinkExtraData dial_sink_extra_data_; | |
| 80 // Set this field if |type_| == CAST. | |
| 81 CastSinkExtraData cast_sink_extra_data_; | |
| 82 }; | |
| 83 }; | |
| 84 | |
| 85 } // namespace media_router | |
| 86 | |
| 87 #endif // CHROME_BROWSER_MEDIA_ROUTER_TYPED_MEDIA_SINK_H_ | |
| OLD | NEW |