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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 /** | 380 /** |
381 * Sinks to show for the currently selected cast mode. | 381 * Sinks to show for the currently selected cast mode. |
382 * @private {!Array<!media_router.Sink>|undefined} | 382 * @private {!Array<!media_router.Sink>|undefined} |
383 */ | 383 */ |
384 sinksToShow_: { | 384 sinksToShow_: { |
385 type: Array, | 385 type: Array, |
386 observer: 'updateElementPositioning_', | 386 observer: 'updateElementPositioning_', |
387 }, | 387 }, |
388 | 388 |
389 /** | 389 /** |
390 * Whether the new WebUI route controls should be shown instead of the | |
apacible
2017/05/17 21:52:17
Please avoid using "new" or "old" since this will
takumif
2017/05/18 18:01:55
Removed 'new'. I think calling it 'WebUI route con
apacible
2017/05/24 20:28:26
SGTM.
| |
391 * extensionview in the route details view. | |
392 * @type {boolean} | |
393 */ | |
394 useWebUiRouteControls: { | |
395 type: Boolean, | |
396 value: false, | |
397 }, | |
398 | |
399 /** | |
390 * Whether the user has explicitly selected a cast mode. | 400 * Whether the user has explicitly selected a cast mode. |
391 * @private {boolean} | 401 * @private {boolean} |
392 */ | 402 */ |
393 userHasSelectedCastMode_: { | 403 userHasSelectedCastMode_: { |
394 type: Boolean, | 404 type: Boolean, |
395 value: false, | 405 value: false, |
396 }, | 406 }, |
397 | 407 |
398 /** | 408 /** |
399 * Whether the user has already taken an action. | 409 * Whether the user has already taken an action. |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1063 return Math.min(contentHeight, maxHeight) + searchOffsetHeight; | 1073 return Math.min(contentHeight, maxHeight) + searchOffsetHeight; |
1064 }, | 1074 }, |
1065 | 1075 |
1066 /** | 1076 /** |
1067 * Updates element positioning when the view changes and possibly triggers | 1077 * Updates element positioning when the view changes and possibly triggers |
1068 * reporting of a user filter action. If there is no filter text, it defers | 1078 * reporting of a user filter action. If there is no filter text, it defers |
1069 * the reporting until some text is entered, but otherwise it reports the | 1079 * the reporting until some text is entered, but otherwise it reports the |
1070 * filter action here. | 1080 * filter action here. |
1071 * @param {?media_router.MediaRouterView} currentView The current view of the | 1081 * @param {?media_router.MediaRouterView} currentView The current view of the |
1072 * dialog. | 1082 * dialog. |
1083 * @param {?media_router.MediaRouterView} previousView The old current view | |
apacible
2017/05/17 21:52:17
nit: "The previous |currentView|" may be more expl
takumif
2017/05/18 18:01:55
Done.
| |
1084 * of the dialog. | |
1073 * @private | 1085 * @private |
1074 */ | 1086 */ |
1075 currentViewChanged_: function(currentView) { | 1087 currentViewChanged_: function(currentView, previousView) { |
1076 if (currentView == media_router.MediaRouterView.FILTER) { | 1088 if (currentView == media_router.MediaRouterView.FILTER) { |
1077 this.reportFilterOnInput_ = true; | 1089 this.reportFilterOnInput_ = true; |
1078 this.maybeReportFilter_(); | 1090 this.maybeReportFilter_(); |
1079 } | 1091 } |
1080 this.updateElementPositioning_(); | 1092 this.updateElementPositioning_(); |
1093 | |
1094 if (previousView == media_router.MediaRouterView.ROUTE_DETAILS) { | |
1095 media_router.browserApi.onMediaControllerClosed(); | |
1096 if (this.$$('route-details')) | |
1097 this.$$('route-details').onClosed(); | |
1098 } | |
1081 }, | 1099 }, |
1082 | 1100 |
1083 /** | 1101 /** |
1084 * Filters all sinks based on fuzzy matching to the currently entered search | 1102 * Filters all sinks based on fuzzy matching to the currently entered search |
1085 * text. | 1103 * text. |
1086 * @param {string} searchInputText The currently entered search text. | 1104 * @param {string} searchInputText The currently entered search text. |
1087 * @private | 1105 * @private |
1088 */ | 1106 */ |
1089 filterSinks_: function(searchInputText) { | 1107 filterSinks_: function(searchInputText) { |
1090 if (searchInputText.length == 0) { | 1108 if (searchInputText.length == 0) { |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1739 this.pseudoSinkSearchState_.checkForRealSink(this.allSinks); | 1757 this.pseudoSinkSearchState_.checkForRealSink(this.allSinks); |
1740 this.rebuildSinksToShow_(); | 1758 this.rebuildSinksToShow_(); |
1741 // If we're in filter view, make sure the |sinksToShow_| change is picked | 1759 // If we're in filter view, make sure the |sinksToShow_| change is picked |
1742 // up. | 1760 // up. |
1743 if (this.currentView_ == media_router.MediaRouterView.FILTER) { | 1761 if (this.currentView_ == media_router.MediaRouterView.FILTER) { |
1744 this.filterSinks_(this.searchInputText_); | 1762 this.filterSinks_(this.searchInputText_); |
1745 } | 1763 } |
1746 }, | 1764 }, |
1747 | 1765 |
1748 /** | 1766 /** |
1767 * Called when the connection to the route controller is invalidated. Switches | |
1768 * from route details view to the sink list view. | |
1769 */ | |
1770 onRouteControllerInvalidated: function() { | |
1771 if (this.useWebUiRouteControls && | |
1772 this.currentView_ == media_router.MediaRouterView.ROUTE_DETAILS) { | |
1773 this.currentRoute_ = null; | |
1774 this.showSinkList_(); | |
1775 } | |
1776 }, | |
1777 | |
1778 /** | |
1749 * Called when a sink is clicked. | 1779 * Called when a sink is clicked. |
1750 * | 1780 * |
1751 * @param {!Event} event The event object. | 1781 * @param {!Event} event The event object. |
1752 * @private | 1782 * @private |
1753 */ | 1783 */ |
1754 onSinkClick_: function(event) { | 1784 onSinkClick_: function(event) { |
1755 var clickedSink = | 1785 var clickedSink = |
1756 (this.currentView_ == media_router.MediaRouterView.FILTER) ? | 1786 (this.currentView_ == media_router.MediaRouterView.FILTER) ? |
1757 this.$$('#searchResults').itemForElement(event.target).sinkItem : | 1787 this.$$('#searchResults').itemForElement(event.target).sinkItem : |
1758 this.$$('#sinkList').itemForElement(event.target); | 1788 this.$$('#sinkList').itemForElement(event.target); |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2249 | 2279 |
2250 /** | 2280 /** |
2251 * Shows the route details. | 2281 * Shows the route details. |
2252 * | 2282 * |
2253 * @param {!media_router.Route} route The route to show. | 2283 * @param {!media_router.Route} route The route to show. |
2254 * @private | 2284 * @private |
2255 */ | 2285 */ |
2256 showRouteDetails_: function(route) { | 2286 showRouteDetails_: function(route) { |
2257 this.currentRoute_ = route; | 2287 this.currentRoute_ = route; |
2258 this.currentView_ = media_router.MediaRouterView.ROUTE_DETAILS; | 2288 this.currentView_ = media_router.MediaRouterView.ROUTE_DETAILS; |
2289 if (this.useWebUiRouteControls) { | |
2290 media_router.browserApi.onMediaControllerAvailable(route.id); | |
2291 } | |
2292 if (this.$$('route-details')) { | |
2293 this.$$('route-details').onOpened(); | |
2294 } | |
2259 }, | 2295 }, |
2260 | 2296 |
2261 /** | 2297 /** |
2262 * Shows the search results. | 2298 * Shows the search results. |
2263 * | 2299 * |
2264 * @private | 2300 * @private |
2265 */ | 2301 */ |
2266 showSearchResults_: function() { | 2302 showSearchResults_: function() { |
2267 if (this.currentView_ != media_router.MediaRouterView.FILTER) { | 2303 if (this.currentView_ != media_router.MediaRouterView.FILTER) { |
2268 this.currentView_ = media_router.MediaRouterView.FILTER; | 2304 this.currentView_ = media_router.MediaRouterView.FILTER; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2366 /** | 2402 /** |
2367 * Update the max dialog height and update the positioning of the elements. | 2403 * Update the max dialog height and update the positioning of the elements. |
2368 * | 2404 * |
2369 * @param {number} height The max height of the Media Router dialog. | 2405 * @param {number} height The max height of the Media Router dialog. |
2370 */ | 2406 */ |
2371 updateMaxDialogHeight: function(height) { | 2407 updateMaxDialogHeight: function(height) { |
2372 this.dialogHeight_ = height; | 2408 this.dialogHeight_ = height; |
2373 this.updateElementPositioning_(); | 2409 this.updateElementPositioning_(); |
2374 }, | 2410 }, |
2375 }); | 2411 }); |
OLD | NEW |