| 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Provides a HTML5 postMessage channel to the injected JS to talk back | 7 * Provides a HTML5 postMessage channel to the injected JS to talk back |
| 8 * to Authenticator. | 8 * to Authenticator. |
| 9 */ | 9 */ |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 this.onMessage.dispatch(e.data.payload); | 317 this.onMessage.dispatch(e.data.payload); |
| 318 } | 318 } |
| 319 }; | 319 }; |
| 320 | 320 |
| 321 /** | 321 /** |
| 322 * A message channel based on PostMessagePort. | 322 * A message channel based on PostMessagePort. |
| 323 * @extends {Channel} | 323 * @extends {Channel} |
| 324 * @constructor | 324 * @constructor |
| 325 */ | 325 */ |
| 326 function PostMessageChannel() { | 326 function PostMessageChannel() { |
| 327 Channel.apply(this, arguments); |
| 327 }; | 328 }; |
| 328 | 329 |
| 329 PostMessageChannel.prototype = { | 330 PostMessageChannel.prototype = { |
| 330 __proto__: Channel.prototype, | 331 __proto__: Channel.prototype, |
| 331 | 332 |
| 332 /** @override */ | 333 /** @override */ |
| 333 connect: function(name) { | 334 connect: function(name) { |
| 334 this.port_ = channelManager.connectToDaemon(name); | 335 this.port_ = channelManager.connectToDaemon(name); |
| 335 this.port_.onMessage.addListener(this.onMessage_.bind(this)); | 336 this.port_.onMessage.addListener(this.onMessage_.bind(this)); |
| 336 }, | 337 }, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 363 channelManager.onConnect.addListener(onConnect); | 364 channelManager.onConnect.addListener(onConnect); |
| 364 }; | 365 }; |
| 365 | 366 |
| 366 return PostMessageChannel; | 367 return PostMessageChannel; |
| 367 })(); | 368 })(); |
| 368 | 369 |
| 369 /** @override */ | 370 /** @override */ |
| 370 Channel.create = function() { | 371 Channel.create = function() { |
| 371 return new PostMessageChannel(); | 372 return new PostMessageChannel(); |
| 372 }; | 373 }; |
| OLD | NEW |