| Index: chrome/browser/resources/media_router/media_router_ui_interface.js
|
| diff --git a/chrome/browser/resources/media_router/media_router_ui_interface.js b/chrome/browser/resources/media_router/media_router_ui_interface.js
|
| index a8ec54461a248a242f5475c160923d50dc85ccfd..09ca2b8baea6a27abece2066a4312534f2a7b674 100644
|
| --- a/chrome/browser/resources/media_router/media_router_ui_interface.js
|
| +++ b/chrome/browser/resources/media_router/media_router_ui_interface.js
|
| @@ -13,6 +13,9 @@ cr.define('media_router.ui', function() {
|
| // The media-router-header element.
|
| var header = null;
|
|
|
| + // The route-controls element. Is null if the route details view isn't open.
|
| + var routeControls = null;
|
| +
|
| /**
|
| * Handles response of previous create route attempt.
|
| *
|
| @@ -27,6 +30,14 @@ cr.define('media_router.ui', function() {
|
| }
|
|
|
| /**
|
| + * Called when the route controller for the route that is currently selected
|
| + * is invalidated.
|
| + */
|
| + function onRouteControllerInvalidated() {
|
| + container.onRouteControllerInvalidated();
|
| + }
|
| +
|
| + /**
|
| * Handles the search response by forwarding |sinkId| to the container.
|
| *
|
| * @param {string} sinkId The ID of the sink found by search.
|
| @@ -114,6 +125,7 @@ cr.define('media_router.ui', function() {
|
| container.maybeShowRouteDetailsOnOpen();
|
| if (data['useTabMirroring'])
|
| container.selectCastMode(media_router.CastModeType.TAB_MIRROR);
|
| + container.useNewRouteControls = data['useNewRouteControls'];
|
| media_router.browserApi.onInitialDataReceived();
|
| }
|
|
|
| @@ -128,6 +140,16 @@ cr.define('media_router.ui', function() {
|
| }
|
|
|
| /**
|
| + * Sets |routeControls|. The argument may be null if the route details view is
|
| + * getting closed.
|
| + *
|
| + * @param {?MediaRouterRouteControlsElement} mediaRouterRouteControls
|
| + */
|
| + function setRouteControls(mediaRouterRouteControls) {
|
| + routeControls = mediaRouterRouteControls;
|
| + }
|
| +
|
| + /**
|
| * Sets the list of currently active routes.
|
| *
|
| * @param {!Array<!media_router.Route>} routeList
|
| @@ -166,17 +188,30 @@ cr.define('media_router.ui', function() {
|
| container.updateMaxDialogHeight(height);
|
| }
|
|
|
| + /**
|
| + * Updates the route status shown in the route controls.
|
| + *
|
| + * @param {!media_router.RouteStatus} status
|
| + */
|
| + function updateRouteStatus(status) {
|
| + if (routeControls)
|
| + routeControls.updateRouteStatus(status);
|
| + }
|
| +
|
| return {
|
| onCreateRouteResponseReceived: onCreateRouteResponseReceived,
|
| + onRouteControllerInvalidated: onRouteControllerInvalidated,
|
| receiveSearchResult: receiveSearchResult,
|
| setCastModeList: setCastModeList,
|
| setElements: setElements,
|
| setFirstRunFlowData: setFirstRunFlowData,
|
| setInitialData: setInitialData,
|
| setIssue: setIssue,
|
| + setRouteControls: setRouteControls,
|
| setRouteList: setRouteList,
|
| setSinkListAndIdentity: setSinkListAndIdentity,
|
| updateMaxHeight: updateMaxHeight,
|
| + updateRouteStatus: updateRouteStatus,
|
| };
|
| });
|
|
|
| @@ -255,6 +290,36 @@ cr.define('media_router.browserApi', function() {
|
| }
|
|
|
| /**
|
| + * Reports that the route details view was closed.
|
| + */
|
| + function onMediaControllerClosed() {
|
| + chrome.send('onMediaControllerClosed');
|
| + }
|
| +
|
| + /**
|
| + * Reports that the route details view was opened for |routeId|.
|
| + *
|
| + * @param {string} routeId
|
| + */
|
| + function onMediaControllerAvailable(routeId) {
|
| + chrome.send('onMediaControllerAvailable', [{routeId: routeId}]);
|
| + }
|
| +
|
| + /**
|
| + * Sends a command to pause the route shown in the route details view.
|
| + */
|
| + function pauseCurrentMedia() {
|
| + chrome.send('pauseCurrentMedia');
|
| + }
|
| +
|
| + /**
|
| + * Sends a command to play the route shown in the route details view.
|
| + */
|
| + function playCurrentMedia() {
|
| + chrome.send('playCurrentMedia');
|
| + }
|
| +
|
| + /**
|
| * Reports when the user clicks outside the dialog.
|
| */
|
| function reportBlur() {
|
| @@ -401,6 +466,35 @@ cr.define('media_router.browserApi', function() {
|
| selectedCastMode: selectedCastMode}]);
|
| }
|
|
|
| + /**
|
| + * Sends a command to seek the route shown in the route details view.
|
| + *
|
| + * @param {number} time The new current time in seconds.
|
| + */
|
| + function seekCurrentMedia(time) {
|
| + chrome.send('seekCurrentMedia', [{time: time}]);
|
| + }
|
| +
|
| + /**
|
| + * Sends a command to mute or unmute the route shown in the route details
|
| + * view.
|
| + *
|
| + * @param {boolean} mute Mute the route if true, unmute it if false.
|
| + */
|
| + function setCurrentMediaMute(mute) {
|
| + chrome.send('setCurrentMediaMute', [{mute: mute}]);
|
| + }
|
| +
|
| + /**
|
| + * Sends a command to change the volume of the route shown in the route
|
| + * details view.
|
| + *
|
| + * @param {number} volume The volume between 0 and 1.
|
| + */
|
| + function setCurrentMediaVolume(volume) {
|
| + chrome.send('setCurrentMediaVolume', [{volume: volume}]);
|
| + }
|
| +
|
| return {
|
| acknowledgeFirstRunFlow: acknowledgeFirstRunFlow,
|
| actOnIssue: actOnIssue,
|
| @@ -409,6 +503,10 @@ cr.define('media_router.browserApi', function() {
|
| closeRoute: closeRoute,
|
| joinRoute: joinRoute,
|
| onInitialDataReceived: onInitialDataReceived,
|
| + onMediaControllerClosed: onMediaControllerClosed,
|
| + onMediaControllerAvailable: onMediaControllerAvailable,
|
| + pauseCurrentMedia: pauseCurrentMedia,
|
| + playCurrentMedia: playCurrentMedia,
|
| reportBlur: reportBlur,
|
| reportClickedSinkIndex: reportClickedSinkIndex,
|
| reportFilter: reportFilter,
|
| @@ -424,5 +522,8 @@ cr.define('media_router.browserApi', function() {
|
| requestInitialData: requestInitialData,
|
| requestRoute: requestRoute,
|
| searchSinksAndCreateRoute: searchSinksAndCreateRoute,
|
| + seekCurrentMedia: seekCurrentMedia,
|
| + setCurrentMediaMute: setCurrentMediaMute,
|
| + setCurrentMediaVolume: setCurrentMediaVolume,
|
| };
|
| });
|
|
|