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

Unified Diff: chrome/renderer/resources/extensions/input.ime_custom_bindings.js

Issue 11299270: Add a parameter that specifies whether onKeyEvent is asynchronous (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra function Created 8 years, 1 month 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/common/extensions/api/input_ime.json ('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/input.ime_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/input.ime_custom_bindings.js b/chrome/renderer/resources/extensions/input.ime_custom_bindings.js
index 204a9e0ae81a9c136fe25fc634ac8aabc99f4232..f6573f02671e6a188d1b721b84de39d552829308 100644
--- a/chrome/renderer/resources/extensions/input.ime_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/input.ime_custom_bindings.js
@@ -18,6 +18,26 @@ chromeHidden.registerCustomHook('input.ime', function() {
} catch (e) {
console.error('Error in event handler for onKeyEvent: ' + e.stack);
}
- chrome.input.ime.eventHandled(keyData.requestId, result);
+ if (!chrome.input.ime.onKeyEvent.async)
+ chrome.input.ime.keyEventHandled(keyData.requestId, result);
+ };
+
+ chrome.input.ime.onKeyEvent.addListener = function(cb, opt_extraInfo) {
+ if (!this.eventOptions_.supportsListeners)
Matt Perry 2012/11/30 20:31:59 Rather than cut+pasting, you can call the original
Zachary Kuznia 2012/12/03 05:54:45 Done.
+ throw new Error("This event does not support listeners.");
+ if (this.eventOptions_.maxListeners &&
+ this.getListenerCount() >= this.eventOptions_.maxListeners)
+ throw new Error("Too many listeners for " + this.eventName_);
+ chrome.input.ime.onKeyEvent.async = false;
+ if (opt_extraInfo instanceof Array) {
+ for (var i = 0; i < opt_extraInfo.length; ++i) {
+ if (opt_extraInfo[i] == "async") {
+ chrome.input.ime.onKeyEvent.async = true;
+ }
+ }
+ }
+ var listener = {callback: cb, filters: null};
+ this.attach_(listener);
+ this.listeners_.push(listener);
};
});
« no previous file with comments | « chrome/common/extensions/api/input_ime.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698