OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Any strings used here will already be localized. Values such as castMode or | |
6 // IDs will be defined elsewhere and determined later. | |
7 cr.define('media_router', function() { | |
8 'use strict'; | |
9 | |
10 /** | |
11 * @enum {string} | |
12 */ | |
13 var SinkStatus = { | |
14 IDLE: 'idle', | |
15 ACTIVE: 'active', | |
16 REQUEST_PENDING: 'request_pending' | |
17 }; | |
18 | |
19 | |
20 /** | |
21 * @param {number} castMode The type of cast mode. | |
22 * @param {string} title The title of the cast mode. | |
23 * @param {string} description The description of the cast mode. | |
24 * @constructor | |
25 * @struct | |
26 */ | |
27 var CastMode = function(castMode, title, description) { | |
28 /** @type {number} */ | |
29 this.castMode = castMode; | |
30 | |
31 /** @type {string} */ | |
32 this.title = title; | |
33 | |
34 /** @type {string} */ | |
35 this.description = description; | |
36 }; | |
37 | |
38 | |
39 /** | |
40 * @param {string} id The ID of this issue. | |
41 * @param {string} title The issue title. | |
42 * @param {string} message The issue message. | |
43 * @param {string} defaultActionText The button text of default action. | |
44 * @param {number} defaultActionType The type of default action. | |
45 * @param {?string} opt_secondaryActionText The button text of optional | |
haibinlu
2015/03/25 00:22:58
rename to secondaryActionText?
per closure annota
apacible
2015/03/25 00:50:20
Talked offline with haibinlu@ -- for this case, we
| |
46 * action. | |
47 * @param {?number} opt_secondaryActionType The type of optional action. | |
48 * @param {?string} opt_mediaRouteId The route ID to which this issue | |
49 * pertains. If not set, this is a global issue. | |
50 * @param {boolean} isBlocking True if this issue blocks other UI. | |
51 * @param {?string} opt_helpURL The URL to be opened if learn more is | |
52 * clicked. | |
haibinlu
2015/03/25 00:22:58
ditto
apacible
2015/03/25 00:50:20
Done.
| |
53 * @constructor | |
54 * @struct | |
55 */ | |
56 var Issue = function(id, title, message, defaultActionText, | |
57 defaultActionType, opt_secondaryActionText, | |
58 opt_secondaryActionType, opt_mediaRouteId, isBlocking, | |
59 opt_helpURL) { | |
60 /** @type {string} */ | |
61 this.id = id; | |
62 | |
63 /** @type {string} */ | |
64 this.title = title; | |
65 | |
66 /** @type {string} */ | |
67 this.message = message; | |
68 | |
69 /** @type {string} */ | |
70 this.defaultActionText = defaultActionText; | |
71 | |
72 /** @type {number} */ | |
73 this.defaultActionType = defaultActionType; | |
74 | |
75 /** @type {?string} */ | |
76 this.secondaryActionText = opt_secondaryActionText; | |
77 | |
78 /** @type {?number} */ | |
79 this.secondaryActionType = opt_secondaryActionType; | |
80 | |
81 /** @type {?string} */ | |
82 this.mediaRouteId = opt_mediaRouteId; | |
83 | |
84 /** @type {boolean} */ | |
85 this.isBlocking = isBlocking; | |
86 | |
87 /** @type {?string} */ | |
88 this.helpURL = opt_helpURL; | |
89 }; | |
90 | |
91 | |
92 /** | |
93 * @param {string} id The media route ID. | |
94 * @param {string} sinkId The ID of the media sink running this route. | |
95 * @param {string} title The short description of this route. | |
96 * @param {?number} opt_tabId The ID of the tab in which web app is running | |
97 * and accessing the route. | |
98 * @param {boolean} isLocal True if this is a locally created route. | |
99 * @constructor | |
100 * @struct | |
101 */ | |
102 var Route = function(id, sinkId, title, opt_tabId, isLocal) { | |
103 /** @type {string} */ | |
104 this.id = id; | |
105 | |
106 /** @type {string} */ | |
107 this.sinkId = sinkId; | |
108 | |
109 /** @type {string} */ | |
110 this.title = title; | |
111 | |
112 /** @type {?number} */ | |
113 this.tabId = opt_tabId; | |
114 | |
115 /** @type {boolean} */ | |
116 this.isLocal = isLocal; | |
117 }; | |
118 | |
119 | |
120 /** | |
121 * @param {string} id The ID of the media sink. | |
122 * @param {string} name The name of the sink. | |
123 * @param {media_router.SinkStatus} status The readiness state of the sink. | |
124 * @param {!Array<number>} castModes Cast modes compatible with the sink. | |
125 * @constructor | |
126 * @struct | |
127 */ | |
128 var Sink = function(id, name, status) { | |
129 /** @type {string} */ | |
130 this.id = id; | |
131 | |
132 /** @type {string} */ | |
133 this.name = name; | |
134 | |
135 /** @type {media_router.SinkStatus} */ | |
136 this.status = status; | |
137 | |
138 /** @type {!Array<number>} */ | |
139 this.castModes = castModes; | |
140 }; | |
141 | |
142 | |
143 /** | |
144 * @param {number} tabId The current tab ID. | |
145 * @param {string} domain The domain of the current tab. | |
146 * @constructor | |
147 * @struct | |
148 */ | |
149 var TabInfo = function(tabId, domain) { | |
150 /** @type {number} */ | |
151 this.tabId = tabId; | |
152 | |
153 /** @type {string} */ | |
154 this.domain = domain; | |
155 }; | |
156 | |
157 return { | |
158 SinkStatus: SinkStatus, | |
159 CastMode: CastMode, | |
160 Issue: Issue, | |
161 Route: Route, | |
162 Sink: Sink, | |
163 TabInfo: TabInfo, | |
164 }; | |
165 }); | |
OLD | NEW |