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

Unified Diff: chrome/browser/ui/webui/media_router/cast_modes_with_media_sources.h

Issue 2264153002: [Presentation API] Add support for multiple URLs in PresentationRequest on Media Router UI side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Mark's comments, add unit test for CMWMS Created 4 years, 3 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/ui/webui/media_router/cast_modes_with_media_sources.h
diff --git a/chrome/browser/ui/webui/media_router/cast_modes_with_media_sources.h b/chrome/browser/ui/webui/media_router/cast_modes_with_media_sources.h
new file mode 100644
index 0000000000000000000000000000000000000000..07716731fa6f8aaf278f82151e12b223584430db
--- /dev/null
+++ b/chrome/browser/ui/webui/media_router/cast_modes_with_media_sources.h
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_CAST_MODES_WITH_MEDIA_SOURCES_H_
+#define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_CAST_MODES_WITH_MEDIA_SOURCES_H_
+
+#include <map>
+#include <unordered_set>
+
+#include "chrome/browser/media/router/media_source.h"
+#include "chrome/browser/ui/webui/media_router/media_cast_mode.h"
+
+namespace media_router {
+
+// Contains information on cast modes and the sources associated with them.
+// Each cast mode contained has at least one source.
+class CastModesWithMediaSources {
+ public:
+ CastModesWithMediaSources();
+ CastModesWithMediaSources(const CastModesWithMediaSources& other);
+ ~CastModesWithMediaSources();
+
+ // Add a source for the cast mode.
+ void AddSource(const MediaSource& source, MediaCastMode cast_mode);
mark a. foltz 2016/09/02 23:00:37 Nit: the mapping is from cast mode to source(s).
takumif 2016/09/06 21:53:20 Done.
+
+ // Remove a source from the cast mode. The cast mode will also get removed if
+ // it has no other sources. This is a no-op if the source is not found.
+ void RemoveSource(const MediaSource& source, MediaCastMode cast_mode);
+
+ // Returns true if the source for the cast mode is contained.
+ bool HasSource(const MediaSource& source, MediaCastMode cast_mode) const;
+
+ // Returns a set of all the cast modes contained.
+ CastModeSet GetCastModes() const;
+
+ // Returns true if there are no cast modes contained.
mark a. foltz 2016/09/02 23:00:37 Not sure this adds much versus GetCastModes().empt
takumif 2016/09/06 21:53:20 It's more obvious than GetCastModes().empty(), and
+ bool IsEmpty() const;
+
+ private:
+ std::map<MediaCastMode, std::unordered_set<MediaSource, MediaSource::Hash>>
mark a. foltz 2016/09/02 23:00:37 A std::multimap may be simpler but would not inher
takumif 2016/09/06 21:53:20 Yeah, it's nice not having to check for duplicates
+ cast_modes_;
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_CAST_MODES_WITH_MEDIA_SOURCES_H_

Powered by Google App Engine
This is Rietveld 408576698