OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/media/router/media_source.h" | 10 #include "chrome/browser/media/router/media_source.h" |
11 | 11 |
| 12 namespace content { |
| 13 class WebContents; |
| 14 } |
| 15 |
12 namespace media_router { | 16 namespace media_router { |
13 | 17 |
14 // Helper library for protocol-specific media source object creation. | 18 // Helper library for protocol-specific media source object creation. |
15 // Returns MediaSource URI depending on the type of source. | 19 // Returns MediaSource URI depending on the type of source. |
16 MediaSource MediaSourceForTab(int tab_id); | 20 MediaSource MediaSourceForTab(int tab_id); |
| 21 MediaSource MediaSourceForTabContentRemoting(content::WebContents* contents); |
17 MediaSource MediaSourceForDesktop(); | 22 MediaSource MediaSourceForDesktop(); |
18 MediaSource MediaSourceForCastApp(const std::string& app_id); | 23 MediaSource MediaSourceForCastApp(const std::string& app_id); |
19 MediaSource MediaSourceForPresentationUrl(const std::string& presentation_url); | 24 MediaSource MediaSourceForPresentationUrl(const std::string& presentation_url); |
20 | 25 |
21 // Returns true if |source| outputs its content via mirroring. | 26 // Returns true if |source| outputs its content via mirroring. |
22 bool IsDesktopMirroringMediaSource(const MediaSource& source); | 27 bool IsDesktopMirroringMediaSource(const MediaSource& source); |
23 bool IsTabMirroringMediaSource(const MediaSource& source); | 28 bool IsTabMirroringMediaSource(const MediaSource& source); |
24 bool IsMirroringMediaSource(const MediaSource& source); | 29 bool IsMirroringMediaSource(const MediaSource& source); |
25 | 30 |
| 31 // Parses the |source| and returns the SessionTabHelper tab ID referencing a |
| 32 // source tab. Returns a non-positive value on error. |
| 33 int TabIdFromMediaSource(const MediaSource& source); |
| 34 |
26 // Checks that |source| is a parseable URN and is of a known type. | 35 // Checks that |source| is a parseable URN and is of a known type. |
27 // Does not deeper protocol-level syntax checks. | 36 // Does not deeper protocol-level syntax checks. |
28 bool IsValidMediaSource(const MediaSource& source); | 37 bool IsValidMediaSource(const MediaSource& source); |
29 | 38 |
30 // Extracts the presentation URL from |source|. | 39 // Extracts the presentation URL from |source|. |
31 // If |source| is invalid, an empty string is returned. | 40 // If |source| is invalid, an empty string is returned. |
32 std::string PresentationUrlFromMediaSource(const MediaSource& source); | 41 std::string PresentationUrlFromMediaSource(const MediaSource& source); |
33 | 42 |
34 // Returns true if |source| is a valid presentation URL. | 43 // Returns true if |source| is a valid presentation URL. |
35 bool IsValidPresentationUrl(const std::string& url); | 44 bool IsValidPresentationUrl(const std::string& url); |
36 | 45 |
37 } // namespace media_router | 46 } // namespace media_router |
38 | 47 |
39 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ | 48 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ |
OLD | NEW |