| 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 "chrome/browser/media/router/media_sink.h" | 8 #include "chrome/browser/media/router/media_sink.h" |
| 9 #include "net/base/ip_address.h" | 9 #include "net/base/ip_address.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 namespace media_router { | 12 namespace media_router { |
| 13 | 13 |
| 14 // Extra data for DIAL media sink. | 14 // Extra data for DIAL media sink. |
| 15 struct DialSinkExtraData { | 15 struct DialSinkExtraData { |
| 16 net::IPAddress ip_address; | 16 net::IPAddress ip_address; |
| 17 | 17 |
| 18 // Model name of the sink. | 18 // Model name of the sink. |
| 19 std::string model_name; | 19 std::string model_name; |
| 20 | 20 |
| 21 // The base URL used for DIAL operations. | 21 // The base URL used for DIAL operations. |
| 22 GURL app_url; | 22 GURL app_url; |
| 23 | 23 |
| 24 DialSinkExtraData(); | 24 DialSinkExtraData(); |
| 25 DialSinkExtraData(const DialSinkExtraData& other); | 25 DialSinkExtraData(const DialSinkExtraData& other); |
| 26 ~DialSinkExtraData(); | 26 ~DialSinkExtraData(); |
| 27 |
| 28 bool operator==(const DialSinkExtraData& other) const; |
| 27 }; | 29 }; |
| 28 | 30 |
| 29 // Extra data for cast media sink. | 31 // Extra data for cast media sink. |
| 30 struct CastSinkExtraData { | 32 struct CastSinkExtraData { |
| 31 net::IPAddress ip_address; | 33 net::IPAddress ip_address; |
| 32 | 34 |
| 33 // Model name of the sink. | 35 // Model name of the sink. |
| 34 std::string model_name; | 36 std::string model_name; |
| 35 | 37 |
| 36 // A bit vector representing the capabilities of the sink. The values are | 38 // A bit vector representing the capabilities of the sink. The values are |
| 37 // defined in media_router.mojom. | 39 // defined in media_router.mojom. |
| 38 int capabilities = 0; | 40 int capabilities = 0; |
| 39 | 41 |
| 40 // ID of Cast channel opened for the sink. The caller must set this value to a | 42 // ID of Cast channel opened for the sink. The caller must set this value to a |
| 41 // valid cast_channel_id. The cast_channel_id may change over time as the | 43 // valid cast_channel_id. The cast_channel_id may change over time as the |
| 42 // browser reconnects to a device. | 44 // browser reconnects to a device. |
| 43 int cast_channel_id = 0; | 45 int cast_channel_id = 0; |
| 44 | 46 |
| 45 CastSinkExtraData(); | 47 CastSinkExtraData(); |
| 46 CastSinkExtraData(const CastSinkExtraData& other); | 48 CastSinkExtraData(const CastSinkExtraData& other); |
| 47 ~CastSinkExtraData(); | 49 ~CastSinkExtraData(); |
| 50 |
| 51 bool operator==(const CastSinkExtraData& other) const; |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 // Represents a media sink discovered by MediaSinkService. It is used by | 54 // Represents a media sink discovered by MediaSinkService. It is used by |
| 51 // MediaSinkService to push MediaSinks with extra data to the | 55 // MediaSinkService to push MediaSinks with extra data to the |
| 52 // MediaRouteProvider, and it is not exposed to users of MediaRouter. | 56 // MediaRouteProvider, and it is not exposed to users of MediaRouter. |
| 53 class MediaSinkInternal { | 57 class MediaSinkInternal { |
| 54 public: | 58 public: |
| 55 // Used by mojo. | 59 // Used by mojo. |
| 56 MediaSinkInternal(); | 60 MediaSinkInternal(); |
| 57 | 61 |
| 58 // Used by unit test. | 62 // Used by unit test. |
| 59 explicit MediaSinkInternal(const MediaSink& sink); | 63 explicit MediaSinkInternal(const MediaSink& sink); |
| 60 | 64 |
| 61 // Used by MediaSinkService to create media sinks. | 65 // Used by MediaSinkService to create media sinks. |
| 62 MediaSinkInternal(const MediaSink& sink, const DialSinkExtraData& dial_data); | 66 MediaSinkInternal(const MediaSink& sink, const DialSinkExtraData& dial_data); |
| 63 MediaSinkInternal(const MediaSink& sink, const CastSinkExtraData& cast_data); | 67 MediaSinkInternal(const MediaSink& sink, const CastSinkExtraData& cast_data); |
| 64 | 68 |
| 65 // Used to push instance of this class into vector. | 69 // Used to push instance of this class into vector. |
| 66 MediaSinkInternal(const MediaSinkInternal& other); | 70 MediaSinkInternal(const MediaSinkInternal& other); |
| 67 | 71 |
| 68 ~MediaSinkInternal(); | 72 ~MediaSinkInternal(); |
| 69 | 73 |
| 70 MediaSinkInternal& operator=(const MediaSinkInternal& other); | 74 MediaSinkInternal& operator=(const MediaSinkInternal& other); |
| 71 | 75 |
| 76 bool operator==(const MediaSinkInternal& other) const; |
| 77 |
| 72 void set_sink(const MediaSink& sink); | 78 void set_sink(const MediaSink& sink); |
| 73 const MediaSink& sink() const { return sink_; } | 79 const MediaSink& sink() const { return sink_; } |
| 74 | 80 |
| 75 void set_dial_data(const DialSinkExtraData& dial_data); | 81 void set_dial_data(const DialSinkExtraData& dial_data); |
| 76 | 82 |
| 77 // Must only be called if the sink is a DIAL sink. | 83 // Must only be called if the sink is a DIAL sink. |
| 78 const DialSinkExtraData& dial_data() const; | 84 const DialSinkExtraData& dial_data() const; |
| 79 | 85 |
| 80 void set_cast_data(const CastSinkExtraData& cast_data); | 86 void set_cast_data(const CastSinkExtraData& cast_data); |
| 81 | 87 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 93 // Set if sink is DIAL sink. | 99 // Set if sink is DIAL sink. |
| 94 base::Optional<DialSinkExtraData> dial_data_; | 100 base::Optional<DialSinkExtraData> dial_data_; |
| 95 | 101 |
| 96 // Set if sink is Cast sink. | 102 // Set if sink is Cast sink. |
| 97 base::Optional<CastSinkExtraData> cast_data_; | 103 base::Optional<CastSinkExtraData> cast_data_; |
| 98 }; | 104 }; |
| 99 | 105 |
| 100 } // namespace media_router | 106 } // namespace media_router |
| 101 | 107 |
| 102 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ | 108 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MEDIA_SINK_INTERNAL_H_ |
| OLD | NEW |