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

Side by Side Diff: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js

Issue 2725503002: [Media Router] Custom Controls 4 - Implement details view WebUI (Closed)
Patch Set: Address Mark's comments Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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
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 web UI route controls should be shown instead of the
391 * extension view 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
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} oldCurrentView The old current view
1084 * of the dialog.
1073 * @private 1085 * @private
1074 */ 1086 */
1075 currentViewChanged_: function(currentView) { 1087 currentViewChanged_: function(currentView, oldCurrentView) {
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 (oldCurrentView == 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
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
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 media_router.browserApi.onMediaControllerAvailable(route.id);
imcheng 2017/05/05 21:36:40 Shouldn't this only be called if we are using the
takumif 2017/05/09 00:14:57 Yes, ready() should call onOpened() as well, since
2290 if (this.$$('route-details')) {
2291 this.$$('route-details').onOpened();
2292 }
2259 }, 2293 },
2260 2294
2261 /** 2295 /**
2262 * Shows the search results. 2296 * Shows the search results.
2263 * 2297 *
2264 * @private 2298 * @private
2265 */ 2299 */
2266 showSearchResults_: function() { 2300 showSearchResults_: function() {
2267 if (this.currentView_ != media_router.MediaRouterView.FILTER) { 2301 if (this.currentView_ != media_router.MediaRouterView.FILTER) {
2268 this.currentView_ = media_router.MediaRouterView.FILTER; 2302 this.currentView_ = media_router.MediaRouterView.FILTER;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 /** 2400 /**
2367 * Update the max dialog height and update the positioning of the elements. 2401 * Update the max dialog height and update the positioning of the elements.
2368 * 2402 *
2369 * @param {number} height The max height of the Media Router dialog. 2403 * @param {number} height The max height of the Media Router dialog.
2370 */ 2404 */
2371 updateMaxDialogHeight: function(height) { 2405 updateMaxDialogHeight: function(height) {
2372 this.dialogHeight_ = height; 2406 this.dialogHeight_ = height;
2373 this.updateElementPositioning_(); 2407 this.updateElementPositioning_();
2374 }, 2408 },
2375 }); 2409 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698