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 add512d4bf0a00559694661d018583a01b775021..a22e11a79becb20defc01fd48b0bf02d784af975 100644 |
| --- a/chrome/renderer/resources/extensions/app_window_custom_bindings.js |
| +++ b/chrome/renderer/resources/extensions/app_window_custom_bindings.js |
| @@ -22,7 +22,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; |
| @@ -50,10 +50,10 @@ chromeHidden.registerCustomHook('app.window', function(bindingsAPI) { |
| if (!chromeHidden.currentAppWindow) |
| return; |
| chromeHidden.currentAppWindow.onClose.dispatch(); |
| - } |
| + }; |
| // 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) { |
| @@ -64,14 +64,32 @@ chromeHidden.registerCustomHook('app.window', function(bindingsAPI) { |
| AppWindow.prototype.resizeTo = window.resizeTo.bind(window); |
| AppWindow.prototype.contentWindow = window; |
| AppWindow.prototype.onClose = new chrome.Event; |
| + AppWindow.prototype.getBounds = function() { |
| + var data = chromeHidden.appWindowData; |
| + return { x: data.x, y: data.y, width: data.width, height: data.height }; |
| + }; |
| Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
| return chromeHidden.appWindowData.id; |
| }}); |
| chromeHidden.appWindowData = { |
| - id: params.id || '' |
| + id: params.id || '', |
| + x: 0, |
| + y: 0, |
| + width: 0, |
| + height: 0 |
| }; |
| chromeHidden.currentAppWindow = new AppWindow; |
| }); |
| }); |
| + |
| +chromeHidden.updateAppWindowBounds = function(info) { |
|
jeremya
2012/10/19 00:26:45
Hm, I should probably use this instead of my bespo
|
| + var data = chromeHidden.appWindowData; |
| + if (!data) |
| + return; |
| + data.x = info.x; |
|
jeremya
2012/10/19 00:26:45
Perhaps this should be in data.bounds?
|
| + data.y = info.y; |
| + data.width = info.width; |
| + data.height = info.height; |
| +}; |