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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 value: '', | 93 value: '', |
94 }, | 94 }, |
95 | 95 |
96 /** | 96 /** |
97 * The issue to show. | 97 * The issue to show. |
98 * @type {?media_router.Issue} | 98 * @type {?media_router.Issue} |
99 */ | 99 */ |
100 issue: { | 100 issue: { |
101 type: Object, | 101 type: Object, |
102 value: null, | 102 value: null, |
| 103 observer: 'maybeShowIssueView_', |
103 }, | 104 }, |
104 | 105 |
105 /** | 106 /** |
| 107 * The header text. |
| 108 * @private {string} |
| 109 */ |
| 110 issueHeaderText_: { |
| 111 type: String, |
| 112 readOnly: true, |
| 113 value: loadTimeData.getString('issueHeader'), |
| 114 }, |
| 115 |
| 116 /** |
106 * Whether the MR UI was just opened. | 117 * Whether the MR UI was just opened. |
107 * @private {boolean} | 118 * @private {boolean} |
108 */ | 119 */ |
109 justOpened_: { | 120 justOpened_: { |
110 type: Boolean, | 121 type: Boolean, |
111 value: true, | 122 value: true, |
112 observer: 'computeSpinnerHidden_', | 123 observer: 'computeSpinnerHidden_', |
113 }, | 124 }, |
114 | 125 |
115 /** | 126 /** |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 }, | 305 }, |
295 | 306 |
296 /** | 307 /** |
297 * @param {media_router.MediaRouterView} view The current view. | 308 * @param {media_router.MediaRouterView} view The current view. |
298 * @param {string} headerText The header text for the sink list. | 309 * @param {string} headerText The header text for the sink list. |
299 * @return {string} The text for the header. | 310 * @return {string} The text for the header. |
300 * @private | 311 * @private |
301 */ | 312 */ |
302 computeHeaderText_: function(view, headerText) { | 313 computeHeaderText_: function(view, headerText) { |
303 switch (view) { | 314 switch (view) { |
| 315 case media_router.MediaRouterView.CAST_MODE_LIST: |
| 316 return this.selectCastModeHeaderText_; |
| 317 case media_router.MediaRouterView.ISSUE: |
| 318 return this.issueHeaderText_; |
| 319 case media_router.MediaRouterView.ROUTE_DETAILS: |
| 320 return this.currentRoute_ ? |
| 321 this.sinkMap_[this.currentRoute_.sinkId].name : ''; |
304 case media_router.MediaRouterView.SINK_LIST: | 322 case media_router.MediaRouterView.SINK_LIST: |
305 return this.headerText; | 323 return this.headerText; |
306 case media_router.MediaRouterView.CAST_MODE_LIST: | |
307 return this.selectCastModeHeaderText_; | |
308 default: | 324 default: |
309 return ''; | 325 return ''; |
310 } | 326 } |
311 }, | 327 }, |
312 | 328 |
313 /** | 329 /** |
314 * @param {media_router.MediaRouterView} view The current view. | 330 * @param {media_router.MediaRouterView} view The current view. |
315 * @param {string} headerTooltip The tooltip for the header for the sink | 331 * @param {string} headerTooltip The tooltip for the header for the sink |
316 * list. | 332 * list. |
317 * @return {string} The tooltip for the header. | 333 * @return {string} The tooltip for the header. |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 * | 541 * |
526 * @param {?media_router.Route} route A local route. | 542 * @param {?media_router.Route} route A local route. |
527 * @private | 543 * @private |
528 */ | 544 */ |
529 maybeShowRouteDetailsOnOpen_: function(route) { | 545 maybeShowRouteDetailsOnOpen_: function(route) { |
530 if (this.localRouteCount_ == 1 && this.justOpened_ && route) | 546 if (this.localRouteCount_ == 1 && this.justOpened_ && route) |
531 this.showRouteDetails_(route); | 547 this.showRouteDetails_(route); |
532 }, | 548 }, |
533 | 549 |
534 /** | 550 /** |
| 551 * Updates |currentView_| if there is a new blocking issue. |
| 552 * |
| 553 * @param {?media_router.Issue} issue The new issue. |
| 554 * @private |
| 555 */ |
| 556 maybeShowIssueView_: function(issue) { |
| 557 if (!!issue && issue.isBlocking) |
| 558 this.currentView_ = media_router.MediaRouterView.ISSUE; |
| 559 }, |
| 560 |
| 561 /** |
535 * Handles a cast mode selection. Updates |headerText|, |headerTextTooltip|, | 562 * Handles a cast mode selection. Updates |headerText|, |headerTextTooltip|, |
536 * and |selectedCastModeValue_|. | 563 * and |selectedCastModeValue_|. |
537 * | 564 * |
538 * @param {!Event} event The event object. | 565 * @param {!Event} event The event object. |
539 * @private | 566 * @private |
540 */ | 567 */ |
541 onCastModeClick_: function(event) { | 568 onCastModeClick_: function(event) { |
542 // The clicked cast mode can come from one of two lists, | 569 // The clicked cast mode can come from one of two lists, |
543 // defaultCastModeList and nonDefaultCastModeList. | 570 // defaultCastModeList and nonDefaultCastModeList. |
544 var clickedMode = | 571 var clickedMode = |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 * | 813 * |
787 * @private | 814 * @private |
788 */ | 815 */ |
789 toggleCastModeHidden_: function() { | 816 toggleCastModeHidden_: function() { |
790 if (this.currentView_ == media_router.MediaRouterView.CAST_MODE_LIST) | 817 if (this.currentView_ == media_router.MediaRouterView.CAST_MODE_LIST) |
791 this.showSinkList_(); | 818 this.showSinkList_(); |
792 else | 819 else |
793 this.showCastModeList_(); | 820 this.showCastModeList_(); |
794 }, | 821 }, |
795 }); | 822 }); |
OLD | NEW |