| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 var channel = new MessageChannel(); | 897 var channel = new MessageChannel(); |
| 898 this._port = channel.port1; | 898 this._port = channel.port1; |
| 899 this._port.addEventListener("message", this._onMessage.bind(this), false); | 899 this._port.addEventListener("message", this._onMessage.bind(this), false); |
| 900 this._port.start(); | 900 this._port.start(); |
| 901 | 901 |
| 902 window.parent.postMessage("registerExtension", [ channel.port2 ], "*"); | 902 window.parent.postMessage("registerExtension", [ channel.port2 ], "*"); |
| 903 } | 903 } |
| 904 | 904 |
| 905 ExtensionServerClient.prototype = { | 905 ExtensionServerClient.prototype = { |
| 906 /** | 906 /** |
| 907 * @param {!Object} message |
| 907 * @param {function()=} callback | 908 * @param {function()=} callback |
| 908 */ | 909 */ |
| 909 sendRequest: function(message, callback) | 910 sendRequest: function(message, callback) |
| 910 { | 911 { |
| 911 if (typeof callback === "function") | 912 if (typeof callback === "function") |
| 912 message.requestId = this._registerCallback(callback); | 913 message.requestId = this._registerCallback(callback); |
| 913 this._port.postMessage(message); | 914 this._port.postMessage(message); |
| 914 }, | 915 }, |
| 915 | 916 |
| 916 /** | 917 /** |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 { | 1050 { |
| 1050 return "(function(injectedScriptId){ " + | 1051 return "(function(injectedScriptId){ " + |
| 1051 "var extensionServer;" + | 1052 "var extensionServer;" + |
| 1052 defineCommonExtensionSymbols.toString() + ";" + | 1053 defineCommonExtensionSymbols.toString() + ";" + |
| 1053 injectedExtensionAPI.toString() + ";" + | 1054 injectedExtensionAPI.toString() + ";" + |
| 1054 buildPlatformExtensionAPI(extensionInfo) + ";" + | 1055 buildPlatformExtensionAPI(extensionInfo) + ";" + |
| 1055 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 1056 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
| 1056 "return {};" + | 1057 "return {};" + |
| 1057 "})"; | 1058 "})"; |
| 1058 } | 1059 } |
| OLD | NEW |