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() {
16 REQUEST_PENDING: 'request_pending'
21 * @param {number} type The type of cast mode. This corresponds to the
23 * @param {string} title The title of the cast mode.
24 * @param {string} description The description of the cast mode.
25 * @param {string} host The hostname of the site to cast.
29 var CastMode = function(type, title, description, host) {
37 this.description = description;
40 this.host = host || null;
45 * @param {string} id The ID of this issue.
46 * @param {string} title The issue title.
47 * @param {string} message The issue message.
48 * @param {number} defaultActionType The type of default action.
49 * @param {?number} secondaryActionType The type of optional action.
50 * @param {?string} mediaRouteId The route ID to which this issue
51 * pertains. If not set, this is a global issue.
52 * @param {boolean} isBlocking True if this issue blocks other UI.
53 * @param {?number} helpPageId The numeric help center ID.
57 var Issue = function(id, title, message, defaultActionType,
58 secondaryActionType, mediaRouteId, isBlocking,
67 this.message = message;
70 this.defaultActionType = defaultActionType;
72 /** @type {?number} */
73 this.secondaryActionType = secondaryActionType;
75 /** @type {?string} */
76 this.mediaRouteId = mediaRouteId;
78 /** @type {boolean} */
79 this.isBlocking = isBlocking;
81 /** @type {?number} */
82 this.helpPageId = helpPageId;
87 * @param {string} id The media route ID.
88 * @param {string} sinkId The ID of the media sink running this route.
89 * @param {string} title The short description of this route.
90 * @param {?number} tabId The ID of the tab in which web app is running and
91 * accessing the route.
92 * @param {boolean} isLocal True if this is a locally created route.
93 * @param {?string} customControllerPath non-empty if this route has custom
98 var Route = function(id, sinkId, title, tabId, isLocal,
99 customControllerPath) {
100 /** @type {string} */
103 /** @type {string} */
104 this.sinkId = sinkId;
106 /** @type {string} */
109 /** @type {?number} */
112 /** @type {boolean} */
113 this.isLocal = isLocal;
115 /** @type {?string} */
116 this.customControllerPath = customControllerPath;
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.
128 var Sink = function(id, name, status, castModes) {
129 /** @type {string} */
132 /** @type {string} */
135 /** @type {media_router.SinkStatus} */
136 this.status = status;
138 /** @type {!Array<number>} */
139 this.castModes = castModes;
144 * @param {number} tabId The current tab ID.
145 * @param {string} domain The domain of the current tab.
149 var TabInfo = function(tabId, domain) {
150 /** @type {number} */
153 /** @type {string} */
154 this.domain = domain;
158 SinkStatus: SinkStatus,