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

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

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: MediaSource struct is now a class 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
new file mode 100644
index 0000000000000000000000000000000000000000..a4e976c946ea835782c2726df0650ecbeb015d06
--- /dev/null
+++ b/chrome/browser/media/router/media_source.h
@@ -0,0 +1,46 @@
+// Copyright 2015 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_MEDIA_ROUTER_MEDIA_SOURCE_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
+
+#include <string>
+
+namespace media_router {
+
+class MediaSource {
+ public:
+ MediaSource() = default;
+ MediaSource(const MediaSource& other) = default;
+ virtual ~MediaSource();
xhwang 2015/03/09 17:37:31 Is MediaSources a base class? Wondering whether we
Kevin M 2015/03/09 23:32:06 Done.
Kevin M 2015/03/09 23:32:06 Done.
+
+ // Static creation methods for various media types.
+ static MediaSource ForTab(int tab_id);
+ static MediaSource ForDesktop();
+ static MediaSource ForCastApp(const std::string& app_id);
+ static MediaSource ForPresentationUrl(const std::string& presentation_url);
+
+ // Sets the ID of a MediaSource object to |id| if it is valid.
+ // Returns true if |id| is valid and the MediaSource is modified.
+ // Returns false and leaves the MediaSource untouched if |id| is invalid.
+ bool Parse(const std::string& id);
xhwang 2015/03/09 17:37:31 Hmm, the default ctor and this function provide an
Kevin M 2015/03/09 23:32:06 I agree that this is unclear. I've moved the creat
+
+ // Gets the ID of the media source.
+ const std::string& id() const;
+
+ // Checks if the media source uses display mirroring.
+ bool SupportsMirroring() const;
+
+ protected:
+ explicit MediaSource(const std::string& source_id);
+
+ private:
+ static bool IsValid();
xhwang 2015/03/09 17:37:31 not defined?
Kevin M 2015/03/09 23:32:06 Acknowledged.
+
+ std::string id_;
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698