Chromium Code Reviews| 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; |
|
Kevin Marshall
2015/04/01 17:00:19
Any thoughts about making this a child type of Med
imcheng
2015/04/01 18:10:09
I think this is fine for now. We should also keep
|
| + |
| 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); |
| private: |
| - std::string id_; |
| + MediaSourceId id_; |
| +}; |
| + |
| +// 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(); |
| + } |
| }; |
| } // namespace media_router |