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.
26 REQUEST_PENDING: 'request_pending'
31 * @param {media_router.CastModeType} type The type of cast mode.
32 * @param {string} title The title of the cast mode.
33 * @param {string} description The description of the cast mode.
34 * @param {string} host The hostname of the site to cast.
38 var CastMode = function(type, title, description, host) {
46 this.description = description;
49 this.host = host || null;
54 * @param {string} id The ID of this issue.
55 * @param {string} title The issue title.
56 * @param {string} message The issue message.
57 * @param {number} defaultActionType The type of default action.
58 * @param {?number} secondaryActionType The type of optional action.
59 * @param {?string} mediaRouteId The route ID to which this issue
60 * pertains. If not set, this is a global issue.
61 * @param {boolean} isBlocking True if this issue blocks other UI.
62 * @param {?number} helpPageId The numeric help center ID.
66 var Issue = function(id, title, message, defaultActionType,
67 secondaryActionType, mediaRouteId, isBlocking,
76 this.message = message;
79 this.defaultActionType = defaultActionType;
81 /** @type {?number} */
82 this.secondaryActionType = secondaryActionType;
84 /** @type {?string} */
85 this.mediaRouteId = mediaRouteId;
87 /** @type {boolean} */
88 this.isBlocking = isBlocking;
90 /** @type {?number} */
91 this.helpPageId = helpPageId;
96 * @param {string} id The media route ID.
97 * @param {string} sinkId The ID of the media sink running this route.
98 * @param {string} title The short description of this route.
99 * @param {?number} tabId The ID of the tab in which web app is running and
100 * accessing the route.
101 * @param {boolean} isLocal True if this is a locally created route.
102 * @param {?string} customControllerPath non-empty if this route has custom
107 var Route = function(id, sinkId, title, tabId, isLocal,
108 customControllerPath) {
109 /** @type {string} */
112 /** @type {string} */
113 this.sinkId = sinkId;
115 /** @type {string} */
118 /** @type {?number} */
121 /** @type {boolean} */
122 this.isLocal = isLocal;
124 /** @type {?string} */
125 this.customControllerPath = customControllerPath;
130 * @param {string} id The ID of the media sink.
131 * @param {string} name The name of the sink.
132 * @param {media_router.SinkStatus} status The readiness state of the sink.
133 * @param {!Array<number>} castModes Cast modes compatible with the sink.
134 * @param {boolean} isLaunching True if the Media Router is creating a route
139 var Sink = function(id, name, status, castModes, isLaunching) {
140 /** @type {string} */
143 /** @type {string} */
146 /** @type {media_router.SinkStatus} */
147 this.status = status;
149 /** @type {!Array<number>} */
150 this.castModes = castModes;
152 /** @type {boolean} */
153 this.isLaunching = isLaunching;
158 * @param {number} tabId The current tab ID.
159 * @param {string} domain The domain of the current tab.
163 var TabInfo = function(tabId, domain) {
164 /** @type {number} */
167 /** @type {string} */
168 this.domain = domain;
172 CastModeType: CastModeType,
173 SinkStatus: SinkStatus,