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
3 // found in the LICENSE file.
5 // Any strings used here will already be localized. Values such as
6 // CastMode.type or IDs will be defined elsewhere and determined later.
7 cr.define('media_router', function() {
11 * This corresponds to the C++ MediaCastMode.
21 * This corresponds to the C++ MediaSink IconType.
37 REQUEST_PENDING: 'request_pending'
42 * @param {media_router.CastModeType} type The type of cast mode.
43 * @param {string} description The description of the cast mode.
44 * @param {string} host The hostname of the site to cast.
48 var CastMode = function(type, description, host) {
53 this.description = description;
56 this.host = host || null;
61 * @param {string} id The ID of this issue.
62 * @param {string} title The issue title.
63 * @param {string} message The issue message.
64 * @param {number} defaultActionType The type of default action.
65 * @param {?number} secondaryActionType The type of optional action.
66 * @param {?string} mediaRouteId The route ID to which this issue
67 * pertains. If not set, this is a global issue.
68 * @param {boolean} isBlocking True if this issue blocks other UI.
69 * @param {?number} helpPageId The numeric help center ID.
73 var Issue = function(id, title, message, defaultActionType,
74 secondaryActionType, mediaRouteId, isBlocking,
83 this.message = message;
86 this.defaultActionType = defaultActionType;
88 /** @type {?number} */
89 this.secondaryActionType = secondaryActionType;
91 /** @type {?string} */
92 this.mediaRouteId = mediaRouteId;
94 /** @type {boolean} */
95 this.isBlocking = isBlocking;
97 /** @type {?number} */
98 this.helpPageId = helpPageId;
103 * @param {string} id The media route ID.
104 * @param {string} sinkId The ID of the media sink running this route.
105 * @param {string} description The short description of this route.
106 * @param {?number} tabId The ID of the tab in which web app is running and
107 * accessing the route.
108 * @param {boolean} isLocal True if this is a locally created route.
109 * @param {?string} customControllerPath non-empty if this route has custom
114 var Route = function(id, sinkId, description, tabId, isLocal,
115 customControllerPath) {
116 /** @type {string} */
119 /** @type {string} */
120 this.sinkId = sinkId;
122 /** @type {string} */
123 this.description = description;
125 /** @type {?number} */
128 /** @type {boolean} */
129 this.isLocal = isLocal;
131 /** @type {?string} */
132 this.customControllerPath = customControllerPath;
137 * @param {string} id The ID of the media sink.
138 * @param {string} name The name of the sink.
139 * @param {media_router.SinkIconType} iconType the type of icon for the sink.
140 * @param {media_router.SinkStatus} status The readiness state of the sink.
141 * @param {!Array<number>} castModes Cast modes compatible with the sink.
142 * @param {boolean} isLaunching True if the Media Router is creating a route
147 var Sink = function(id, name, iconType, status, castModes, isLaunching) {
148 /** @type {string} */
151 /** @type {string} */
154 /** @type {SinkIconType} */
155 this.iconType = iconType;
157 /** @type {media_router.SinkStatus} */
158 this.status = status;
160 /** @type {!Array<number>} */
161 this.castModes = castModes;
163 /** @type {boolean} */
164 this.isLaunching = isLaunching;
169 * @param {number} tabId The current tab ID.
170 * @param {string} domain The domain of the current tab.
174 var TabInfo = function(tabId, domain) {
175 /** @type {number} */
178 /** @type {string} */
179 this.domain = domain;
183 CastModeType: CastModeType,
184 SinkIconType: SinkIconType,
185 SinkStatus: SinkStatus,