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

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

Issue 10878040: Move context-sensitive app.window.* functions to app.window.current().* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add dom property Created 8 years, 4 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 ed430be286df5698911eb2394a619b402ff1515a..7bf1128ffda0dc7041c1db4cc95c1bd0703643ee 100644
--- a/chrome/renderer/resources/extensions/app_window_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/app_window_custom_bindings.js
@@ -16,14 +16,19 @@ chromeHidden.registerCustomHook('app.window', function(bindingsAPI) {
if (viewId)
view = GetView(viewId);
if (request.callback) {
- request.callback(view);
+ request.callback(view.chrome.app.window.current());
delete request.callback;
}
})
- apiFunctions.setHandleRequest('moveTo', function(x, y) {
- window.moveTo(x, y);
- })
- apiFunctions.setHandleRequest('resizeTo', function(width, height) {
- window.resizeTo(width, height);
+ var AppWindow = function() {};
+ for (var fn in chromeHidden.internalAPIs.app.currentWindowInternal) {
not at google - send to devlin 2012/08/27 01:51:59 loops with "foo in bar" should be protected by has
jeremya 2012/08/30 02:38:54 Done.
+ AppWindow.prototype[fn] =
+ chromeHidden.internalAPIs.app.currentWindowInternal[fn];
+ }
+ AppWindow.prototype.moveTo = window.moveTo.bind(window);
+ AppWindow.prototype.resizeTo = window.resizeTo.bind(window);
+ AppWindow.prototype.__defineGetter__('dom', function () { return window; });
not at google - send to devlin 2012/08/27 01:51:59 what's the advantage of making this a getter over
jeremya 2012/08/30 02:38:54 ... don't know :) changed to a property.
+ apiFunctions.setHandleRequest('current', function() {
+ return new AppWindow;
})
});

Powered by Google App Engine
This is Rietveld 408576698