Commit 3f271cee authored by apacible's avatar apacible Committed by Commit bot

Add Media Router JS structs.

These will be used in the Media Router WebUI custom Polymer elements, which will be submitted in future patches.

BUG=464222

Review URL: https://codereview.chromium.org/1029213002

Cr-Commit-Position: refs/heads/master@{#322173}
parent 830ef00e
...@@ -448,6 +448,7 @@ ...@@ -448,6 +448,7 @@
<include name="IDR_MD_SETTINGS_UI_HTML" file="resources\md_settings\md_settings.html" type="BINDATA" /> <include name="IDR_MD_SETTINGS_UI_HTML" file="resources\md_settings\md_settings.html" type="BINDATA" />
<include name="IDR_MD_SETTINGS_UI_CSS" file="resources\md_settings\md_settings.css" type="BINDATA" /> <include name="IDR_MD_SETTINGS_UI_CSS" file="resources\md_settings\md_settings.css" type="BINDATA" />
<if expr="enable_media_router"> <if expr="enable_media_router">
<include name="IDR_MEDIA_ROUTER_DATA_JS" file="resources\media_router\media_router_data.js" type="BINDATA" />
<include name="IDR_MEDIA_ROUTER_CHROMECAST_ICON" file="resources\media_router\elements\icon\chromecast-icon.png" type="BINDATA" /> <include name="IDR_MEDIA_ROUTER_CHROMECAST_ICON" file="resources\media_router\elements\icon\chromecast-icon.png" type="BINDATA" />
<include name="IDR_MEDIA_ROUTER_CHROMECAST_2X_ICON" file="resources\media_router\elements\icon\chromecast-icon2x.png" type="BINDATA" /> <include name="IDR_MEDIA_ROUTER_CHROMECAST_2X_ICON" file="resources\media_router\elements\icon\chromecast-icon2x.png" type="BINDATA" />
<include name="IDR_CLOSE_GRAY_ICON" file="resources\media_router\elements\icon\close-gray.png" type="BINDATA" /> <include name="IDR_CLOSE_GRAY_ICON" file="resources\media_router\elements\icon\close-gray.png" type="BINDATA" />
......
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Any strings used here will already be localized. Values such as castMode or
// IDs will be defined elsewhere and determined later.
cr.define('media_router', function() {
'use strict';
/**
* @enum {string}
*/
var SinkStatus = {
IDLE: 'idle',
ACTIVE: 'active',
REQUEST_PENDING: 'request_pending'
};
/**
* @param {number} castMode The type of cast mode.
* @param {string} title The title of the cast mode.
* @param {string} description The description of the cast mode.
* @constructor
* @struct
*/
var CastMode = function(castMode, title, description) {
/** @type {number} */
this.castMode = castMode;
/** @type {string} */
this.title = title;
/** @type {string} */
this.description = description;
};
/**
* @param {string} id The ID of this issue.
* @param {string} title The issue title.
* @param {string} message The issue message.
* @param {string} defaultActionText The button text of default action.
* @param {number} defaultActionType The type of default action.
* @param {?string} secondaryActionText The button text of optional action.
* @param {?number} secondaryActionType The type of optional action.
* @param {?string} mediaRouteId The route ID to which this issue
* pertains. If not set, this is a global issue.
* @param {boolean} isBlocking True if this issue blocks other UI.
* @param {?string} helpURL The URL to be opened if learn more is clicked.
* @constructor
* @struct
*/
var Issue = function(id, title, message, defaultActionText,
defaultActionType, secondaryActionText,
secondaryActionType, mediaRouteId, isBlocking,
helpURL) {
/** @type {string} */
this.id = id;
/** @type {string} */
this.title = title;
/** @type {string} */
this.message = message;
/** @type {string} */
this.defaultActionText = defaultActionText;
/** @type {number} */
this.defaultActionType = defaultActionType;
/** @type {?string} */
this.secondaryActionText = secondaryActionText;
/** @type {?number} */
this.secondaryActionType = secondaryActionType;
/** @type {?string} */
this.mediaRouteId = mediaRouteId;
/** @type {boolean} */
this.isBlocking = isBlocking;
/** @type {?string} */
this.helpURL = helpURL;
};
/**
* @param {string} id The media route ID.
* @param {string} sinkId The ID of the media sink running this route.
* @param {string} title The short description of this route.
* @param {?number} tabId The ID of the tab in which web app is running and
* accessing the route.
* @param {boolean} isLocal True if this is a locally created route.
* @constructor
* @struct
*/
var Route = function(id, sinkId, title, tabId, isLocal) {
/** @type {string} */
this.id = id;
/** @type {string} */
this.sinkId = sinkId;
/** @type {string} */
this.title = title;
/** @type {?number} */
this.tabId = tabId;
/** @type {boolean} */
this.isLocal = isLocal;
};
/**
* @param {string} id The ID of the media sink.
* @param {string} name The name of the sink.
* @param {media_router.SinkStatus} status The readiness state of the sink.
* @param {!Array<number>} castModes Cast modes compatible with the sink.
* @constructor
* @struct
*/
var Sink = function(id, name, status) {
/** @type {string} */
this.id = id;
/** @type {string} */
this.name = name;
/** @type {media_router.SinkStatus} */
this.status = status;
/** @type {!Array<number>} */
this.castModes = castModes;
};
/**
* @param {number} tabId The current tab ID.
* @param {string} domain The domain of the current tab.
* @constructor
* @struct
*/
var TabInfo = function(tabId, domain) {
/** @type {number} */
this.tabId = tabId;
/** @type {string} */
this.domain = domain;
};
return {
SinkStatus: SinkStatus,
CastMode: CastMode,
Issue: Issue,
Route: Route,
Sink: Sink,
TabInfo: TabInfo,
};
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment