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} secondaryActionText The button text of optional action. |
| 46 * @param {?number} secondaryActionType The type of optional action. |
| 47 * @param {?string} mediaRouteId The route ID to which this issue |
| 48 * pertains. If not set, this is a global issue. |
| 49 * @param {boolean} isBlocking True if this issue blocks other UI. |
| 50 * @param {?string} helpURL The URL to be opened if learn more is clicked. |
| 51 * @constructor |
| 52 * @struct |
| 53 */ |
| 54 var Issue = function(id, title, message, defaultActionText, |
| 55 defaultActionType, secondaryActionText, |
| 56 secondaryActionType, mediaRouteId, isBlocking, |
| 57 helpURL) { |
| 58 /** @type {string} */ |
| 59 this.id = id; |
| 60 |
| 61 /** @type {string} */ |
| 62 this.title = title; |
| 63 |
| 64 /** @type {string} */ |
| 65 this.message = message; |
| 66 |
| 67 /** @type {string} */ |
| 68 this.defaultActionText = defaultActionText; |
| 69 |
| 70 /** @type {number} */ |
| 71 this.defaultActionType = defaultActionType; |
| 72 |
| 73 /** @type {?string} */ |
| 74 this.secondaryActionText = secondaryActionText; |
| 75 |
| 76 /** @type {?number} */ |
| 77 this.secondaryActionType = secondaryActionType; |
| 78 |
| 79 /** @type {?string} */ |
| 80 this.mediaRouteId = mediaRouteId; |
| 81 |
| 82 /** @type {boolean} */ |
| 83 this.isBlocking = isBlocking; |
| 84 |
| 85 /** @type {?string} */ |
| 86 this.helpURL = helpURL; |
| 87 }; |
| 88 |
| 89 |
| 90 /** |
| 91 * @param {string} id The media route ID. |
| 92 * @param {string} sinkId The ID of the media sink running this route. |
| 93 * @param {string} title The short description of this route. |
| 94 * @param {?number} tabId The ID of the tab in which web app is running and |
| 95 * accessing the route. |
| 96 * @param {boolean} isLocal True if this is a locally created route. |
| 97 * @constructor |
| 98 * @struct |
| 99 */ |
| 100 var Route = function(id, sinkId, title, tabId, isLocal) { |
| 101 /** @type {string} */ |
| 102 this.id = id; |
| 103 |
| 104 /** @type {string} */ |
| 105 this.sinkId = sinkId; |
| 106 |
| 107 /** @type {string} */ |
| 108 this.title = title; |
| 109 |
| 110 /** @type {?number} */ |
| 111 this.tabId = tabId; |
| 112 |
| 113 /** @type {boolean} */ |
| 114 this.isLocal = isLocal; |
| 115 }; |
| 116 |
| 117 |
| 118 /** |
| 119 * @param {string} id The ID of the media sink. |
| 120 * @param {string} name The name of the sink. |
| 121 * @param {media_router.SinkStatus} status The readiness state of the sink. |
| 122 * @param {!Array<number>} castModes Cast modes compatible with the sink. |
| 123 * @constructor |
| 124 * @struct |
| 125 */ |
| 126 var Sink = function(id, name, status) { |
| 127 /** @type {string} */ |
| 128 this.id = id; |
| 129 |
| 130 /** @type {string} */ |
| 131 this.name = name; |
| 132 |
| 133 /** @type {media_router.SinkStatus} */ |
| 134 this.status = status; |
| 135 |
| 136 /** @type {!Array<number>} */ |
| 137 this.castModes = castModes; |
| 138 }; |
| 139 |
| 140 |
| 141 /** |
| 142 * @param {number} tabId The current tab ID. |
| 143 * @param {string} domain The domain of the current tab. |
| 144 * @constructor |
| 145 * @struct |
| 146 */ |
| 147 var TabInfo = function(tabId, domain) { |
| 148 /** @type {number} */ |
| 149 this.tabId = tabId; |
| 150 |
| 151 /** @type {string} */ |
| 152 this.domain = domain; |
| 153 }; |
| 154 |
| 155 return { |
| 156 SinkStatus: SinkStatus, |
| 157 CastMode: CastMode, |
| 158 Issue: Issue, |
| 159 Route: Route, |
| 160 Sink: Sink, |
| 161 TabInfo: TabInfo, |
| 162 }; |
| 163 }); |
OLD | NEW |