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 9b62be83fef88f418315c05574f3c080050441a1..0932ef8defbfea832c3686fb84118bbd5b9961a5 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,27 @@ 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_: { |
| + type: Object, |
| + value: function() { |
|
michaelpg
2015/07/06 20:55:46
add readOnly: true
and then value: may as well be
apacible
2015/07/07 18:38:43
Done.
|
| + return { |
| + 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 +51,11 @@ Polymer({ |
| /** |
| * The current view to be shown. |
| - * @private {!MediaRouterContainerView} |
| + * @private {string} |
| */ |
| currentView_: { |
| type: String, |
| - value: MediaRouterContainerView.SINK_LIST, |
| + value: '', |
| }, |
| /** |
| @@ -149,6 +156,10 @@ Polymer({ |
| }, |
| }, |
| + ready: function() { |
| + this.currentView_ = this.containerView_.SINK_LIST; |
| + }, |
| + |
| /** |
| * Adds |route| to |routeList|. |
| * |
| @@ -167,54 +178,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); |
| }, |
| @@ -248,13 +259,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); |
| }, |
| @@ -346,7 +357,7 @@ Polymer({ |
| * @private |
| */ |
| showCastModeList_: function() { |
| - this.currentView_ = MediaRouterContainerView.CAST_MODE_LIST; |
| + this.currentView_ = this.containerView_.CAST_MODE_LIST; |
| }, |
| /** |
| @@ -355,7 +366,7 @@ Polymer({ |
| * @private |
| */ |
| showRouteDetails_: function() { |
| - this.currentView_ = MediaRouterContainerView.ROUTE_DETAILS; |
| + this.currentView_ = this.containerView_.ROUTE_DETAILS; |
| }, |
| /** |
| @@ -364,7 +375,7 @@ Polymer({ |
| * @private |
| */ |
| showSinkList_: function() { |
| - this.currentView_ = MediaRouterContainerView.SINK_LIST; |
| + this.currentView_ = this.containerView_.SINK_LIST; |
| }, |
| /** |
| @@ -373,11 +384,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_(); |
| } |
| }, |
| }); |
| -})(); |