| 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 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "third_party/icu/source/common/unicode/uversion.h" | 10 #include "third_party/icu/source/common/unicode/uversion.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // The order must stay in sync with | 24 // The order must stay in sync with |
| 25 // chrome/browser/resources/media_router/media_router_data.js. | 25 // chrome/browser/resources/media_router/media_router_data.js. |
| 26 enum IconType { | 26 enum IconType { |
| 27 CAST, | 27 CAST, |
| 28 CAST_AUDIO_GROUP, | 28 CAST_AUDIO_GROUP, |
| 29 CAST_AUDIO, | 29 CAST_AUDIO, |
| 30 HANGOUT, | 30 HANGOUT, |
| 31 GENERIC | 31 GENERIC |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // SinkType indicates if sink is discovered by DIAL / CAST / other (e.g. |
| 35 // cloud) media sink services. Used by mojo. |
| 36 enum class SinkType { DIAL, CAST, GENERAL }; |
| 37 |
| 34 MediaSink(const MediaSink::Id& sink_id, | 38 MediaSink(const MediaSink::Id& sink_id, |
| 35 const std::string& name, | 39 const std::string& name, |
| 36 const IconType icon_type); | 40 const IconType icon_type); |
| 37 | 41 |
| 38 MediaSink(const MediaSink& other); | 42 MediaSink(const MediaSink& other); |
| 39 | 43 |
| 40 ~MediaSink(); | 44 ~MediaSink(); |
| 41 | 45 |
| 46 SinkType type() const { return type_; } |
| 42 const MediaSink::Id& id() const { return sink_id_; } | 47 const MediaSink::Id& id() const { return sink_id_; } |
| 43 const std::string& name() const { return name_; } | 48 const std::string& name() const { return name_; } |
| 44 void set_description(const std::string& description) { | 49 void set_description(const std::string& description) { |
| 45 description_ = description; | 50 description_ = description; |
| 46 } | 51 } |
| 47 const std::string& description() const { return description_; } | 52 const std::string& description() const { return description_; } |
| 48 void set_domain(const std::string& domain) { domain_ = domain; } | 53 void set_domain(const std::string& domain) { domain_ = domain; } |
| 49 const std::string& domain() const { return domain_; } | 54 const std::string& domain() const { return domain_; } |
| 50 IconType icon_type() const { return icon_type_; } | 55 IconType icon_type() const { return icon_type_; } |
| 56 void set_model_name(const std::string& model_name) { |
| 57 model_name_ = model_name; |
| 58 } |
| 59 const std::string& model_name() const { return model_name_; } |
| 51 | 60 |
| 52 bool Equals(const MediaSink& other) const; | 61 bool Equals(const MediaSink& other) const; |
| 53 | 62 |
| 54 // Compares |this| to |other| first by their icon types, then their names | 63 // Compares |this| to |other| first by their icon types, then their names |
| 55 // using |collator|, and finally their IDs. | 64 // using |collator|, and finally their IDs. |
| 56 bool CompareUsingCollator(const MediaSink& other, | 65 bool CompareUsingCollator(const MediaSink& other, |
| 57 const icu::Collator* collator) const; | 66 const icu::Collator* collator) const; |
| 58 | 67 |
| 59 // For storing in sets and in maps as keys. | 68 // For storing in sets and in maps as keys. |
| 60 struct Compare { | 69 struct Compare { |
| 61 bool operator()(const MediaSink& sink1, const MediaSink& sink2) const { | 70 bool operator()(const MediaSink& sink1, const MediaSink& sink2) const { |
| 62 return sink1.id() < sink2.id(); | 71 return sink1.id() < sink2.id(); |
| 63 } | 72 } |
| 64 }; | 73 }; |
| 65 | 74 |
| 75 protected: |
| 76 // Type of the MediaSink. |
| 77 SinkType type_; |
| 78 |
| 66 private: | 79 private: |
| 67 // Unique identifier for the MediaSink. | 80 // Unique identifier for the MediaSink. |
| 68 MediaSink::Id sink_id_; | 81 MediaSink::Id sink_id_; |
| 69 | 82 |
| 70 // Descriptive name of the MediaSink. | 83 // Descriptive name of the MediaSink. |
| 71 std::string name_; | 84 std::string name_; |
| 72 | 85 |
| 73 // Optional description of the MediaSink. | 86 // Optional description of the MediaSink. |
| 74 std::string description_; | 87 std::string description_; |
| 75 | 88 |
| 76 // Optional domain of the MediaSink. | 89 // Optional domain of the MediaSink. |
| 77 std::string domain_; | 90 std::string domain_; |
| 78 | 91 |
| 79 // The type of icon that corresponds with the MediaSink. | 92 // The type of icon that corresponds with the MediaSink. |
| 80 IconType icon_type_; | 93 IconType icon_type_; |
| 94 |
| 95 // Optional model name of the MediaSink. |
| 96 std::string model_name_; |
| 81 }; | 97 }; |
| 82 | 98 |
| 83 } // namespace media_router | 99 } // namespace media_router |
| 84 | 100 |
| 85 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ | 101 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ |
| OLD | NEW |