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 * This corresponds to the C++ MediaRouterMetrics MediaRouterUserAction. |
| 28 * @enum {number} |
| 29 */ |
| 30 media_router.MediaRouterUserAction = { |
| 31 CHANGE_MODE: 0, |
| 32 START_LOCAL: 1, |
| 33 STOP_LOCAL: 2, |
| 34 CLOSE: 3, |
| 35 STATUS_REMOTE: 4, |
| 36 }; |
| 37 |
| 38 /** |
| 39 * The possible states of the Media Router dialog. Used to determine which |
| 40 * components to show. |
| 41 * @enum {string} |
| 42 */ |
| 43 media_router.MediaRouterView = { |
| 44 CAST_MODE_LIST: 'cast-mode-list', |
| 45 FILTER: 'filter', |
| 46 ISSUE: 'issue', |
| 47 ROUTE_DETAILS: 'route-details', |
| 48 SINK_LIST: 'sink-list', |
| 49 }; |
| 50 |
| 51 /** |
| 52 * This corresponds to the C++ MediaSink IconType. |
| 53 * @enum {number} |
| 54 */ |
| 55 media_router.SinkIconType = { |
| 56 CAST: 0, |
| 57 CAST_AUDIO: 1, |
| 58 CAST_AUDIO_GROUP: 2, |
| 59 GENERIC: 3, |
| 60 HANGOUT: 4, |
| 61 }; |
| 62 |
| 63 /** |
| 64 * @enum {string} |
| 65 */ |
| 66 media_router.SinkStatus = { |
| 67 IDLE: 'idle', |
| 68 ACTIVE: 'active', |
| 69 REQUEST_PENDING: 'request_pending' |
| 70 }; |
| 71 |
7 cr.define('media_router', function() { | 72 cr.define('media_router', function() { |
8 'use strict'; | 73 'use strict'; |
9 | 74 |
10 /** | 75 /** |
11 * This corresponds to the C++ MediaCastMode, with the exception of AUTO. | 76 * @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 * This corresponds to the C++ MediaRouterMetrics MediaRouterUserAction. | |
28 * @enum {number} | |
29 */ | |
30 var MediaRouterUserAction = { | |
31 CHANGE_MODE: 0, | |
32 START_LOCAL: 1, | |
33 STOP_LOCAL: 2, | |
34 CLOSE: 3, | |
35 STATUS_REMOTE: 4, | |
36 }; | |
37 | |
38 /** | |
39 * The possible states of the Media Router dialog. Used to determine which | |
40 * components to show. | |
41 * @enum {string} | |
42 */ | |
43 var MediaRouterView = { | |
44 CAST_MODE_LIST: 'cast-mode-list', | |
45 FILTER: 'filter', | |
46 ISSUE: 'issue', | |
47 ROUTE_DETAILS: 'route-details', | |
48 SINK_LIST: 'sink-list', | |
49 }; | |
50 | |
51 /** | |
52 * This corresponds to the C++ MediaSink IconType. | |
53 * @enum {number} | |
54 */ | |
55 var SinkIconType = { | |
56 CAST: 0, | |
57 CAST_AUDIO: 1, | |
58 CAST_AUDIO_GROUP: 2, | |
59 GENERIC: 3, | |
60 HANGOUT: 4, | |
61 }; | |
62 | |
63 /** | |
64 * @enum {string} | |
65 */ | |
66 var SinkStatus = { | |
67 IDLE: 'idle', | |
68 ACTIVE: 'active', | |
69 REQUEST_PENDING: 'request_pending' | |
70 }; | |
71 | |
72 | |
73 /** | |
74 * @param {media_router.CastModeType} type The type of cast mode. | |
75 * @param {string} description The description of the cast mode. | 77 * @param {string} description The description of the cast mode. |
76 * @param {?string} host The hostname of the site to cast. | 78 * @param {?string} host The hostname of the site to cast. |
77 * @constructor | 79 * @constructor |
78 * @struct | 80 * @struct |
79 */ | 81 */ |
80 var CastMode = function(type, description, host) { | 82 var CastMode = function(type, description, host) { |
81 /** @type {number} */ | 83 /** @type {number} */ |
82 this.type = type; | 84 this.type = type; |
83 | 85 |
84 /** @type {string} */ | 86 /** @type {string} */ |
85 this.description = description; | 87 this.description = description; |
86 | 88 |
87 /** @type {?string} */ | 89 /** @type {?string} */ |
88 this.host = host || null; | 90 this.host = host || null; |
89 }; | 91 }; |
90 | 92 |
91 /** | 93 /** |
92 * Placeholder object for AUTO cast mode. See comment in CastModeType. | 94 * Placeholder object for AUTO cast mode. See comment in CastModeType. |
93 * @const {!media_router.CastMode} | 95 * @const {!media_router.CastMode} |
94 */ | 96 */ |
95 var AUTO_CAST_MODE = new CastMode(CastModeType.AUTO, | 97 var AUTO_CAST_MODE = new CastMode(media_router.CastModeType.AUTO, |
96 loadTimeData.getString('autoCastMode'), null); | 98 loadTimeData.getString('autoCastMode'), null); |
97 | 99 |
98 | |
99 /** | 100 /** |
100 * @param {string} id The ID of this issue. | 101 * @param {string} id The ID of this issue. |
101 * @param {string} title The issue title. | 102 * @param {string} title The issue title. |
102 * @param {string} message The issue message. | 103 * @param {string} message The issue message. |
103 * @param {number} defaultActionType The type of default action. | 104 * @param {number} defaultActionType The type of default action. |
104 * @param {?number} secondaryActionType The type of optional action. | 105 * @param {?number} secondaryActionType The type of optional action. |
105 * @param {?string} mediaRouteId The route ID to which this issue | 106 * @param {?string} mediaRouteId The route ID to which this issue |
106 * pertains. If not set, this is a global issue. | 107 * pertains. If not set, this is a global issue. |
107 * @param {boolean} isBlocking True if this issue blocks other UI. | 108 * @param {boolean} isBlocking True if this issue blocks other UI. |
108 * @param {?number} helpPageId The numeric help center ID. | 109 * @param {?number} helpPageId The numeric help center ID. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 195 |
195 /** @type {string} */ | 196 /** @type {string} */ |
196 this.name = name; | 197 this.name = name; |
197 | 198 |
198 /** @type {?string} */ | 199 /** @type {?string} */ |
199 this.description = description; | 200 this.description = description; |
200 | 201 |
201 /** @type {?string} */ | 202 /** @type {?string} */ |
202 this.domain = domain; | 203 this.domain = domain; |
203 | 204 |
204 /** @type {SinkIconType} */ | 205 /** @type {!media_router.SinkIconType} */ |
205 this.iconType = iconType; | 206 this.iconType = iconType; |
206 | 207 |
207 /** @type {media_router.SinkStatus} */ | 208 /** @type {!media_router.SinkStatus} */ |
208 this.status = status; | 209 this.status = status; |
209 | 210 |
210 /** @type {number} */ | 211 /** @type {number} */ |
211 this.castModes = castModes; | 212 this.castModes = castModes; |
212 }; | 213 }; |
213 | 214 |
214 | 215 |
215 /** | 216 /** |
216 * @param {number} tabId The current tab ID. | 217 * @param {number} tabId The current tab ID. |
217 * @param {string} domain The domain of the current tab. | 218 * @param {string} domain The domain of the current tab. |
218 * @constructor | 219 * @constructor |
219 * @struct | 220 * @struct |
220 */ | 221 */ |
221 var TabInfo = function(tabId, domain) { | 222 var TabInfo = function(tabId, domain) { |
222 /** @type {number} */ | 223 /** @type {number} */ |
223 this.tabId = tabId; | 224 this.tabId = tabId; |
224 | 225 |
225 /** @type {string} */ | 226 /** @type {string} */ |
226 this.domain = domain; | 227 this.domain = domain; |
227 }; | 228 }; |
228 | 229 |
229 return { | 230 return { |
230 AUTO_CAST_MODE: AUTO_CAST_MODE, | 231 AUTO_CAST_MODE: AUTO_CAST_MODE, |
231 CastModeType: CastModeType, | |
232 MediaRouterUserAction: MediaRouterUserAction, | |
233 MediaRouterView: MediaRouterView, | |
234 SinkIconType: SinkIconType, | |
235 SinkStatus: SinkStatus, | |
236 CastMode: CastMode, | 232 CastMode: CastMode, |
237 Issue: Issue, | 233 Issue: Issue, |
238 Route: Route, | 234 Route: Route, |
239 Sink: Sink, | 235 Sink: Sink, |
240 TabInfo: TabInfo, | 236 TabInfo: TabInfo, |
241 }; | 237 }; |
242 }); | 238 }); |
OLD | NEW |