Chromium Code Reviews| Index: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| index 3a651d1b32850fd17fbb4e0091433b731fd02364..c0ead9e92373f4a22f2f09a1d7540c0569f888dc 100644 |
| --- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| +++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| @@ -2,20 +2,6 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -(function() { |
| - /** |
| - * The possible states of media-router-container. Used to determine which |
| - * components of media-router-container to show. |
| - * |
| - * @enum {string} |
| - */ |
| - var MediaRouterContainerView = { |
| - CAST_MODE_LIST: 'cast-mode-list', |
| - FILTER: 'filter', |
| - ROUTE_DETAILS: 'route-details', |
| - SINK_LIST: 'sink-list', |
| - }; |
| - |
| // This Polymer element contains the entire media router interface. It handles |
| // hiding and showing specific components. |
| Polymer({ |
| @@ -34,6 +20,26 @@ Polymer({ |
| }, |
| /** |
| + * The possible states of media-router-container. Used to determine which |
| + * components of media-router-container to show. |
| + * This is a property of media-router-container because it is used in |
| + * tests. |
| + * |
| + * @enum {string} |
| + * @private |
| + */ |
| + containerView_: { |
|
Dan Beam
2015/07/10 01:42:45
CONTAINER_VIEW_
Dan Beam
2015/07/10 01:42:45
I don't really see how this is an improvement, but
apacible
2015/07/10 22:19:32
Done.
|
| + type: Object, |
| + readOnly: true, |
| + value: { |
| + CAST_MODE_LIST: 'cast-mode-list', |
| + FILTER: 'filter', |
| + ROUTE_DETAILS: 'route-details', |
| + SINK_LIST: 'sink-list', |
| + }, |
| + }, |
| + |
| + /** |
| * The current route. |
| * @private {?media_router.Route} |
| */ |
| @@ -44,11 +50,11 @@ Polymer({ |
| /** |
| * The current view to be shown. |
| - * @private {!MediaRouterContainerView} |
| + * @private {string} |
| */ |
| currentView_: { |
| type: String, |
| - value: MediaRouterContainerView.SINK_LIST, |
| + value: '', |
| }, |
| /** |
| @@ -147,6 +153,10 @@ Polymer({ |
| }, |
| }, |
| + ready: function() { |
| + this.currentView_ = this.containerView_.SINK_LIST; |
| + }, |
| + |
| /** |
| * Adds |route| to |routeList|. |
| * |
| @@ -165,54 +175,54 @@ Polymer({ |
| }, |
| /** |
| - * @param {!MediaRouterContainerView} view The current view. |
| + * @param {string} view The current view. |
| * @return {string} The current arrow-drop-* icon to use. |
| * @private |
| */ |
| computeArrowDropIcon_: function(view) { |
| - return view == MediaRouterContainerView.CAST_MODE_LIST ? |
| + return view == this.containerView_.CAST_MODE_LIST ? |
| 'arrow-drop-up' : 'arrow-drop-down'; |
| }, |
| /** |
| - * @param {!MediaRouterContainerView} view The current view. |
| + * @param {string} view The current view. |
| * @return {boolean} Whether or not to hide the cast mode list. |
| * @private |
| */ |
| computeCastModeHidden_: function(view) { |
| - return view != MediaRouterContainerView.CAST_MODE_LIST; |
| + return view != this.containerView_.CAST_MODE_LIST; |
| }, |
| /** |
| - * @param {!MediaRouterContainerView} view The current view. |
| + * @param {string} view The current view. |
| * @param {?media_router.Issue} issue The current issue. |
| * @return {boolean} Whether or not to hide the header. |
| * @private |
| */ |
| computeHeaderHidden_: function(view, issue) { |
| - return view == MediaRouterContainerView.ROUTE_DETAILS || |
| - (view == MediaRouterContainerView.SINK_LIST && |
| + return view == this.containerView_.ROUTE_DETAILS || |
| + (view == this.containerView_.SINK_LIST && |
| issue && issue.isBlocking); |
| }, |
| /** |
| - * @param {!MediaRouterContainerView} view The current view. |
| + * @param {string} view The current view. |
| * @param {?media_router.Issue} issue The current issue. |
| * @return {boolean} Whether or not to hide the issue banner. |
| * @private |
| */ |
| computeIssueBannerHidden_: function(view, issue) { |
| - return !issue || view == MediaRouterContainerView.CAST_MODE_LIST; |
| + return !issue || view == this.containerView_.CAST_MODE_LIST; |
| }, |
| /** |
| - * @param {!MediaRouterContainerView} view The current view. |
| + * @param {string} view The current view. |
| * @param {?media_router.Issue} issue The current issue. |
| * @return {boolean} Whether or not to hide the route details. |
| * @private |
| */ |
| computerRouteDetailsHidden_: function(view, issue) { |
| - return view != MediaRouterContainerView.ROUTE_DETAILS || |
| + return view != this.containerView_.ROUTE_DETAILS || |
| (issue && issue.isBlocking); |
| }, |
| @@ -246,13 +256,13 @@ Polymer({ |
| }, |
| /** |
| - * @param {!MediaRouterContainerView} view The current view. |
| + * @param {string} view The current view. |
| * @param {?media_router.Issue} issue The current issue. |
| * @return {boolean} Whether or not to hide the sink list. |
| * @private |
| */ |
| computeSinkListHidden_: function(view, issue) { |
| - return view != MediaRouterContainerView.SINK_LIST || |
| + return view != this.containerView_.SINK_LIST || |
| (issue && issue.isBlocking); |
| }, |
| @@ -344,7 +354,7 @@ Polymer({ |
| * @private |
| */ |
| showCastModeList_: function() { |
| - this.currentView_ = MediaRouterContainerView.CAST_MODE_LIST; |
| + this.currentView_ = this.containerView_.CAST_MODE_LIST; |
| }, |
| /** |
| @@ -353,7 +363,7 @@ Polymer({ |
| * @private |
| */ |
| showRouteDetails_: function() { |
| - this.currentView_ = MediaRouterContainerView.ROUTE_DETAILS; |
| + this.currentView_ = this.containerView_.ROUTE_DETAILS; |
| }, |
| /** |
| @@ -362,7 +372,7 @@ Polymer({ |
| * @private |
| */ |
| showSinkList_: function() { |
| - this.currentView_ = MediaRouterContainerView.SINK_LIST; |
| + this.currentView_ = this.containerView_.SINK_LIST; |
| }, |
| /** |
| @@ -371,11 +381,10 @@ Polymer({ |
| * @private |
| */ |
| toggleCastModeHidden_: function() { |
| - if (this.currentView_ == MediaRouterContainerView.CAST_MODE_LIST) { |
| + if (this.currentView_ == this.containerView_.CAST_MODE_LIST) { |
| this.showSinkList_(); |
| } else { |
| this.showCastModeList_(); |
| } |
| }, |
| }); |
| -})(); |