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 // Any strings used here will already be localized. Values such as | 5 // Any strings used here will already be localized. Values such as |
6 // CastMode.type or IDs will be defined elsewhere and determined later. | 6 // CastMode.type or IDs will be defined elsewhere and determined later. |
7 | |
8 cr.exportPath('media_router'); | |
9 | |
10 /** | |
11 * This corresponds to the C++ MediaCastMode, with the exception of AUTO. | |
12 * See below for details. Note to support fast bitset operations, the values | |
13 * here are (1 << [corresponding value in MR]). | |
14 * @enum {number} | |
15 */ | |
16 media_router.CastModeType = { | |
17 // Note: AUTO mode is only used to configure the sink list container to show | |
18 // all sinks. Individual sinks are configured with a specific cast mode | |
19 // (DEFAULT, TAB_MIRROR, DESKTOP_MIRROR). | |
20 AUTO: -1, | |
21 DEFAULT: 0x1, | |
22 TAB_MIRROR: 0x2, | |
23 DESKTOP_MIRROR: 0x4, | |
24 }; | |
25 | |
26 /** | |
27 * The possible states of the Media Router dialog. Used to determine which | |
28 * components to show. | |
29 * @enum {string} | |
30 */ | |
31 media_router.MediaRouterView = { | |
32 CAST_MODE_LIST: 'cast-mode-list', | |
33 FILTER: 'filter', | |
34 ISSUE: 'issue', | |
35 ROUTE_DETAILS: 'route-details', | |
36 SINK_LIST: 'sink-list', | |
37 }; | |
38 | |
39 /** | |
40 * This corresponds to the C++ MediaSink IconType. | |
41 * @enum {number} | |
42 */ | |
43 media_router.SinkIconType = { | |
44 CAST: 0, | |
45 CAST_AUDIO: 1, | |
46 CAST_AUDIO_GROUP: 2, | |
47 GENERIC: 3, | |
48 HANGOUT: 4, | |
49 }; | |
50 | |
51 /** | |
52 * @enum {string} | |
53 */ | |
54 media_router.SinkStatus = { | |
55 IDLE: 'idle', | |
56 ACTIVE: 'active', | |
57 REQUEST_PENDING: 'request_pending' | |
58 }; | |
59 | |
7 cr.define('media_router', function() { | 60 cr.define('media_router', function() { |
8 'use strict'; | 61 'use strict'; |
9 | 62 |
10 /** | 63 /** |
11 * This corresponds to the C++ MediaCastMode, with the exception of AUTO. | 64 * @param {number} type The type of cast mode. |
12 * See below for details. Note to support fast bitset operations, the values | |
13 * here are (1 << [corresponding value in MR]). | |
14 * @enum {number} | |
15 */ | |
16 var CastModeType = { | |
17 // Note: AUTO mode is only used to configure the sink list container to show | |
18 // all sinks. Individual sinks are configured with a specific cast mode | |
19 // (DEFAULT, TAB_MIRROR, DESKTOP_MIRROR). | |
20 AUTO: -1, | |
21 DEFAULT: 0x1, | |
22 TAB_MIRROR: 0x2, | |
23 DESKTOP_MIRROR: 0x4, | |
24 }; | |
25 | |
26 /** | |
27 * The possible states of the Media Router dialog. Used to determine which | |
28 * components to show. | |
29 * @enum {string} | |
30 */ | |
31 var MediaRouterView = { | |
32 CAST_MODE_LIST: 'cast-mode-list', | |
33 FILTER: 'filter', | |
34 ISSUE: 'issue', | |
35 ROUTE_DETAILS: 'route-details', | |
36 SINK_LIST: 'sink-list', | |
37 }; | |
38 | |
39 /** | |
40 * This corresponds to the C++ MediaSink IconType. | |
41 * @enum {mumber} | |
42 */ | |
43 var SinkIconType = { | |
44 CAST: 0, | |
45 CAST_AUDIO: 1, | |
46 CAST_AUDIO_GROUP: 2, | |
47 GENERIC: 3, | |
48 HANGOUT: 4, | |
49 }; | |
50 | |
51 /** | |
52 * @enum {string} | |
53 */ | |
54 var SinkStatus = { | |
55 IDLE: 'idle', | |
56 ACTIVE: 'active', | |
57 REQUEST_PENDING: 'request_pending' | |
58 }; | |
59 | |
60 | |
61 /** | |
62 * @param {media_router.CastModeType} type The type of cast mode. | |
63 * @param {string} description The description of the cast mode. | 65 * @param {string} description The description of the cast mode. |
64 * @param {?string} host The hostname of the site to cast. | 66 * @param {?string} host The hostname of the site to cast. |
65 * @constructor | 67 * @constructor |
66 * @struct | 68 * @struct |
67 */ | 69 */ |
68 var CastMode = function(type, description, host) { | 70 var CastMode = function(type, description, host) { |
69 /** @type {number} */ | 71 /** @type {number} */ |
70 this.type = type; | 72 this.type = type; |
71 | 73 |
72 /** @type {string} */ | 74 /** @type {string} */ |
73 this.description = description; | 75 this.description = description; |
74 | 76 |
75 /** @type {?string} */ | 77 /** @type {?string} */ |
76 this.host = host || null; | 78 this.host = host || null; |
77 }; | 79 }; |
78 | 80 |
79 /** | 81 /** |
80 * Placeholder object for AUTO cast mode. See comment in CastModeType. | 82 * Placeholder object for AUTO cast mode. See comment in CastModeType. |
81 * @const {!media_router.CastMode} | 83 * @const {!media_router.CastMode} |
82 */ | 84 */ |
83 var AUTO_CAST_MODE = new CastMode(CastModeType.AUTO, | 85 var AUTO_CAST_MODE = new CastMode(CastModeType.AUTO, |
84 loadTimeData.getString('autoCastMode'), null); | 86 loadTimeData.getString('autoCastMode'), null); |
85 | 87 |
86 | |
87 /** | 88 /** |
88 * @param {string} id The ID of this issue. | 89 * @param {string} id The ID of this issue. |
89 * @param {string} title The issue title. | 90 * @param {string} title The issue title. |
90 * @param {string} message The issue message. | 91 * @param {string} message The issue message. |
91 * @param {number} defaultActionType The type of default action. | 92 * @param {number} defaultActionType The type of default action. |
92 * @param {?number} secondaryActionType The type of optional action. | 93 * @param {?number} secondaryActionType The type of optional action. |
93 * @param {?string} mediaRouteId The route ID to which this issue | 94 * @param {?string} mediaRouteId The route ID to which this issue |
94 * pertains. If not set, this is a global issue. | 95 * pertains. If not set, this is a global issue. |
95 * @param {boolean} isBlocking True if this issue blocks other UI. | 96 * @param {boolean} isBlocking True if this issue blocks other UI. |
96 * @param {?number} helpPageId The numeric help center ID. | 97 * @param {?number} helpPageId The numeric help center ID. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 var Sink = function(id, name, description, iconType, status, castModes) { | 174 var Sink = function(id, name, description, iconType, status, castModes) { |
174 /** @type {string} */ | 175 /** @type {string} */ |
175 this.id = id; | 176 this.id = id; |
176 | 177 |
177 /** @type {string} */ | 178 /** @type {string} */ |
178 this.name = name; | 179 this.name = name; |
179 | 180 |
180 /** @type {?string} */ | 181 /** @type {?string} */ |
181 this.description = description; | 182 this.description = description; |
182 | 183 |
183 /** @type {SinkIconType} */ | 184 /** @type {media_router.SinkIconType} */ |
Dan Beam
2015/12/12 01:43:02
nit: ? or !
imcheng
2015/12/14 22:47:00
Done.
| |
184 this.iconType = iconType; | 185 this.iconType = iconType; |
185 | 186 |
186 /** @type {media_router.SinkStatus} */ | 187 /** @type {media_router.SinkStatus} */ |
187 this.status = status; | 188 this.status = status; |
188 | 189 |
189 /** @type {number} */ | 190 /** @type {number} */ |
190 this.castModes = castModes; | 191 this.castModes = castModes; |
191 }; | 192 }; |
192 | 193 |
193 | 194 |
(...skipping 17 matching lines...) Expand all Loading... | |
211 MediaRouterView: MediaRouterView, | 212 MediaRouterView: MediaRouterView, |
212 SinkIconType: SinkIconType, | 213 SinkIconType: SinkIconType, |
213 SinkStatus: SinkStatus, | 214 SinkStatus: SinkStatus, |
214 CastMode: CastMode, | 215 CastMode: CastMode, |
215 Issue: Issue, | 216 Issue: Issue, |
216 Route: Route, | 217 Route: Route, |
217 Sink: Sink, | 218 Sink: Sink, |
218 TabInfo: TabInfo, | 219 TabInfo: TabInfo, |
219 }; | 220 }; |
220 }); | 221 }); |
OLD | NEW |