1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_
10 #include "chrome/browser/media/router/media_source.h"
12 namespace media_router
{
14 // Helper library for protocol-specific media source object creation.
16 // TODO(kmarshall): Should these creation methods be moved to the WebUI, which
17 // (excluding Presentation API) is their only caller? The MR base code can be
18 // Also, consider generating an is_mirroring state boolean at the time of URN
19 // creation so that the mirroring status does not have to be determined from a
20 // string prefix check.
21 // These changes would allow the MR to handle MediaSource objects in the same
22 // type agnostic fashion vs. having to format and parse URNs and track which
23 // MediaSource types are mirroring-enabled.
25 // Returns MediaSource URI depending on the type of source.
26 MediaSource
ForTabMediaSource(int tab_id
);
27 MediaSource
ForDesktopMediaSource();
28 MediaSource
ForCastAppMediaSource(const std::string
& app_id
);
29 MediaSource
ForPresentationUrl(const std::string
& presentation_url
);
31 // Returns true if |source| outputs its content via mirroring.
32 bool IsMirroringMediaSource(const MediaSource
& source
);
34 // Checks that |source| is a parseable URN and is of a known type.
35 // Does not deeper protocol-level syntax checks.
36 bool IsValidMediaSource(const MediaSource
& source
);
38 } // namespace media_router
40 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_