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

Unified Diff: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js

Issue 1415533019: [Media Router] Use common media-router-header for MR UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per imcheng@'s comments. Created 5 years, 1 month 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
Index: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
index a94a0c4ec513393d4779e6453c97743a43ca3ed9..aa86c5cb4235735d15d2310b11a48f34a7b7e38a 100644
--- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
+++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -100,6 +100,17 @@ Polymer({
issue: {
type: Object,
value: null,
+ observer: 'maybeShowIssueView_',
+ },
+
+ /**
+ * The header text.
+ * @private {string}
+ */
+ issueHeaderText_: {
+ type: String,
+ readOnly: true,
+ value: loadTimeData.getString('issueHeader'),
},
/**
@@ -301,10 +312,15 @@ Polymer({
*/
computeHeaderText_: function(view, headerText) {
switch (view) {
- case media_router.MediaRouterView.SINK_LIST:
- return this.headerText;
case media_router.MediaRouterView.CAST_MODE_LIST:
return this.selectCastModeHeaderText_;
+ case media_router.MediaRouterView.ISSUE:
+ return this.issueHeaderText_;
+ case media_router.MediaRouterView.ROUTE_DETAILS:
+ return this.currentRoute_ ?
+ this.sinkMap_[this.currentRoute_.sinkId].name : '';
+ case media_router.MediaRouterView.SINK_LIST:
+ return this.headerText;
default:
return '';
}
@@ -405,15 +421,6 @@ Polymer({
},
/**
- * @param {?media_router.Route} route The current route.
- * @return {?media_router.Sink} The sink associated with |route|.
- * @private
- */
- computeSinkForCurrentRoute_: function(route) {
- return route ? this.sinkMap_[route.sinkId] : null;
- },
-
- /**
* @param {!media_router.Sink} sink The sink to determine an icon for.
* @return {string} The Polymer <iron-icon> icon to use. The format is
* <iconset>:<icon>, where <iconset> is the set ID and <icon> is the name
@@ -532,6 +539,17 @@ Polymer({
},
/**
+ * Updates |currentView_| if there is a new blocking issue.
+ *
+ * @param {?media_router.Issue} issue The new issue.
+ * @private
+ */
+ maybeShowIssueView_: function(issue) {
+ if (!!issue && issue.isBlocking)
+ this.currentView_ = media_router.MediaRouterView.ISSUE;
+ },
+
+ /**
* Handles a cast mode selection. Updates |headerText|, |headerTextTooltip|,
* and |selectedCastModeValue_|.
*

Powered by Google App Engine
This is Rietveld 408576698