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

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

Issue 1693963003: Pass origin to StartObservingMediaSinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cache off media source Created 4 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
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 288cb27b7791bdfdca6d04ce345df9aeb64ce604..983a93f82ed6fa2988af5c963dfc26d328745c37 100644
--- a/chrome/browser/media/router/media_source.h
+++ b/chrome/browser/media/router/media_source.h
@@ -26,6 +26,12 @@ class MediaSource {
// Gets the ID of the media source.
MediaSource::Id id() const;
+ // Gets the origin of the media source.
+ std::string GetOrigin() const;
mark a. foltz 2016/03/03 22:58:36 origin() for simple getters
matt.boetger 2016/03/04 00:22:10 Done.
+
+ // Sets the origin of the media source.
+ void SetOrigin(std::string origin);
mark a. foltz 2016/03/03 22:58:36 set_origin() for simple setters
matt.boetger 2016/03/04 00:22:10 Done.
+
// Returns true if two MediaSource objects use the same media ID.
bool Equals(const MediaSource& other) const;
@@ -35,17 +41,30 @@ class MediaSource {
// Used for logging.
std::string ToString() const;
- // Hash operator for hash containers.
struct Hash {
- size_t operator()(const MediaSource& source) const {
- return base::Hash(source.id());
+ size_t operator () (const media_router::MediaSource &m) const {
+ return base::HashInts32(base::Hash(m.id()),
+ base::Hash(m.GetOrigin()));
}
};
+ bool operator==(const MediaSource& other) const;
+ bool operator<(const MediaSource& other) const;
+
private:
MediaSource::Id id_;
+ std::string origin_;
};
} // namespace media_router
+namespace std {
+template <> struct hash<media_router::MediaSource> {
+ size_t operator () (const media_router::MediaSource &m) const {
+ return base::HashInts32(base::Hash(m.id()),
+ base::Hash(m.GetOrigin()));
+ }
+};
+}
+
#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698