From 77f4655df0ec6a9c40732f25d18968465df011d4 Mon Sep 17 00:00:00 2001 From: mfoltz Date: Thu, 25 Feb 2016 15:44:55 -0800 Subject: First patch to implement support for MR for off the record media routes (created by incognito profiles). This adds a flag to the CreateRoute and JoinRoute APIs that is set to true when the route request originates from an incognito profile. Also, an off_the_record flag is added to MediaRoute. Patch 1/3 of support for incognito: This patch: Adds support for off the record media routes. TBD: Enables UI for incognito profiles. TBD: Clean up routes when incognito profile destroyed. BUG=524795 Review URL: https://codereview.chromium.org/1682853007 Cr-Commit-Position: refs/heads/master@{#377711} --- .../renderer/resources/media_router_bindings.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'extensions/renderer') diff --git a/extensions/renderer/resources/media_router_bindings.js b/extensions/renderer/resources/media_router_bindings.js index ebb668c..b6252c5 100644 --- a/extensions/renderer/resources/media_router_bindings.js +++ b/extensions/renderer/resources/media_router_bindings.js @@ -75,8 +75,10 @@ define('media_router_bindings', [ 'icon_url': route.iconUrl, 'is_local': route.isLocal, 'custom_controller_path': route.customControllerPath, - // TODO(imcheng): Remove logic when extension always sets the field. - 'for_display': route.forDisplay == undefined ? true : route.forDisplay + // Begin newly added properties, followed by the milestone they were + // added. The guard should be safe to remove N+2 milestones later. + 'for_display': route.forDisplay, // M47 + 'off_the_record': !!route.offTheRecord // M50 }); } @@ -556,15 +558,18 @@ define('media_router_bindings', [ * @param {!number} timeoutMillis If positive, the timeout duration for the * request, measured in seconds. Otherwise, the default duration will be * used. + * @param {!boolean} offTheRecord If true, the route is being requested by + * an off the record (incognito) profile. * @return {!Promise.} A Promise resolving to an object describing * the newly created media route, or rejecting with an error message on * failure. */ MediaRouteProvider.prototype.createRoute = function(sourceUrn, sinkId, presentationId, origin, tabId, - timeoutMillis) { + timeoutMillis, offTheRecord) { return this.handlers_.createRoute( - sourceUrn, sinkId, presentationId, origin, tabId, timeoutMillis) + sourceUrn, sinkId, presentationId, origin, tabId, timeoutMillis, + offTheRecord) .then(function(route) { return toSuccessRouteResponse_(route); }, @@ -584,14 +589,17 @@ define('media_router_bindings', [ * @param {!number} timeoutMillis If positive, the timeout duration for the * request, measured in seconds. Otherwise, the default duration will be * used. + * @param {!boolean} offTheRecord If true, the route is being requested by + * an off the record (incognito) profile. * @return {!Promise.} A Promise resolving to an object describing * the newly created media route, or rejecting with an error message on * failure. */ MediaRouteProvider.prototype.joinRoute = - function(sourceUrn, presentationId, origin, tabId, timeoutMillis) { + function(sourceUrn, presentationId, origin, tabId, timeoutMillis, + offTheRecord) { return this.handlers_.joinRoute( - sourceUrn, presentationId, origin, tabId, timeoutMillis) + sourceUrn, presentationId, origin, tabId, timeoutMillis, offTheRecord) .then(function(route) { return toSuccessRouteResponse_(route); }, -- cgit v1.1