Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Side by Side Diff: chrome/browser/resources/media_router/media_router_data.js

Issue 1521433002: [MediaRouter UI] Compile MR WebUI js code with Closure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 cr.define('media_router', function() { 7 cr.define('media_router', function() {
8 'use strict'; 8 'use strict';
9 9
10 /** 10 /**
(...skipping 20 matching lines...) Expand all
31 var MediaRouterView = { 31 var MediaRouterView = {
32 CAST_MODE_LIST: 'cast-mode-list', 32 CAST_MODE_LIST: 'cast-mode-list',
33 FILTER: 'filter', 33 FILTER: 'filter',
34 ISSUE: 'issue', 34 ISSUE: 'issue',
35 ROUTE_DETAILS: 'route-details', 35 ROUTE_DETAILS: 'route-details',
36 SINK_LIST: 'sink-list', 36 SINK_LIST: 'sink-list',
37 }; 37 };
38 38
39 /** 39 /**
40 * This corresponds to the C++ MediaSink IconType. 40 * This corresponds to the C++ MediaSink IconType.
41 * @enum {mumber} 41 * @enum {number}
42 */ 42 */
43 var SinkIconType = { 43 var SinkIconType = {
44 CAST: 0, 44 CAST: 0,
45 CAST_AUDIO: 1, 45 CAST_AUDIO: 1,
46 CAST_AUDIO_GROUP: 2, 46 CAST_AUDIO_GROUP: 2,
47 GENERIC: 3, 47 GENERIC: 3,
48 HANGOUT: 4, 48 HANGOUT: 4,
49 }; 49 };
50 50
51 /** 51 /**
52 * @enum {string} 52 * @enum {string}
53 */ 53 */
54 var SinkStatus = { 54 var SinkStatus = {
55 IDLE: 'idle', 55 IDLE: 'idle',
56 ACTIVE: 'active', 56 ACTIVE: 'active',
57 REQUEST_PENDING: 'request_pending' 57 REQUEST_PENDING: 'request_pending'
58 }; 58 };
Dan Beam 2015/12/10 23:41:34 ^ just move these out of the cr.define(), and if y
imcheng 2015/12/11 01:14:59 Done.
59 59
60 60
61 /** 61 /**
62 * @param {media_router.CastModeType} type The type of cast mode. 62 * @param {number} type The type of cast mode.
63 * @param {string} description The description of the cast mode. 63 * @param {string} description The description of the cast mode.
64 * @param {?string} host The hostname of the site to cast. 64 * @param {?string} host The hostname of the site to cast.
65 * @constructor 65 * @constructor
66 * @struct 66 * @struct
67 */ 67 */
68 var CastMode = function(type, description, host) { 68 var CastMode = function(type, description, host) {
69 /** @type {number} */ 69 /** @type {number} */
70 this.type = type; 70 this.type = type;
71 71
72 /** @type {string} */ 72 /** @type {string} */
73 this.description = description; 73 this.description = description;
74 74
75 /** @type {?string} */ 75 /** @type {?string} */
76 this.host = host || null; 76 this.host = host || null;
77 }; 77 };
78 78
79 /** 79 /**
80 * Placeholder object for AUTO cast mode. See comment in CastModeType. 80 * Placeholder object for AUTO cast mode. See comment in CastModeType.
81 * @const {!media_router.CastMode} 81 * @const {!media_router.CastMode}
82 */ 82 */
83 var AUTO_CAST_MODE = new CastMode(CastModeType.AUTO, 83 var AUTO_CAST_MODE = new CastMode(CastModeType.AUTO,
84 loadTimeData.getString('autoCastMode'), null); 84 loadTimeData.getString('autoCastMode'), null);
85 85
86 /**
87 * @const {string}
88 */
89 var DEVICE_MISSING_TEXT = loadTimeData.getString('deviceMissing');
90
91 /**
92 * @const {string}
93 */
94 var ISSUE_HEADER_TEXT = loadTimeData.getString('issueHeader');
95
96 /**
97 * @const {string}
98 */
99 var SELECT_CAST_MODE_HEADER_TEXT =
100 loadTimeData.getString('selectCastModeHeader');
101
102 /**
103 * @const {string}
104 */
105 var SHARE_YOUR_SCREEN_SUBHEADING_TEXT =
106 loadTimeData.getString('shareYourScreenSubheading');
107
108 /**
109 * @const {string}
110 */
111 var STOP_CASTING_BUTTON_TEXT = loadTimeData.getString('stopCastingButton');
Dan Beam 2015/12/10 23:41:34 why are these better? also, have you see I18nBeha
imcheng 2015/12/11 01:14:59 Calling loadtimeData from Polymer properties doesn
Dan Beam 2015/12/11 04:58:46 you just need to include load_time_data.js, string
imcheng 2015/12/11 20:00:46 Done. Went with latter.
86 112
87 /** 113 /**
88 * @param {string} id The ID of this issue. 114 * @param {string} id The ID of this issue.
89 * @param {string} title The issue title. 115 * @param {string} title The issue title.
90 * @param {string} message The issue message. 116 * @param {string} message The issue message.
91 * @param {number} defaultActionType The type of default action. 117 * @param {number} defaultActionType The type of default action.
92 * @param {?number} secondaryActionType The type of optional action. 118 * @param {?number} secondaryActionType The type of optional action.
93 * @param {?string} mediaRouteId The route ID to which this issue 119 * @param {?string} mediaRouteId The route ID to which this issue
94 * pertains. If not set, this is a global issue. 120 * pertains. If not set, this is a global issue.
95 * @param {boolean} isBlocking True if this issue blocks other UI. 121 * @param {boolean} isBlocking True if this issue blocks other UI.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 183
158 /** @type {?string} */ 184 /** @type {?string} */
159 this.customControllerPath = customControllerPath; 185 this.customControllerPath = customControllerPath;
160 }; 186 };
161 187
162 188
163 /** 189 /**
164 * @param {string} id The ID of the media sink. 190 * @param {string} id The ID of the media sink.
165 * @param {string} name The name of the sink. 191 * @param {string} name The name of the sink.
166 * @param {?string} description Optional description of the sink. 192 * @param {?string} description Optional description of the sink.
167 * @param {media_router.SinkIconType} iconType the type of icon for the sink. 193 * @param {number} iconType the type of icon for the sink.
imcheng 2015/12/10 21:37:21 The compiler won't let me use media_router.SinkIco
imcheng 2015/12/11 01:14:59 Moving the enum out of cr.define and using cr.expo
168 * @param {media_router.SinkStatus} status The readiness state of the sink. 194 * @param {string} status The readiness state of the sink.
169 * @param {number} castModes Bitset of cast modes compatible with the sink. 195 * @param {number} castModes Bitset of cast modes compatible with the sink.
170 * @constructor 196 * @constructor
171 * @struct 197 * @struct
172 */ 198 */
173 var Sink = function(id, name, description, iconType, status, castModes) { 199 var Sink = function(id, name, description, iconType, status, castModes) {
174 /** @type {string} */ 200 /** @type {string} */
175 this.id = id; 201 this.id = id;
176 202
177 /** @type {string} */ 203 /** @type {string} */
178 this.name = name; 204 this.name = name;
179 205
180 /** @type {?string} */ 206 /** @type {?string} */
181 this.description = description; 207 this.description = description;
182 208
183 /** @type {SinkIconType} */ 209 /** @type {number} */
184 this.iconType = iconType; 210 this.iconType = iconType;
185 211
186 /** @type {media_router.SinkStatus} */ 212 /** @type {string} */
187 this.status = status; 213 this.status = status;
188 214
189 /** @type {number} */ 215 /** @type {number} */
190 this.castModes = castModes; 216 this.castModes = castModes;
191 }; 217 };
192 218
193 219
194 /** 220 /**
195 * @param {number} tabId The current tab ID. 221 * @param {number} tabId The current tab ID.
196 * @param {string} domain The domain of the current tab. 222 * @param {string} domain The domain of the current tab.
197 * @constructor 223 * @constructor
198 * @struct 224 * @struct
199 */ 225 */
200 var TabInfo = function(tabId, domain) { 226 var TabInfo = function(tabId, domain) {
201 /** @type {number} */ 227 /** @type {number} */
202 this.tabId = tabId; 228 this.tabId = tabId;
203 229
204 /** @type {string} */ 230 /** @type {string} */
205 this.domain = domain; 231 this.domain = domain;
206 }; 232 };
207 233
208 return { 234 return {
209 AUTO_CAST_MODE: AUTO_CAST_MODE, 235 AUTO_CAST_MODE: AUTO_CAST_MODE,
236 DEVICE_MISSING_TEXT: DEVICE_MISSING_TEXT,
237 ISSUE_HEADER_TEXT: ISSUE_HEADER_TEXT,
238 SELECT_CAST_MODE_HEADER_TEXT: SELECT_CAST_MODE_HEADER_TEXT,
239 SHARE_YOUR_SCREEN_SUBHEADING_TEXT: SHARE_YOUR_SCREEN_SUBHEADING_TEXT,
240 STOP_CASTING_BUTTON_TEXT: STOP_CASTING_BUTTON_TEXT,
210 CastModeType: CastModeType, 241 CastModeType: CastModeType,
211 MediaRouterView: MediaRouterView, 242 MediaRouterView: MediaRouterView,
212 SinkIconType: SinkIconType, 243 SinkIconType: SinkIconType,
213 SinkStatus: SinkStatus, 244 SinkStatus: SinkStatus,
214 CastMode: CastMode, 245 CastMode: CastMode,
215 Issue: Issue, 246 Issue: Issue,
216 Route: Route, 247 Route: Route,
217 Sink: Sink, 248 Sink: Sink,
218 TabInfo: TabInfo, 249 TabInfo: TabInfo,
219 }; 250 };
220 }); 251 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698