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

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: fix 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..fa756783b9647c1b176f2be48e885020989b0017 100644
--- a/chrome/renderer/resources/extensions/app_window_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/app_window_custom_bindings.js
@@ -7,6 +7,7 @@
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
var sendRequest = require('sendRequest').sendRequest;
var appWindowNatives = requireNative('app_window');
+var forEach = require('utils').forEach;
var GetView = appWindowNatives.GetView;
chromeHidden.registerCustomHook('app.window', function(bindingsAPI) {
@@ -16,14 +17,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() {};
+ forEach(chromeHidden.internalAPIs.app.currentWindowInternal, function(fn) {
+ AppWindow.prototype[fn] =
+ chromeHidden.internalAPIs.app.currentWindowInternal[fn];
+ });
+ AppWindow.prototype.moveTo = window.moveTo.bind(window);
+ AppWindow.prototype.resizeTo = window.resizeTo.bind(window);
+ AppWindow.prototype.dom = window;
Aaron Boodman 2012/09/06 04:53:29 Nit: Not actually the 'dom', but the windows globa
jeremya 2012/09/06 16:31:20 Perhaps I should rename it to 'global'?
+ apiFunctions.setHandleRequest('current', function() {
+ return new AppWindow;
})
});

Powered by Google App Engine
This is Rietveld 408576698