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

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

Issue 1020743003: [Media Router] Design MediaRouter interface with stub implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Kevin's comments Created 5 years, 9 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
Index: chrome/browser/media/router/media_source.h
diff --git a/chrome/browser/media/router/media_source.h b/chrome/browser/media/router/media_source.h
index d90497f2aef1dacda374321e798eaca9f4260179..70081be01d04d54867d9057ccfc23cf6ac37507e 100644
--- a/chrome/browser/media/router/media_source.h
+++ b/chrome/browser/media/router/media_source.h
@@ -5,20 +5,43 @@
#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
+#include <ostream>
#include <string>
namespace media_router {
+using MediaSourceId = std::string;
+
class MediaSource {
public:
- explicit MediaSource(const std::string& id);
+ explicit MediaSource(const MediaSourceId& id);
+ MediaSource();
~MediaSource();
// Gets the ID of the media source.
- std::string id() const;
+ MediaSourceId id() const;
+
+ // Returns true if two MediaSource objects use the same media ID.
+ bool Equals(const MediaSource& other) const;
+
+ // Returns true if a MediaSource is empty or uninitialized.
+ bool Empty() const;
+
+ // Stream output, used for logging.
+ friend std::ostream& operator<<(std::ostream& output,
+ const MediaSource& source);
xhwang 2015/04/02 17:13:03 Operator overloading is not recommended: https://g
imcheng 2015/04/02 23:05:24 Done.
private:
- std::string id_;
+ MediaSourceId id_;
xhwang 2015/04/02 17:13:03 Do we plan to add more members to MeidaSource? Can
imcheng 2015/04/02 23:05:24 It is possible that we will add more fields to Med
+};
+
+// Inequality comparison functor to provide map lookup capabilities for
+// MediaSource.
+class MediaSourceLess {
+ public:
+ bool operator()(const MediaSource& lhs, const MediaSource& rhs) const {
+ return lhs.id() < rhs.id();
+ }
xhwang 2015/04/02 17:13:03 How will this be used?
imcheng 2015/04/02 23:05:24 It will be used in maps where MediaSource is used
xhwang 2015/04/06 20:51:30 Can you simply use MediaSource::id() as the key to
imcheng 2015/04/06 21:54:20 Perhaps we can do that, but we might add more comp
};
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698