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 ff9296814a7eeddcf8752044bf520113b037fe76..380fbba20d4c55fc590b835f86eb01ed86712c9c 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 |
@@ -387,6 +387,16 @@ Polymer({ |
}, |
/** |
+ * Whether the new route controls should be shown instead of the extension |
+ * view in the route details view. |
+ * @type {boolean} |
+ */ |
+ useNewRouteControls: { |
mark a. foltz
2017/05/03 21:26:59
Nit: s/New/WebUI/ to be more specific (as "new" do
takumif
2017/05/05 18:57:38
Done.
|
+ type: Boolean, |
+ value: false, |
+ }, |
+ |
+ /** |
* Whether the user has explicitly selected a cast mode. |
* @private {boolean} |
*/ |
@@ -1070,14 +1080,22 @@ Polymer({ |
* filter action here. |
* @param {?media_router.MediaRouterView} currentView The current view of the |
* dialog. |
+ * @param {?media_router.MediaRouterView} oldCurrentView The old current view |
+ * of the dialog. |
* @private |
*/ |
- currentViewChanged_: function(currentView) { |
+ currentViewChanged_: function(currentView, oldCurrentView) { |
if (currentView == media_router.MediaRouterView.FILTER) { |
this.reportFilterOnInput_ = true; |
this.maybeReportFilter_(); |
} |
this.updateElementPositioning_(); |
+ |
+ if (oldCurrentView == media_router.MediaRouterView.ROUTE_DETAILS) { |
+ media_router.browserApi.onMediaControllerClosed(); |
+ if (this.$$('route-details')) |
+ this.$$('route-details').onClosed(); |
mark a. foltz
2017/05/03 21:26:59
Is a close-controller call sent when the route det
takumif
2017/05/05 18:57:38
In those cases no it doesn't get sent, but it's no
|
+ } |
}, |
/** |
@@ -1746,6 +1764,18 @@ Polymer({ |
}, |
/** |
+ * Called when the connection to the route controller is invalidated. Switches |
+ * from route details view to the sink list view. |
+ */ |
+ onRouteControllerInvalidated: function() { |
+ if (this.useNewRouteControls && |
+ this.currentView_ == media_router.MediaRouterView.ROUTE_DETAILS) { |
+ this.currentRoute_ = null; |
+ this.showSinkList_(); |
+ } |
+ }, |
+ |
+ /** |
* Called when a sink is clicked. |
* |
* @param {!Event} event The event object. |
@@ -2256,6 +2286,9 @@ Polymer({ |
showRouteDetails_: function(route) { |
this.currentRoute_ = route; |
this.currentView_ = media_router.MediaRouterView.ROUTE_DETAILS; |
+ media_router.browserApi.onMediaControllerAvailable(route.id); |
mark a. foltz
2017/05/03 21:26:59
What if there are no media controls for a route? I
takumif
2017/05/05 18:57:38
Do you mean a route that doesn't accept any media
|
+ if (this.$$('route-details')) |
+ this.$$('route-details').onOpened(); |
}, |
/** |