Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3697)

Unified Diff: chrome/browser/media/router/media_sink.h

Issue 2675033002: [Media Router] Add MediaSink subtypes (Closed)
Patch Set: resolve code review comments from Derek Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/media/router/dial_media_sink.cc ('k') | chrome/browser/media/router/media_sink.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c4ce64000347eadaa1bbec876639feff9db333e5 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,41 @@ 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 {
+ DIAL, // DialMediaSink
+ CAST, // CastMediaSink
+ GENERIC
+ };
+
MediaSink(const MediaSink::Id& sink_id,
const std::string& name,
const IconType icon_type);
MediaSink(const MediaSink& other);
- ~MediaSink();
+ virtual ~MediaSink();
+ SinkType type() const { return type_; }
imcheng 2017/02/09 02:19:57 We should make this method virtual, and return GEN
const MediaSink::Id& id() const { return sink_id_; }
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_; }
IconType icon_type() const { return icon_type_; }
+ void set_model_name(const std::string& model_name) {
+ 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 +82,15 @@ class MediaSink {
}
};
+ protected:
+ 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 +98,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_;
};
} // namespace media_router
« no previous file with comments | « chrome/browser/media/router/dial_media_sink.cc ('k') | chrome/browser/media/router/media_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698