OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This Polymer element contains the entire media router interface. It handles | 5 // This Polymer element contains the entire media router interface. It handles |
6 // hiding and showing specific components. | 6 // hiding and showing specific components. |
7 Polymer({ | 7 Polymer({ |
8 is: 'media-router-container', | 8 is: 'media-router-container', |
9 | 9 |
10 properties: { | 10 properties: { |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
846 | 846 |
847 /** | 847 /** |
848 * Computes whether the search results list should be hidden. | 848 * Computes whether the search results list should be hidden. |
849 * @param {!Array<!{sinkItem: !media_router.Sink, | 849 * @param {!Array<!{sinkItem: !media_router.Sink, |
850 * substrings: Array<!Array<number>>}>} searchResultsToShow | 850 * substrings: Array<!Array<number>>}>} searchResultsToShow |
851 * The sinks currently matching the search text. | 851 * The sinks currently matching the search text. |
852 * @param {boolean} isSearchListHidden Whether the search list is hidden. | 852 * @param {boolean} isSearchListHidden Whether the search list is hidden. |
853 * @return {boolean} Whether the search results list should be hidden. | 853 * @return {boolean} Whether the search results list should be hidden. |
854 * @private | 854 * @private |
855 */ | 855 */ |
856 computeSearchResultsHidden_: function(searchResultsToShow, | 856 computeSearchResultsHidden_: function( |
857 isSearchListHidden) { | 857 searchResultsToShow, isSearchListHidden) { |
858 return isSearchListHidden || searchResultsToShow.length == 0; | 858 return isSearchListHidden || searchResultsToShow.length == 0; |
859 }, | 859 }, |
860 | 860 |
861 /** | 861 /** |
862 * @param {!Array<!media_router.CastMode>} castModeList The current list of | 862 * @param {!Array<!media_router.CastMode>} castModeList The current list of |
863 * cast modes. | 863 * cast modes. |
864 * @return {boolean} Whether or not to hide the share screen subheading text. | 864 * @return {boolean} Whether or not to hide the share screen subheading text. |
865 * @private | 865 * @private |
866 */ | 866 */ |
867 computeShareScreenSubheadingHidden_: function(castModeList) { | 867 computeShareScreenSubheadingHidden_: function(castModeList) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 return Math.min(contentHeight, maxHeight) + searchOffsetHeight; | 1061 return Math.min(contentHeight, maxHeight) + searchOffsetHeight; |
1062 }, | 1062 }, |
1063 | 1063 |
1064 /** | 1064 /** |
1065 * Updates element positioning when the view changes and possibly triggers | 1065 * Updates element positioning when the view changes and possibly triggers |
1066 * reporting of a user filter action. If there is no filter text, it defers | 1066 * reporting of a user filter action. If there is no filter text, it defers |
1067 * the reporting until some text is entered, but otherwise it reports the | 1067 * the reporting until some text is entered, but otherwise it reports the |
1068 * filter action here. | 1068 * filter action here. |
1069 * @param {?media_router.MediaRouterView} currentView The current view of the | 1069 * @param {?media_router.MediaRouterView} currentView The current view of the |
1070 * dialog. | 1070 * dialog. |
1071 * @param {?media_router.MediaRouterView} oldCurrentView The old current view | |
1072 * of the dialog. | |
1071 * @private | 1073 * @private |
1072 */ | 1074 */ |
1073 currentViewChanged_: function(currentView) { | 1075 currentViewChanged_: function(currentView, oldCurrentView) { |
1074 if (currentView == media_router.MediaRouterView.FILTER) { | 1076 if (currentView == media_router.MediaRouterView.FILTER) { |
1075 this.reportFilterOnInput_ = true; | 1077 this.reportFilterOnInput_ = true; |
1076 this.maybeReportFilter_(); | 1078 this.maybeReportFilter_(); |
1077 } | 1079 } |
1078 this.updateElementPositioning_(); | 1080 this.updateElementPositioning_(); |
1081 | |
1082 if (oldCurrentView == media_router.MediaRouterView.ROUTE_DETAILS) { | |
1083 this.fire('close-route-details'); | |
1084 } | |
1079 }, | 1085 }, |
1080 | 1086 |
1081 /** | 1087 /** |
1082 * Filters all sinks based on fuzzy matching to the currently entered search | 1088 * Filters all sinks based on fuzzy matching to the currently entered search |
1083 * text. | 1089 * text. |
1084 * @param {string} searchInputText The currently entered search text. | 1090 * @param {string} searchInputText The currently entered search text. |
1085 * @private | 1091 * @private |
1086 */ | 1092 */ |
1087 filterSinks_: function(searchInputText) { | 1093 filterSinks_: function(searchInputText) { |
1088 if (searchInputText.length == 0) { | 1094 if (searchInputText.length == 0) { |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2247 | 2253 |
2248 /** | 2254 /** |
2249 * Shows the route details. | 2255 * Shows the route details. |
2250 * | 2256 * |
2251 * @param {!media_router.Route} route The route to show. | 2257 * @param {!media_router.Route} route The route to show. |
2252 * @private | 2258 * @private |
2253 */ | 2259 */ |
2254 showRouteDetails_: function(route) { | 2260 showRouteDetails_: function(route) { |
2255 this.currentRoute_ = route; | 2261 this.currentRoute_ = route; |
2256 this.currentView_ = media_router.MediaRouterView.ROUTE_DETAILS; | 2262 this.currentView_ = media_router.MediaRouterView.ROUTE_DETAILS; |
2263 this.fire('open-route-details', {routeId: route.id}); | |
2257 }, | 2264 }, |
2258 | 2265 |
2259 /** | 2266 /** |
2260 * Shows the search results. | 2267 * Shows the search results. |
2261 * | 2268 * |
2262 * @private | 2269 * @private |
2263 */ | 2270 */ |
2264 showSearchResults_: function() { | 2271 showSearchResults_: function() { |
2265 if (this.currentView_ != media_router.MediaRouterView.FILTER) { | 2272 if (this.currentView_ != media_router.MediaRouterView.FILTER) { |
2266 this.currentView_ = media_router.MediaRouterView.FILTER; | 2273 this.currentView_ = media_router.MediaRouterView.FILTER; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2363 | 2370 |
2364 /** | 2371 /** |
2365 * Update the max dialog height and update the positioning of the elements. | 2372 * Update the max dialog height and update the positioning of the elements. |
2366 * | 2373 * |
2367 * @param {number} height The max height of the Media Router dialog. | 2374 * @param {number} height The max height of the Media Router dialog. |
2368 */ | 2375 */ |
2369 updateMaxDialogHeight: function(height) { | 2376 updateMaxDialogHeight: function(height) { |
2370 this.dialogHeight_ = height; | 2377 this.dialogHeight_ = height; |
2371 this.updateElementPositioning_(); | 2378 this.updateElementPositioning_(); |
2372 }, | 2379 }, |
2380 | |
2381 /** | |
2382 * Updates the route status shown in the details view. | |
2383 * | |
2384 * @param {!media_router.RouteStatus} status | |
2385 */ | |
2386 updateRouteStatus: function(status) { | |
imcheng
2017/03/02 02:25:47
Can the media status be passed to the route detail
takumif
2017/03/08 23:34:58
To do that, the route details must register/unregi
imcheng
2017/03/11 21:57:38
My thinking is that the WebUI needs to signal to t
takumif
2017/03/16 20:16:02
Okay, giving media_router.ui a |routeControls| att
| |
2387 var routeDetails = this.$$('route-details'); | |
2388 if (routeDetails) { | |
2389 routeDetails.routeStatus = status; | |
2390 } | |
2391 }, | |
2373 }); | 2392 }); |
OLD | NEW |