Chromium Code Reviews| 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 d087c72f15889772107555e42e18222e662907dd..eb511ac39f2961cedeb4806f5b1625c83d4be33d 100644 |
| --- a/chrome/renderer/resources/extensions/app_window_custom_bindings.js |
| +++ b/chrome/renderer/resources/extensions/app_window_custom_bindings.js |
| @@ -23,7 +23,7 @@ chromeHidden.registerCustomHook('app.window', function(bindingsAPI) { |
| // No route to created window. If given a callback, trigger it with an |
| // undefined object. |
| if (request.callback) { |
| - request.callback() |
| + request.callback(); |
| delete request.callback; |
| } |
| return; |
| @@ -69,7 +69,7 @@ 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 |
| + // because it is called from a different JS context. |
| apiFunctions.setHandleRequest('initializeAppWindow', function(params) { |
| var AppWindow = function() {}; |
| forEach(chromeHidden.internalAPIs.app.currentWindowInternal, function(fn) { |
| @@ -95,7 +95,8 @@ chromeHidden.registerCustomHook('app.window', function(bindingsAPI) { |
| chromeHidden.appWindowData = { |
| id: params.id || '', |
| - bounds: { left: 0, top: 0, width: 0, height: 0 } |
| + bounds: { left: params.bounds.left, top: params.bounds.top, |
| + width: params.bounds.width, height: params.bounds.height } |
| }; |
| chromeHidden.currentAppWindow = new AppWindow; |
| }); |
| @@ -110,3 +111,19 @@ chromeHidden.updateAppWindowBounds = function(info) { |
| data.bounds.width = info.width; |
| data.bounds.height = info.height; |
| }; |
| + |
| +chromeHidden.registerCustomHook('app.currentWindowInternal', |
| + function(bindingsAPI) { |
| + var apiFunctions = bindingsAPI.apiFunctions; |
| + apiFunctions.setUpdateArgumentsPostValidate('setBounds', function(bounds) { |
| + // Cache the update locally so that getBounds can immediately return the |
| + // updated value. |
|
jeremya
2012/11/13 06:16:30
What happens if the bounds you set aren't the boun
asargent_no_longer_on_chrome
2012/11/14 05:22:12
We won't know synchronously that this has happened
|
| + var cachedBounds = chromeHidden.appWindowData.bounds; |
| + var names = ['left', 'top', 'width', 'height']; |
| + for (var i = 0; i < names.length; i++) { |
| + if (typeof(bounds[names[i]]) != 'undefined') |
| + cachedBounds[names[i]] = bounds[names[i]]; |
| + } |
| + return arguments; |
| + }); |
| +}); |