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

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

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apitest.js Created 7 years, 10 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/app_window_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/app_window_custom_bindings.js b/chrome/renderer/resources/extensions/app_window_custom_bindings.js
index 1bb5befe0c061a8b449601eefa0f12ece2c3181b..b0dba6c63a93b49c164f13ac8d1f5070d9ab62aa 100644
--- a/chrome/renderer/resources/extensions/app_window_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/app_window_custom_bindings.js
@@ -2,17 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Custom bindings for the app_window API.
+// Custom binding for the app_window API.
+
+var binding = require('binding').Binding.create('app.window');
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
+var chrome = requireNative('chrome').GetChrome();
var sendRequest = require('sendRequest').sendRequest;
var appWindowNatives = requireNative('app_window');
var forEach = require('utils').forEach;
var GetView = appWindowNatives.GetView;
var OnContextReady = appWindowNatives.OnContextReady;
+var currentWindowInternal = require('binding').Binding.create(
+ 'app.currentWindowInternal').generate();
-chromeHidden.registerCustomHook('app.window', function(bindingsAPI) {
+binding.registerCustomHook(function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions;
+
apiFunctions.setCustomCallback('create',
function(name, request, windowParams) {
var view = null;
@@ -82,9 +88,9 @@ chromeHidden.registerCustomHook('app.window', function(bindingsAPI) {
// because it is called from a different JS context.
apiFunctions.setHandleRequest('initializeAppWindow', function(params) {
var AppWindow = function() {};
- forEach(chromeHidden.internalAPIs.app.currentWindowInternal, function(fn) {
+ forEach(currentWindowInternal, function(fn) {
AppWindow.prototype[fn] =
- chromeHidden.internalAPIs.app.currentWindowInternal[fn];
+ currentWindowInternal[fn];
});
AppWindow.prototype.moveTo = window.moveTo.bind(window);
AppWindow.prototype.resizeTo = window.resizeTo.bind(window);
@@ -148,3 +154,5 @@ chromeHidden.updateAppWindowProperties = function(update) {
(oldData.maximized && !update.maximized))
currentWindow["onRestored"].dispatch();
};
+
+exports.binding = binding.generate();

Powered by Google App Engine
This is Rietveld 408576698