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

Side by Side 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: rebased against head Created 8 years, 1 month 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/api/app_window.idl ('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 forEach = require('utils').forEach; 10 var forEach = require('utils').forEach;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 AppWindow.prototype[fn] = 76 AppWindow.prototype[fn] =
77 chromeHidden.internalAPIs.app.currentWindowInternal[fn]; 77 chromeHidden.internalAPIs.app.currentWindowInternal[fn];
78 }); 78 });
79 AppWindow.prototype.moveTo = window.moveTo.bind(window); 79 AppWindow.prototype.moveTo = window.moveTo.bind(window);
80 AppWindow.prototype.resizeTo = window.resizeTo.bind(window); 80 AppWindow.prototype.resizeTo = window.resizeTo.bind(window);
81 AppWindow.prototype.contentWindow = window; 81 AppWindow.prototype.contentWindow = window;
82 AppWindow.prototype.onClosed = new chrome.Event; 82 AppWindow.prototype.onClosed = new chrome.Event;
83 AppWindow.prototype.close = function() { 83 AppWindow.prototype.close = function() {
84 this.contentWindow.close(); 84 this.contentWindow.close();
85 }; 85 };
86 AppWindow.prototype.getBounds = function() {
87 var bounds = chromeHidden.appWindowData.bounds;
88 return { left: bounds.left, top: bounds.top,
89 width: bounds.width, height: bounds.height };
90 };
86 91
87 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { 92 Object.defineProperty(AppWindow.prototype, 'id', {get: function() {
88 return chromeHidden.appWindowData.id; 93 return chromeHidden.appWindowData.id;
89 }}); 94 }});
90 95
91 chromeHidden.appWindowData = { 96 chromeHidden.appWindowData = {
92 id: params.id || '' 97 id: params.id || '',
98 bounds: { left: 0, top: 0, width: 0, height: 0 }
93 }; 99 };
94 chromeHidden.currentAppWindow = new AppWindow; 100 chromeHidden.currentAppWindow = new AppWindow;
95 }); 101 });
96 }); 102 });
103
104 chromeHidden.updateAppWindowBounds = function(info) {
105 var data = chromeHidden.appWindowData;
106 if (!data)
107 return;
108 data.bounds.left = info.left;
109 data.bounds.top = info.top;
110 data.bounds.width = info.width;
111 data.bounds.height = info.height;
112 };
OLDNEW
« no previous file with comments | « 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