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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 this._lastRequestId = 0; | 849 this._lastRequestId = 0; |
850 this._lastObjectId = 0; | 850 this._lastObjectId = 0; |
851 | 851 |
852 this.registerHandler("callback", this._onCallback.bind(this)); | 852 this.registerHandler("callback", this._onCallback.bind(this)); |
853 | 853 |
854 var channel = new MessageChannel(); | 854 var channel = new MessageChannel(); |
855 this._port = channel.port1; | 855 this._port = channel.port1; |
856 this._port.addEventListener("message", this._onMessage.bind(this), false); | 856 this._port.addEventListener("message", this._onMessage.bind(this), false); |
857 this._port.start(); | 857 this._port.start(); |
858 | 858 |
859 window.parent.postMessage("registerExtension", [ channel.port2 ], "*"); | 859 window.parent.postMessage("registerExtension", "*", [ channel.port2 ]); |
860 } | 860 } |
861 | 861 |
862 ExtensionServerClient.prototype = { | 862 ExtensionServerClient.prototype = { |
863 /** | 863 /** |
864 * @param {!Object} message | 864 * @param {!Object} message |
865 * @param {function()=} callback | 865 * @param {function()=} callback |
866 */ | 866 */ |
867 sendRequest: function(message, callback) | 867 sendRequest: function(message, callback) |
868 { | 868 { |
869 if (typeof callback === "function") | 869 if (typeof callback === "function") |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 { | 1013 { |
1014 return "(function(injectedScriptId){ " + | 1014 return "(function(injectedScriptId){ " + |
1015 "var extensionServer;" + | 1015 "var extensionServer;" + |
1016 defineCommonExtensionSymbols.toString() + ";" + | 1016 defineCommonExtensionSymbols.toString() + ";" + |
1017 injectedExtensionAPI.toString() + ";" + | 1017 injectedExtensionAPI.toString() + ";" + |
1018 buildPlatformExtensionAPI(extensionInfo, inspectedTabId, themeName) + ";
" + | 1018 buildPlatformExtensionAPI(extensionInfo, inspectedTabId, themeName) + ";
" + |
1019 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 1019 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
1020 "return {};" + | 1020 "return {};" + |
1021 "})"; | 1021 "})"; |
1022 } | 1022 } |
OLD | NEW |