Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4967)

Unified Diff: chrome/browser/resources/media_router/media_router_data.js

Issue 1029213002: Add Media Router JS structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/media_router/media_router_data.js
diff --git a/chrome/browser/resources/media_router/media_router_data.js b/chrome/browser/resources/media_router/media_router_data.js
new file mode 100644
index 0000000000000000000000000000000000000000..2e6d8ee91434b7f853bfddd84ee6b2b5f887ac46
--- /dev/null
+++ b/chrome/browser/resources/media_router/media_router_data.js
@@ -0,0 +1,163 @@
+// 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.
+
+cr.define('media_router', function() {
+ 'use strict';
+
+ /**
+ * @param {number} castMode The type of cast mode.
mark a. foltz 2015/03/24 18:09:16 Where are legal values defined?
apacible 2015/03/24 20:46:26 RE: all legal values questions -- These are all de
+ * @param {string} title The title of the cast mode.
mark a. foltz 2015/03/24 18:09:17 Is the title and description for internal use, or
apacible 2015/03/24 20:46:26 The description is shown. RE: all localization qu
+ * @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;
+ };
+
+ /**
James Hawkins 2015/03/24 17:48:06 nit: Double blank lines between top-level JSDoc bl
apacible 2015/03/24 20:46:26 Done.
+ * @param {string} id The ID of this issue.
mark a. foltz 2015/03/24 18:09:15 What are legal values? Are these defined somewher
apacible 2015/03/24 20:46:26 Issue IDs are created in Media Router using Genera
+ * @param {string} title The issue title.
mark a. foltz 2015/03/24 18:09:16 Similar questions about localization for all the s
apacible 2015/03/24 20:46:27 Acknowledged.
+ * @param {string} message The issue message.
+ * @param {string} defaultActionText The button text of default action.
mark a. foltz 2015/03/24 18:09:16 What if the text overflows the dimensions of the b
apacible 2015/03/24 20:46:26 We'll need to talk to UX about this (and all other
+ * @param {number} defaultActionType The type of default action.
mark a. foltz 2015/03/24 18:09:16 Where are the types defined?
apacible 2015/03/24 20:46:26 Acknowledged.
+ * @param {?string} optActionText The button text of optional action.
+ * @param {?number} optActionType The type of optional action.
mark a. foltz 2015/03/24 18:09:16 Where are the types defined?
apacible 2015/03/24 20:46:26 Acknowledged.
+ * @param {?string} routeId The route ID to which this issue
mark a. foltz 2015/03/24 18:09:17 mediaRouteId
apacible 2015/03/24 20:46:26 Done.
+ * pertains. If not set, this is a global issue.
mark a. foltz 2015/03/24 18:09:16 What if the issue occurred before or after the rou
apacible 2015/03/24 20:46:26 We currently don't have screen-specific issues. If
+ * @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, optActionText, optActionType,
James Hawkins 2015/03/24 17:48:06 nit: opt_actionText, opt_actionType
apacible 2015/03/24 20:46:26 Ack, question in next comment before I change this
+ routeId, 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.optActionText = optActionText;
James Hawkins 2015/03/24 17:48:06 nit: Only the parameter should have 'opt' in the n
apacible 2015/03/24 20:46:26 Why is 'opt' restricted to the parameter? Should
James Hawkins 2015/03/24 21:27:56 Because the member variable itself is not optional
apacible 2015/03/24 21:58:11 Thanks! Also, should I prepend all optional parame
+
+ /** @type {?number} */
+ this.optActionType = optActionType;
+
+ /** @type {?string} */
+ this.routeId = routeId;
+
+ /** @type {boolean} */
+ this.isBlocking = isBlocking;
+
+ /** @type {?string} */
+ this.helpURL = helpURL;
+ };
+
+ /**
+ * @param {string} id The route ID.
mark a. foltz 2015/03/24 18:09:15 The media route ID
apacible 2015/03/24 20:46:26 Done.
+ * @param {string} sinkId The ID of the sink running this route.
mark a. foltz 2015/03/24 18:09:15 "the media sink"
apacible 2015/03/24 20:46:26 Done.
+ * @param {?string} iconUrl The icon URL of this route.
mark a. foltz 2015/03/24 18:09:16 This should just point to a bundled resource, corr
apacible 2015/03/24 20:46:27 This is the favicon of whatever we're casting. Tal
+ * @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 launched route.
mark a. foltz 2015/03/24 18:09:16 s/launched/created/
apacible 2015/03/24 20:46:27 Done.
+ * @constructor
+ * @struct
+ */
+ var Route = function(id, sinkId, iconUrl, title, tabId, isLocal) {
+ /** @type {string} */
+ this.id = id;
+
+ /** @type {string} */
+ this.sinkId = sinkId;
+
+ /** @type {?string} */
+ this.iconUrl = iconUrl;
+
+ /** @type {string} */
+ this.title = title;
+
+ /** @type {?number} */
+ this.tabId = tabId;
+
+ /** @type {boolean} */
+ this.isLocal = isLocal;
+ };
+
+ /**
+ * @param {string} id The ID of the sink.
mark a. foltz 2015/03/24 18:09:17 "the media sink"
apacible 2015/03/24 20:46:26 Done.
+ * @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;
+ };
+
+ /**
+ * @enum {string}
+ */
+ var SinkStatus = {
James Hawkins 2015/03/24 17:48:06 Consider moving SinkStatus higher up (at least hig
apacible 2015/03/24 20:46:26 Moved to top.
+ IDLE: 'idle',
+ ACTIVE: 'active',
+ REQUEST_PENDING: 'request_pending'
+ };
+
+ /**
+ * @param {number} tabId The current tab ID.
+ * @param {string} domain The domain of the current tab.
+ * @param {boolean} hasCastApp True if tab has a current Cast App.
mark a. foltz 2015/03/24 18:09:16 When is this set to true? Does it mean to say "an
apacible 2015/03/24 20:46:26 It's when the tab has a current cast app (e.g. You
+ * @constructor
+ * @struct
+ */
+ var TabInfo = function(tabId, domain, hasCastApp) {
+ /** @type {number} */
+ this.tabId = tabId;
+
+ /** @type {string} */
+ this.domain = domain;
+
+ /** @type {boolean} */
+ this.hasCastApp = hasCastApp;
+ };
+
+ return {
+ CastMode: CastMode,
+ Issue: Issue,
+ Route: Route,
+ Sink: Sink,
+ SinkStatus: SinkStatus,
+ TabInfo: TabInfo,
+ };
+});
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698