Index: chrome/browser/media/router/media_source.cc |
diff --git a/chrome/browser/media/router/media_source.cc b/chrome/browser/media/router/media_source.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..42febd0dd017a0dd9a1b4a0491cab00e01b07231 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_source.cc |
@@ -0,0 +1,44 @@ |
+// Copyright 2014 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. |
+ |
+#include "chrome/browser/media/router/media_source.h" |
mark a. foltz
2015/02/27 05:48:10
This file doesn't look current.
Kevin M
2015/02/27 18:42:17
Fetched the latest changes and pulled them in and
|
+ |
+#include "base/strings/string_util.h" |
+#include "base/strings/stringprintf.h" |
+ |
+namespace media_router { |
+ |
+namespace { |
+const char* kTabMediaSourcePrefix = "urn:google:tab:"; |
+const char* kDesktopMediaSource = "urn:google:desktop"; |
+ |
+} // namespace |
+ |
+MediaSource ForTabMediaSource(int tab_id) { |
+ return base::StringPrintf("%s%d", kTabMediaSourcePrefix, tab_id); |
+} |
+ |
+MediaSource ForDesktopMediaSource() { |
+ return kDesktopMediaSource; |
+} |
+ |
+MediaSource ForDialAppMediaSource(const std::string& app_name) { |
+ return "urn:google:dial:" + app_name; |
+} |
+ |
+MediaSource ForCastAppMediaSource(const std::string& app_name) { |
+ return "urn:google:cast:" + app_name; |
+} |
+ |
+MediaSource ForPresentationUrl(const std::string& presentation_url) { |
+ // TODO(imcheng): Figure out correct scheme for presentation urls. |
+ return "urn:google:presentation:" + presentation_url; |
+} |
+ |
+bool IsMirroringMediaSource(const MediaSource& source) { |
+ return StartsWithASCII(source, kTabMediaSourcePrefix, true) || |
+ StartsWithASCII(source, kDesktopMediaSource, true); |
+} |
+ |
+} // namespace media_router |