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_COMMON_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ | 6 #define CHROME_COMMON_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/common/media_router/media_source.h" |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 namespace content { | |
15 class WebContents; | |
16 } | |
17 | |
18 namespace media_router { | 14 namespace media_router { |
19 | 15 |
20 // Helper library for protocol-specific media source object creation. | 16 // Helper library for protocol-specific media source object creation. |
21 // Returns MediaSource URI depending on the type of source. | 17 // Returns MediaSource URI depending on the type of source. |
22 MediaSource MediaSourceForTab(int tab_id); | 18 MediaSource MediaSourceForTab(int tab_id); |
23 MediaSource MediaSourceForTabContentRemoting(content::WebContents* contents); | 19 MediaSource MediaSourceForTabContentRemoting(int tab_id); |
24 MediaSource MediaSourceForDesktop(); | 20 MediaSource MediaSourceForDesktop(); |
25 MediaSource MediaSourceForPresentationUrl(const GURL& presentation_url); | 21 MediaSource MediaSourceForPresentationUrl(const GURL& presentation_url); |
26 | 22 |
27 // Returns true if |source| outputs its content via mirroring. | 23 // Returns true if |source| outputs its content via mirroring. |
28 bool IsDesktopMirroringMediaSource(const MediaSource& source); | 24 bool IsDesktopMirroringMediaSource(const MediaSource& source); |
29 bool IsTabMirroringMediaSource(const MediaSource& source); | 25 bool IsTabMirroringMediaSource(const MediaSource& source); |
30 bool IsMirroringMediaSource(const MediaSource& source); | 26 bool IsMirroringMediaSource(const MediaSource& source); |
31 | 27 |
32 // Returns true if |source| is a media source type that can be connected to the | 28 // Returns true if |source| is a media source type that can be connected to the |
33 // Presentation API by from a request initiated by the browser. | 29 // Presentation API by from a request initiated by the browser. |
34 bool CanConnectToMediaSource(const MediaSource& source); | 30 bool CanConnectToMediaSource(const MediaSource& source); |
35 | 31 |
36 // Parses the |source| and returns the SessionTabHelper tab ID referencing a | 32 // Parses the |source| and returns the SessionTabHelper tab ID referencing a |
37 // source tab. Returns a non-positive value on error. | 33 // source tab. Returns a non-positive value on error. |
38 int TabIdFromMediaSource(const MediaSource& source); | 34 int TabIdFromMediaSource(const MediaSource& source); |
39 | 35 |
40 // Checks that |source| is a parseable URN and is of a known type. | 36 // Checks that |source| is a parseable URN and is of a known type. |
41 // Does not deeper protocol-level syntax checks. | 37 // Does not deeper protocol-level syntax checks. |
42 bool IsValidMediaSource(const MediaSource& source); | 38 bool IsValidMediaSource(const MediaSource& source); |
43 | 39 |
44 // Returns true if |url| is a valid presentation URL. | 40 // Returns true if |url| is a valid presentation URL. |
45 bool IsValidPresentationUrl(const GURL& url); | 41 bool IsValidPresentationUrl(const GURL& url); |
46 | 42 |
47 // Returns true if |presentation_id| is an ID used by auto-join requests. | 43 // Returns true if |presentation_id| is an ID used by auto-join requests. |
48 bool IsAutoJoinPresentationId(const std::string& presentation_id); | 44 bool IsAutoJoinPresentationId(const std::string& presentation_id); |
49 | 45 |
50 } // namespace media_router | 46 } // namespace media_router |
51 | 47 |
52 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ | 48 #endif // CHROME_COMMON_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ |
OLD | NEW |