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

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

Issue 11193049: Add the app.windows.getBounds method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 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;
+};
« chrome/common/extensions/api/app_window.idl ('K') | « chrome/common/extensions/api/app_window.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698