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

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: 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/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 f6223c75d2a168c385ba1639d28e14a898fd95c9..83322cf841586f43f8cbdaef419d9a36b8663888 100644
--- a/chrome/renderer/resources/extensions/app_window_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/app_window_custom_bindings.js
@@ -2,17 +2,21 @@
// 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;
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;
-chromeHidden.registerCustomHook('app.window', function(bindingsAPI) {
+var appWindow = Binding.create('app.window');
+appWindow.registerCustomHook(function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions;
+
apiFunctions.setCustomCallback('create',
function(name, request, windowParams) {
var view = null;
@@ -81,10 +85,12 @@ chromeHidden.registerCustomHook('app.window', function(bindingsAPI) {
// This is an internal function, but needs to be bound with setHandleRequest
// because it is called from a different JS context.
apiFunctions.setHandleRequest('initializeAppWindow', function(params) {
+ var currentWindowInternal =
+ Binding.create('app.currentWindowInternal').generate();
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);
@@ -155,3 +161,5 @@ chromeHidden.updateAppWindowProperties = function(update) {
(oldData.maximized && !update.maximized))
currentWindow["onRestored"].dispatch();
};
+
+exports.binding = appWindow.generate();
« no previous file with comments | « chrome/renderer/resources/extensions/app_runtime_custom_bindings.js ('k') | chrome/renderer/resources/extensions/binding.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698