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

Side by Side Diff: chrome/browser/media/router/media_source.cc

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chunkier CL 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #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
6
7 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h"
9
10 namespace media_router {
11
12 namespace {
13 const char* kTabMediaSourcePrefix = "urn:google:tab:";
14 const char* kDesktopMediaSource = "urn:google:desktop";
15
16 } // namespace
17
18 MediaSource ForTabMediaSource(int tab_id) {
19 return base::StringPrintf("%s%d", kTabMediaSourcePrefix, tab_id);
20 }
21
22 MediaSource ForDesktopMediaSource() {
23 return kDesktopMediaSource;
24 }
25
26 MediaSource ForDialAppMediaSource(const std::string& app_name) {
27 return "urn:google:dial:" + app_name;
28 }
29
30 MediaSource ForCastAppMediaSource(const std::string& app_name) {
31 return "urn:google:cast:" + app_name;
32 }
33
34 MediaSource ForPresentationUrl(const std::string& presentation_url) {
35 // TODO(imcheng): Figure out correct scheme for presentation urls.
36 return "urn:google:presentation:" + presentation_url;
37 }
38
39 bool IsMirroringMediaSource(const MediaSource& source) {
40 return StartsWithASCII(source, kTabMediaSourcePrefix, true) ||
41 StartsWithASCII(source, kDesktopMediaSource, true);
42 }
43
44 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698