| 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();
|
|
|