| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 * @param {!Array<!media_router.CastMode>} castModeList The current list of | 414 * @param {!Array<!media_router.CastMode>} castModeList The current list of |
| 399 * cast modes. | 415 * cast modes. |
| 400 * @return {boolean} Whether or not to hide the share screen subheading text. | 416 * @return {boolean} Whether or not to hide the share screen subheading text. |
| 401 * @private | 417 * @private |
| 402 */ | 418 */ |
| 403 computeShareScreenSubheadingHidden_: function(castModeList) { | 419 computeShareScreenSubheadingHidden_: function(castModeList) { |
| 404 return this.computeNonDefaultCastModeList_(castModeList).length == 0; | 420 return this.computeNonDefaultCastModeList_(castModeList).length == 0; |
| 405 }, | 421 }, |
| 406 | 422 |
| 407 /** | 423 /** |
| 408 * @param {?media_router.Route} route The current route. | |
| 409 * @return {?media_router.Sink} The sink associated with |route|. | |
| 410 * @private | |
| 411 */ | |
| 412 computeSinkForCurrentRoute_: function(route) { | |
| 413 return route ? this.sinkMap_[route.sinkId] : null; | |
| 414 }, | |
| 415 | |
| 416 /** | |
| 417 * @param {!media_router.Sink} sink The sink to determine an icon for. | 424 * @param {!media_router.Sink} sink The sink to determine an icon for. |
| 418 * @return {string} The Polymer <iron-icon> icon to use. The format is | 425 * @return {string} The Polymer <iron-icon> icon to use. The format is |
| 419 * <iconset>:<icon>, where <iconset> is the set ID and <icon> is the name | 426 * <iconset>:<icon>, where <iconset> is the set ID and <icon> is the name |
| 420 * of the icon. <iconset>: may be ommitted if <icon> is from the default | 427 * of the icon. <iconset>: may be ommitted if <icon> is from the default |
| 421 * set. | 428 * set. |
| 422 * @private | 429 * @private |
| 423 */ | 430 */ |
| 424 computeSinkIcon_: function(sink) { | 431 computeSinkIcon_: function(sink) { |
| 425 switch (sink.iconType) { | 432 switch (sink.iconType) { |
| 426 case media_router.SinkIconType.CAST: | 433 case media_router.SinkIconType.CAST: |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 * | 532 * |
| 526 * @param {?media_router.Route} route A local route. | 533 * @param {?media_router.Route} route A local route. |
| 527 * @private | 534 * @private |
| 528 */ | 535 */ |
| 529 maybeShowRouteDetailsOnOpen_: function(route) { | 536 maybeShowRouteDetailsOnOpen_: function(route) { |
| 530 if (this.localRouteCount_ == 1 && this.justOpened_ && route) | 537 if (this.localRouteCount_ == 1 && this.justOpened_ && route) |
| 531 this.showRouteDetails_(route); | 538 this.showRouteDetails_(route); |
| 532 }, | 539 }, |
| 533 | 540 |
| 534 /** | 541 /** |
| 542 * Updates |currentView_| if there is a new blocking issue. |
| 543 * |
| 544 * @param {?media_router.Issue} issue The new issue. |
| 545 * @private |
| 546 */ |
| 547 maybeShowIssueView_: function(issue) { |
| 548 if (!!issue && issue.isBlocking) |
| 549 this.currentView_ = media_router.MediaRouterView.ISSUE; |
| 550 }, |
| 551 |
| 552 /** |
| 535 * Handles a cast mode selection. Updates |headerText|, |headerTextTooltip|, | 553 * Handles a cast mode selection. Updates |headerText|, |headerTextTooltip|, |
| 536 * and |selectedCastModeValue_|. | 554 * and |selectedCastModeValue_|. |
| 537 * | 555 * |
| 538 * @param {!Event} event The event object. | 556 * @param {!Event} event The event object. |
| 539 * @private | 557 * @private |
| 540 */ | 558 */ |
| 541 onCastModeClick_: function(event) { | 559 onCastModeClick_: function(event) { |
| 542 // The clicked cast mode can come from one of two lists, | 560 // The clicked cast mode can come from one of two lists, |
| 543 // defaultCastModeList and nonDefaultCastModeList. | 561 // defaultCastModeList and nonDefaultCastModeList. |
| 544 var clickedMode = | 562 var clickedMode = |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 * | 804 * |
| 787 * @private | 805 * @private |
| 788 */ | 806 */ |
| 789 toggleCastModeHidden_: function() { | 807 toggleCastModeHidden_: function() { |
| 790 if (this.currentView_ == media_router.MediaRouterView.CAST_MODE_LIST) | 808 if (this.currentView_ == media_router.MediaRouterView.CAST_MODE_LIST) |
| 791 this.showSinkList_(); | 809 this.showSinkList_(); |
| 792 else | 810 else |
| 793 this.showCastModeList_(); | 811 this.showCastModeList_(); |
| 794 }, | 812 }, |
| 795 }); | 813 }); |
| OLD | NEW |