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..f9563cd57ca7c41bcdb8276433dc9a2bf03dbced 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); |
miket_OOO
2011/12/13 22:44:50
I alphabetized this list of functions and added my
Aaron Boodman
2011/12/14 00:28:23
I think what you did is perfect. It's nice to clea
|
+ 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( |
+ 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) { |
Aaron Boodman
2011/12/14 00:28:23
Indent looks weird.
|
+ // Safe to ignore. |
Aaron Boodman
2011/12/14 00:28:23
That is almost never true :). How about console.er
|
+ } |
+ } |
+ |
// 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 = {}; |