| 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 "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 void set_domain(const std::string& domain) { domain_ = domain; } | 57 void set_domain(const std::string& domain) { domain_ = domain; } |
| 58 const base::Optional<std::string>& domain() const { return domain_; } | 58 const base::Optional<std::string>& domain() const { return domain_; } |
| 59 | 59 |
| 60 void set_icon_type(IconType icon_type) { icon_type_ = icon_type; } | 60 void set_icon_type(IconType icon_type) { icon_type_ = icon_type; } |
| 61 IconType icon_type() const { return icon_type_; } | 61 IconType icon_type() const { return icon_type_; } |
| 62 | 62 |
| 63 // This method only compares IDs. | 63 // This method only compares IDs. |
| 64 bool Equals(const MediaSink& other) const; | 64 bool Equals(const MediaSink& other) const; |
| 65 | 65 |
| 66 // This method compares all fields. |
| 67 bool operator==(const MediaSink& other) const; |
| 68 |
| 66 // Compares |this| to |other| first by their icon types, then their names | 69 // Compares |this| to |other| first by their icon types, then their names |
| 67 // using |collator|, and finally their IDs. | 70 // using |collator|, and finally their IDs. |
| 68 bool CompareUsingCollator(const MediaSink& other, | 71 bool CompareUsingCollator(const MediaSink& other, |
| 69 const icu::Collator* collator) const; | 72 const icu::Collator* collator) const; |
| 70 | 73 |
| 71 // For storing in sets and in maps as keys. | 74 // For storing in sets and in maps as keys. |
| 72 struct Compare { | 75 struct Compare { |
| 73 bool operator()(const MediaSink& sink1, const MediaSink& sink2) const { | 76 bool operator()(const MediaSink& sink1, const MediaSink& sink2) const { |
| 74 return sink1.id() < sink2.id(); | 77 return sink1.id() < sink2.id(); |
| 75 } | 78 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 // Optional domain of the MediaSink. | 91 // Optional domain of the MediaSink. |
| 89 base::Optional<std::string> domain_; | 92 base::Optional<std::string> domain_; |
| 90 | 93 |
| 91 // The type of icon that corresponds with the MediaSink. | 94 // The type of icon that corresponds with the MediaSink. |
| 92 IconType icon_type_ = IconType::GENERIC; | 95 IconType icon_type_ = IconType::GENERIC; |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 } // namespace media_router | 98 } // namespace media_router |
| 96 | 99 |
| 97 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ | 100 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_ |
| OLD | NEW |