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

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

Issue 2040873002: [Media Router] Assign each route a current cast mode if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 d58a5ac8286a0b1555746cb36be4af4afd094faa..7309fd874dc634947c872e15696e0ef991c1d6f8 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
@@ -707,6 +707,18 @@ Polymer({
},
/**
+ * @param {?Element} element Element to compute padding for.
+ * @return {number} Computes the amount of vertical padding (top + bottom) on
+ * |element|.
+ * @private
+ */
+ computeElementVerticalPadding_: function(element) {
+ var paddingBottom, paddingTop;
+ [paddingBottom, paddingTop] = this.getElementVerticalPadding_(element);
+ return paddingBottom + paddingTop;
+ },
+
+ /**
* @param {?media_router.MediaRouterView} view The current view.
* @param {?media_router.Issue} issue The current issue.
* @return {boolean} Whether or not to hide the header.
@@ -809,6 +821,38 @@ Polymer({
},
/**
+ * @param {?media_router.Route|undefined} currentRoute The current route for
+ * the route details view.
+ * @param {string} currentLaunchingSinkId ID of the currently launching sink
+ * or the empty string if no sink is launching.
+ * @param {number} shownCastModeValue Currently selected cast mode value or
+ * AUTO if no value has been explicitly selected.
+ * @return {boolean} Whether the replace route function should be available
+ * when displaying |currentRoute| in the route details view. Replace route
+ * should not be available when the source that would be cast from when
+ * creating a new route would be the same as the route's current source.
+ * @private
+ */
+ computeReplaceRouteAvailable_: function(
+ currentRoute, currentLaunchingSinkId, shownCastModeValue) {
+ if (currentLaunchingSinkId || !currentRoute) {
+ return false;
+ }
+ if (!currentRoute.currentCastMode) {
+ return true;
+ }
+ var selectedCastMode = shownCastModeValue;
+ if (selectedCastMode == media_router.CastModeType.AUTO) {
+ var sink = this.sinkMap_[currentRoute.sinkId];
+ if (!sink) {
+ return false;
+ }
+ selectedCastMode = sink.castModes & -sink.castModes;
+ }
+ return selectedCastMode != currentRoute.currentCastMode;
+ },
+
+ /**
* @param {?media_router.MediaRouterView} view The current view.
* @param {?media_router.Issue} issue The current issue.
* @return {boolean} Whether or not to hide the route details.
@@ -820,18 +864,6 @@ Polymer({
},
/**
- * @param {?Element} element Element to compute padding for.
- * @return {number} Computes the amount of vertical padding (top + bottom) on
- * |element|.
- * @private
- */
- computeElementVerticalPadding_: function(element) {
- var paddingBottom, paddingTop;
- [paddingBottom, paddingTop] = this.getElementVerticalPadding_(element);
- return paddingBottom + paddingTop;
- },
-
- /**
* Computes an array of substring indices that mark where substrings of
* |searchString| occur in |sinkName|.
*

Powered by Google App Engine
This is Rietveld 408576698