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 #include "chrome/browser/media/router/presentation_helper.h" | |
11 | 12 |
12 namespace media_router { | 13 namespace media_router { |
13 | 14 |
14 // Helper library for protocol-specific media source object creation. | 15 // Helper library for protocol-specific media source object creation. |
15 | 16 |
16 // TODO(kmarshall): Should these creation methods be moved to the WebUI, which | 17 // 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 // (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 // 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 // creation so that the mirroring status does not have to be determined from a |
20 // string prefix check. | 21 // string prefix check. |
21 // These changes would allow the MR to handle MediaSource objects in the same | 22 // 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 // type agnostic fashion vs. having to format and parse URNs and track which |
23 // MediaSource types are mirroring-enabled. | 24 // MediaSource types are mirroring-enabled. |
Wez
2015/05/27 22:37:49
Please remove this comment and replace it with a c
haibinlu
2015/05/28 21:44:02
comment removed. They are not just for WebUI.
| |
24 | 25 |
25 // Returns MediaSource URI depending on the type of source. | 26 // Returns MediaSource URI depending on the type of source. |
26 MediaSource ForTabMediaSource(int tab_id); | 27 MediaSource ForTabMediaSource(int tab_id); |
27 MediaSource ForDesktopMediaSource(); | 28 MediaSource ForDesktopMediaSource(); |
28 MediaSource ForCastAppMediaSource(const std::string& app_id); | 29 MediaSource ForCastAppMediaSource(const std::string& app_id); |
29 MediaSource ForPresentationUrl(const std::string& presentation_url); | 30 MediaSource ForPresentationUrl(const std::string& presentation_url); |
Wez
2015/05/27 22:37:49
These should be named e.g. MediaSourceForTab(), Me
haibinlu
2015/05/28 21:44:02
Done.
| |
30 | 31 |
31 // Returns true if |source| outputs its content via mirroring. | 32 // Returns true if |source| outputs its content via mirroring. |
32 bool IsMirroringMediaSource(const MediaSource& source); | 33 bool IsMirroringMediaSource(const MediaSource& source); |
33 | 34 |
34 // 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. |
35 // Does not deeper protocol-level syntax checks. | 36 // Does not deeper protocol-level syntax checks. |
36 bool IsValidMediaSource(const MediaSource& source); | 37 bool IsValidMediaSource(const MediaSource& source); |
37 | 38 |
39 // Extracts the presentation URL from |source|. | |
40 // |source| must be based on a presentation URL, e.g. created from | |
41 // ForPresentationUrl, and must be valid. | |
Wez
2015/05/27 22:37:49
So what does this return if it's _not_ from a vali
haibinlu
2015/05/28 21:44:02
Updated the comment.
| |
42 std::string GetPresentationUrl(const MediaSource& source); | |
43 | |
38 } // namespace media_router | 44 } // namespace media_router |
39 | 45 |
40 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ | 46 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_ |
OLD | NEW |