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

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

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compilation Created 7 years, 9 months 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
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 60b01058e44504900cc148b12df894155d0ca722..79ab4a3e27ce27b85e34a6ef041b0131f1b2934a 100644
--- a/chrome/renderer/resources/extensions/input.ime_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/input.ime_custom_bindings.js
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Custom bindings for the input ime API. Only injected into the
+// Custom binding for the input ime API. Only injected into the
// v8 contexts for extensions which have permission for the API.
-var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
+var binding = require('binding').Binding.create('input.ime');
-chromeHidden.registerCustomHook('input.ime', function() {
- chrome.input.ime.onKeyEvent.dispatchToListener = function(callback, args) {
+binding.registerCustomHook(function(api) {
+ var input_ime = api.compiledApi;
+
+ input_ime.onKeyEvent.dispatchToListener = function(callback, args) {
var engineID = args[0];
var keyData = args[1];
@@ -18,19 +20,21 @@ chromeHidden.registerCustomHook('input.ime', function() {
} catch (e) {
console.error('Error in event handler for onKeyEvent: ' + e.stack);
}
- if (!chrome.input.ime.onKeyEvent.async)
- chrome.input.ime.keyEventHandled(keyData.requestId, result);
+ if (!input_ime.onKeyEvent.async)
+ input_ime.keyEventHandled(keyData.requestId, result);
};
- chrome.input.ime.onKeyEvent.addListener = function(cb, opt_extraInfo) {
- chrome.input.ime.onKeyEvent.async = false;
+ input_ime.onKeyEvent.addListener = function(cb, opt_extraInfo) {
+ 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;
+ input_ime.onKeyEvent.async = true;
}
}
}
chrome.Event.prototype.addListener.call(this, cb, null);
};
});
+
+exports.binding = binding.generate();
« no previous file with comments | « chrome/renderer/resources/extensions/i18n_custom_bindings.js ('k') | chrome/renderer/resources/extensions/json_schema.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698