summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/router/media_source_helper.h
blob: 0e2822a99025ea979ed7e9520a0385cce6e02f8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 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_HELPER_H_
#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_

#include <string>

#include "chrome/browser/media/router/media_source.h"

namespace media_router {

// Helper library for protocol-specific media source object creation.
// Returns MediaSource URI depending on the type of source.
MediaSource MediaSourceForTab(int tab_id);
MediaSource MediaSourceForDesktop();
MediaSource MediaSourceForCastApp(const std::string& app_id);
MediaSource MediaSourceForPresentationUrl(const std::string& presentation_url);

// Returns true if |source| outputs its content via mirroring.
bool IsDesktopMirroringMediaSource(const MediaSource& source);
bool IsTabMirroringMediaSource(const MediaSource& source);
bool IsMirroringMediaSource(const MediaSource& source);

// Checks that |source| is a parseable URN and is of a known type.
// Does not deeper protocol-level syntax checks.
bool IsValidMediaSource(const MediaSource& source);

// Extracts the presentation URL from |source|.
// If |source| is invalid, an empty string is returned.
std::string PresentationUrlFromMediaSource(const MediaSource& source);

// Returns true if |source| is a valid presentation URL.
bool IsValidPresentationUrl(const std::string& url);

}  // namespace media_router

#endif  // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_