| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var mediaRouter; | 5 var mediaRouter; |
| 6 | 6 |
| 7 define('media_router_bindings', [ | 7 define('media_router_bindings', [ |
| 8 'chrome/common/media_router/mojo/media_controller.mojom', | 8 'chrome/common/media_router/mojo/media_controller.mojom', |
| 9 'chrome/common/media_router/mojo/media_router.mojom', | 9 'chrome/common/media_router/mojo/media_router.mojom', |
| 10 'chrome/common/media_router/mojo/media_status.mojom', | 10 'chrome/common/media_router/mojo/media_status.mojom', |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 this.keepAlive_ = null; | 256 this.keepAlive_ = null; |
| 257 | 257 |
| 258 /** | 258 /** |
| 259 * The bindings to bind the service delegate to the Mojo interface. | 259 * The bindings to bind the service delegate to the Mojo interface. |
| 260 * Object must remain in scope for the lifetime of the connection to | 260 * Object must remain in scope for the lifetime of the connection to |
| 261 * prevent the connection from closing automatically. | 261 * prevent the connection from closing automatically. |
| 262 * @type {!bindings.Binding} | 262 * @type {!bindings.Binding} |
| 263 */ | 263 */ |
| 264 this.mediaRouteProviderBinding_ = new bindings.Binding( | 264 this.mediaRouteProviderBinding_ = new bindings.Binding( |
| 265 mediaRouterMojom.MediaRouteProvider, this.mrpm_); | 265 mediaRouterMojom.MediaRouteProvider, this.mrpm_); |
| 266 |
| 267 /** |
| 268 * Whether or not to enable browser side device discovery. |
| 269 * @type {boolean} |
| 270 */ |
| 271 this.enable_browser_side_discovery_ = false; |
| 266 } | 272 } |
| 267 | 273 |
| 268 /** | 274 /** |
| 269 * Returns definitions of Mojo core and generated Mojom classes that can be | 275 * Returns definitions of Mojo core and generated Mojom classes that can be |
| 270 * used directly by the component. | 276 * used directly by the component. |
| 271 * @return {!Object} | 277 * @return {!Object} |
| 272 * TODO(imcheng): We should export these along with MediaRouter. This requires | 278 * TODO(imcheng): We should export these along with MediaRouter. This requires |
| 273 * us to modify the component to handle multiple exports. When that logic is | 279 * us to modify the component to handle multiple exports. When that logic is |
| 274 * baked in for a couple of milestones, we should be able to remove this | 280 * baked in for a couple of milestones, we should be able to remove this |
| 275 * method. | 281 * method. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 293 }; | 299 }; |
| 294 | 300 |
| 295 /** | 301 /** |
| 296 * Registers the Media Router Provider Manager with the Media Router. | 302 * Registers the Media Router Provider Manager with the Media Router. |
| 297 * @return {!Promise<string>} Instance ID for the Media Router. | 303 * @return {!Promise<string>} Instance ID for the Media Router. |
| 298 */ | 304 */ |
| 299 MediaRouter.prototype.start = function() { | 305 MediaRouter.prototype.start = function() { |
| 300 return this.service_.registerMediaRouteProvider( | 306 return this.service_.registerMediaRouteProvider( |
| 301 this.mediaRouteProviderBinding_.createInterfacePtrAndBind()).then( | 307 this.mediaRouteProviderBinding_.createInterfacePtrAndBind()).then( |
| 302 function(result) { | 308 function(result) { |
| 309 this.enable_browser_side_discovery_ = |
| 310 result.enable_browser_side_discovery; |
| 303 return result.instance_id; | 311 return result.instance_id; |
| 304 }.bind(this)); | 312 }.bind(this)); |
| 305 } | 313 } |
| 306 | 314 |
| 307 /** | 315 /** |
| 308 * Sets the service delegate methods. | 316 * Sets the service delegate methods. |
| 309 * @param {Object} handlers | 317 * @param {Object} handlers |
| 310 */ | 318 */ |
| 311 MediaRouter.prototype.setHandlers = function(handlers) { | 319 MediaRouter.prototype.setHandlers = function(handlers) { |
| 312 this.mrpm_.setHandlers(handlers); | 320 this.mrpm_.setHandlers(handlers); |
| 313 } | 321 } |
| 314 | 322 |
| 315 /** | 323 /** |
| 316 * The keep alive status. | 324 * The keep alive status. |
| 317 * @return {boolean} | 325 * @return {boolean} |
| 318 */ | 326 */ |
| 319 MediaRouter.prototype.getKeepAlive = function() { | 327 MediaRouter.prototype.getKeepAlive = function() { |
| 320 return this.keepAlive_ != null; | 328 return this.keepAlive_ != null; |
| 321 }; | 329 }; |
| 322 | 330 |
| 323 /** | 331 /** |
| 332 * Whether or not to enable browser side discovery. |
| 333 * @return {boolean} |
| 334 */ |
| 335 MediaRouter.prototype.getEnableBrowserSideDiscovery = function() { |
| 336 return this.enable_browser_side_discovery_; |
| 337 } |
| 338 |
| 339 /** |
| 324 * Called by the provider manager when a sink list for a given source is | 340 * Called by the provider manager when a sink list for a given source is |
| 325 * updated. | 341 * updated. |
| 326 * @param {!string} sourceUrn | 342 * @param {!string} sourceUrn |
| 327 * @param {!Array<!MediaSink>} sinks | 343 * @param {!Array<!MediaSink>} sinks |
| 328 * @param {!Array<string>} origins | 344 * @param {!Array<string>} origins |
| 329 */ | 345 */ |
| 330 MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks, | 346 MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks, |
| 331 origins) { | 347 origins) { |
| 332 this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_), | 348 this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_), |
| 333 origins.map(stringToMojoOrigin_)); | 349 origins.map(stringToMojoOrigin_)); |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 } | 969 } |
| 954 this.handlers_.onBeforeInvokeHandler(); | 970 this.handlers_.onBeforeInvokeHandler(); |
| 955 this.handlers_.setMediaRouteStatusObserver(routeId, observer); | 971 this.handlers_.setMediaRouteStatusObserver(routeId, observer); |
| 956 }; | 972 }; |
| 957 | 973 |
| 958 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( | 974 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( |
| 959 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); | 975 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); |
| 960 | 976 |
| 961 return mediaRouter; | 977 return mediaRouter; |
| 962 }); | 978 }); |
| OLD | NEW |