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

Side by Side 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: comments Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/permissions/api_permission.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Custom bindings for the app_window API. 5 // Custom bindings for the app_window API.
6 6
7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
8 var sendRequest = require('sendRequest').sendRequest; 8 var sendRequest = require('sendRequest').sendRequest;
9 var appWindowNatives = requireNative('app_window'); 9 var appWindowNatives = requireNative('app_window');
10 var GetView = appWindowNatives.GetView; 10 var GetView = appWindowNatives.GetView;
11 11
12 chromeHidden.registerCustomHook('app.window', function(bindingsAPI) { 12 chromeHidden.registerCustomHook('app.window', function(bindingsAPI) {
13 var apiFunctions = bindingsAPI.apiFunctions; 13 var apiFunctions = bindingsAPI.apiFunctions;
14 apiFunctions.setCustomCallback('create', function(name, request, viewId) { 14 apiFunctions.setCustomCallback('create', function(name, request, viewId) {
15 var view = null; 15 var view = null;
16 if (viewId) 16 if (viewId)
17 view = GetView(viewId); 17 view = GetView(viewId);
18 if (request.callback) { 18 if (request.callback) {
19 request.callback(view); 19 request.callback(view.chrome.app.window.current());
20 delete request.callback; 20 delete request.callback;
21 } 21 }
22 }) 22 })
23 apiFunctions.setHandleRequest('moveTo', function(x, y) { 23 var AppWindow = function() {};
24 window.moveTo(x, y); 24 for (var fn in chromeHidden.internalAPIs.app.currentWindowInternal) {
25 }) 25 AppWindow.prototype[fn] =
26 apiFunctions.setHandleRequest('resizeTo', function(width, height) { 26 chromeHidden.internalAPIs.app.currentWindowInternal[fn];
27 window.resizeTo(width, height); 27 }
28 AppWindow.prototype.moveTo = window.moveTo.bind(window);
Mihai Parparita -not on Chrome 2012/08/24 17:58:09 Will this do the right thing for manipulating non-
jeremya 2012/08/26 23:49:38 appWindow in the callback there is the return valu
29 AppWindow.prototype.resizeTo = window.resizeTo.bind(window);
30 apiFunctions.setHandleRequest('current', function() {
31 return new AppWindow;
28 }) 32 })
29 }); 33 });
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/api_permission.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698