Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4074)

Unified Diff: chrome/renderer/resources/extensions/schema_generated_bindings.js

Issue 8896013: Implement onEvent callback framework for UDP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/extensions/schema_generated_bindings.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = {};
« no previous file with comments | « chrome/renderer/extensions/schema_generated_bindings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698