Chromium Code Reviews| Index: chrome/renderer/resources/extensions/schema_generated_bindings.js |
| diff --git a/chrome/renderer/resources/extensions/schema_generated_bindings.js b/chrome/renderer/resources/extensions/schema_generated_bindings.js |
| index 0b617cf8800bf26ab48959c3f825ed02d26cfec8..186e5352bc2de136785c597fab2e01feb276df4b 100644 |
| --- a/chrome/renderer/resources/extensions/schema_generated_bindings.js |
| +++ b/chrome/renderer/resources/extensions/schema_generated_bindings.js |
| @@ -7,24 +7,25 @@ |
| var chrome = chrome || {}; |
| (function() { |
| - native function GetExtensionAPIDefinition(); |
| - native function StartRequest(); |
| native function GetChromeHidden(); |
| + native function GetExtensionAPIDefinition(); |
| native function GetNextRequestId(); |
| native function Print(); |
| + native function StartRequest(); |
| + native function CreateBlob(filePath); |
| + native function DecodeJPEG(jpegImage); |
| native function GetCurrentPageActions(extensionId); |
| native function GetExtensionViews(); |
| + native function GetLocalFileSystem(name, path); |
| native function GetNextContextMenuId(); |
| + native function GetNextSocketEventId(); |
| native function GetNextTtsEventId(); |
| - native function OpenChannelToTab(); |
| native function GetRenderViewId(); |
| - native function SetIconCommon(); |
| native function GetUniqueSubEventName(eventName); |
| - native function GetLocalFileSystem(name, path); |
| - native function DecodeJPEG(jpegImage); |
| - native function CreateBlob(filePath); |
| + native function OpenChannelToTab(); |
| native function SendResponseAck(requestId); |
| + native function SetIconCommon(); |
| var chromeHidden = GetChromeHidden(); |
| @@ -587,6 +588,28 @@ var chrome = chrome || {}; |
| } |
| } |
| + function setupSocketEvents() { |
| + chromeHidden.socket = {}; |
| + chromeHidden.socket.handlers = {}; |
| + try { |
| + chrome.experimental.socket.onEvent.addListener( |
|
asargent_no_longer_on_chrome
2011/12/14 17:36:18
I vaguely recall that when I added the listeners f
|
| + function(event) { |
| + var eventHandler = chromeHidden.socket.handlers[event.srcId]; |
| + if (eventHandler) { |
| + eventHandler({ |
| + type: event.type, |
| + resultCode: event.resultCode, |
| + }); |
| + if (event.isFinalEvent) { |
| + delete chromeHidden.socket.handlers[event.srcId]; |
| + } |
| + } |
| + }); |
| + } catch (e) { |
| + console.error(e); |
| + } |
| + } |
| + |
| // Get the platform from navigator.appVersion. |
| function getPlatform() { |
| var platforms = [ |
| @@ -1094,14 +1117,26 @@ var chrome = chrome || {}; |
| return id; |
| }; |
| + apiFunctions["experimental.socket.create"].handleRequest = function() { |
| + var args = arguments; |
| + if (args.length > 1 && args[1] && args[1].onEvent) { |
| + var id = GetNextSocketEventId(); |
| + args[1].srcId = id; |
| + chromeHidden.socket.handlers[id] = args[1].onEvent; |
| + } |
| + sendRequest(this.name, args, this.definition.parameters); |
| + return id; |
| + }; |
| + |
| if (chrome.test) { |
| chrome.test.getApiDefinitions = GetExtensionAPIDefinition; |
| } |
| - setupPageActionEvents(extensionId); |
| setupHiddenContextMenuEvent(extensionId); |
| setupInputEvents(); |
| setupOmniboxEvents(); |
| + setupPageActionEvents(extensionId); |
| + setupSocketEvents(); |
| setupTtsEvents(); |
| }); |
| @@ -1114,6 +1149,9 @@ var chrome = chrome || {}; |
| if (!chrome.experimental.speechInput) |
| chrome.experimental.speechInput = {}; |
| + if (!chrome.experimental.socket) |
| + chrome.experimental.socket = {}; |
| + |
| if (!chrome.tts) |
| chrome.tts = {}; |