Chromium Code Reviews| Index: chrome/browser/media/router/media_sink.h |
| diff --git a/chrome/browser/media/router/media_sink.h b/chrome/browser/media/router/media_sink.h |
| index e12b6b16f55de968635b3955b6f2484c8dfe3d5e..f0c211165b4fedb70b431b58ca9df8a292353c4f 100644 |
| --- a/chrome/browser/media/router/media_sink.h |
| +++ b/chrome/browser/media/router/media_sink.h |
| @@ -7,6 +7,7 @@ |
| #include <string> |
| +#include "base/optional.h" |
| #include "third_party/icu/source/common/unicode/uversion.h" |
| namespace U_ICU_NAMESPACE { |
| @@ -16,6 +17,7 @@ class Collator; |
| namespace media_router { |
| // Represents a sink to which media can be routed. |
| +// TODO(zhaobin): convert MediaSink into a struct. |
| class MediaSink { |
| public: |
| using Id = std::string; |
| @@ -31,24 +33,48 @@ class MediaSink { |
| GENERIC |
| }; |
| + // SinkType indicates if sink is discovered by DIAL / CAST / other (e.g. |
| + // cloud) media sink services. Each SinkType value, with the exception of |
| + // GENERIC, corresponds to a subtype of MediaSink. |
| + enum class SinkType { |
|
imcheng
2017/02/11 01:00:21
Can be removed.
zhaobin
2017/02/14 02:08:49
Done.
|
| + DIAL, // DialMediaSink |
| + CAST, // CastMediaSink |
| + GENERIC |
| + }; |
| + |
| MediaSink(const MediaSink::Id& sink_id, |
| const std::string& name, |
| const IconType icon_type); |
| + MediaSink(); |
| MediaSink(const MediaSink& other); |
| - ~MediaSink(); |
| + virtual ~MediaSink(); |
|
imcheng
2017/02/11 01:00:21
revert virtual
zhaobin
2017/02/14 02:08:49
Done.
|
| + SinkType type() const { return type_; } |
| + void set_sink_id(const MediaSink::Id& sink_id) { sink_id_ = sink_id; } |
| const MediaSink::Id& id() const { return sink_id_; } |
| + |
| + void set_name(const std::string& name) { name_ = name; } |
| const std::string& name() const { return name_; } |
| void set_description(const std::string& description) { |
| description_ = description; |
| } |
| - const std::string& description() const { return description_; } |
| + const base::Optional<std::string>& description() const { |
| + return description_; |
| + } |
| void set_domain(const std::string& domain) { domain_ = domain; } |
| - const std::string& domain() const { return domain_; } |
| + const base::Optional<std::string>& domain() const { return domain_; } |
| + void set_icon_type(IconType icon_type) { icon_type_ = icon_type; } |
| IconType icon_type() const { return icon_type_; } |
| + // void set_model_name(const std::string& model_name) { |
|
imcheng
2017/02/11 01:00:21
Remove
zhaobin
2017/02/14 02:08:48
Done.
|
| + // model_name_ = model_name; |
| + // } |
| + // const base::Optional<std::string>& model_name() const { return model_name_; |
| + // } |
| + |
| + // This method only compares IDs. |
| bool Equals(const MediaSink& other) const; |
| // Compares |this| to |other| first by their icon types, then their names |
| @@ -63,6 +89,15 @@ class MediaSink { |
| } |
| }; |
| + protected: |
|
imcheng
2017/02/11 01:00:21
Remove ctor and SinkType
zhaobin
2017/02/14 02:08:48
Done.
|
| + MediaSink(const MediaSink::Id& sink_id, |
| + const std::string& name, |
| + const IconType icon_type, |
| + const SinkType sink_type); |
| + |
| + // Type of the MediaSink. |
| + SinkType type_; |
| + |
| private: |
| // Unique identifier for the MediaSink. |
| MediaSink::Id sink_id_; |
| @@ -70,14 +105,15 @@ class MediaSink { |
| // Descriptive name of the MediaSink. |
| std::string name_; |
| - // Optional description of the MediaSink. |
| - std::string description_; |
| + base::Optional<std::string> description_; |
| - // Optional domain of the MediaSink. |
| - std::string domain_; |
| + base::Optional<std::string> domain_; |
| // The type of icon that corresponds with the MediaSink. |
| IconType icon_type_; |
| + |
| + // Model name of the sink, if it represents a physical device. |
| + base::Optional<std::string> model_name_; |
|
imcheng
2017/02/11 01:00:21
This can be removed as it is now in TypedMediaSink
zhaobin
2017/02/14 02:08:48
Done.
|
| }; |
| } // namespace media_router |