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

Unified Diff: chrome/renderer/resources/extensions/tts_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/tts_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/tts_custom_bindings.js b/chrome/renderer/resources/extensions/tts_custom_bindings.js
index 634ee38d37133924428826451f10a3314b32ee54..5c746665cd54b309d7d01bf6e37321d4dcad2711 100644
--- a/chrome/renderer/resources/extensions/tts_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/tts_custom_bindings.js
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Custom bindings for the tts API.
+// Custom binding for the tts API.
+
+var binding = require('binding').Binding.create('tts');
var ttsNatives = requireNative('tts');
var GetNextTTSEventId = ttsNatives.GetNextTTSEventId;
@@ -11,8 +13,9 @@ var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
var sendRequest = require('sendRequest').sendRequest;
var lazyBG = requireNative('lazy_background_page');
-chromeHidden.registerCustomHook('tts', function(api) {
+binding.registerCustomHook(function(api) {
var apiFunctions = api.apiFunctions;
+ var tts = api.compiledApi;
chromeHidden.tts = {
handlers: {}
@@ -39,7 +42,7 @@ chromeHidden.registerCustomHook('tts', function(api) {
// add a listener to chrome.tts.onEvent will fail.
// See http://crbug.com/122474.
try {
- chrome.tts.onEvent.addListener(ttsEventListener);
+ tts.onEvent.addListener(ttsEventListener);
} catch (e) {}
apiFunctions.setHandleRequest('speak', function() {
@@ -56,3 +59,5 @@ chromeHidden.registerCustomHook('tts', function(api) {
return id;
});
});
+
+exports.binding = binding.generate();

Powered by Google App Engine
This is Rietveld 408576698