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

Side by Side Diff: chrome/renderer/resources/extensions/app_window_custom_bindings.js

Issue 186343002: Create windows for new app window bounds API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 6 years, 9 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
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 binding for the app_window API. 5 // Custom binding for the app_window API.
6 6
7 var appWindowNatives = requireNative('app_window_natives'); 7 var appWindowNatives = requireNative('app_window_natives');
8 var runtimeNatives = requireNative('runtime'); 8 var runtimeNatives = requireNative('runtime');
9 var Binding = require('binding').Binding; 9 var Binding = require('binding').Binding;
10 var Event = require('event_bindings').Event; 10 var Event = require('event_bindings').Event;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 AppWindow.prototype[key] = value; 162 AppWindow.prototype[key] = value;
163 }); 163 });
164 AppWindow.prototype.moveTo = $Function.bind(window.moveTo, window); 164 AppWindow.prototype.moveTo = $Function.bind(window.moveTo, window);
165 AppWindow.prototype.resizeTo = $Function.bind(window.resizeTo, window); 165 AppWindow.prototype.resizeTo = $Function.bind(window.resizeTo, window);
166 AppWindow.prototype.contentWindow = window; 166 AppWindow.prototype.contentWindow = window;
167 AppWindow.prototype.onClosed = new Event(); 167 AppWindow.prototype.onClosed = new Event();
168 AppWindow.prototype.close = function() { 168 AppWindow.prototype.close = function() {
169 this.contentWindow.close(); 169 this.contentWindow.close();
170 }; 170 };
171 AppWindow.prototype.getBounds = function() { 171 AppWindow.prototype.getBounds = function() {
172 var bounds = appWindowData.innerBounds; 172 // This is to maintain backcompatibility with a bug on Windows and
173 return { left: bounds.left, top: bounds.top, 173 // ChromeOS, which returns the position of the window but the size of
174 width: bounds.width, height: bounds.height }; 174 // the content.
175 var innerBounds = appWindowData.innerBounds;
176 var outerBounds = appWindowData.outerBounds;
177 return { left: outerBounds.left, top: outerBounds.top,
178 width: innerBounds.width, height: innerBounds.height };
175 }; 179 };
176 AppWindow.prototype.getMinWidth = function() { 180 AppWindow.prototype.getMinWidth = function() {
177 return appWindowData.innerBounds.minWidth; 181 return appWindowData.innerBounds.minWidth;
178 }; 182 };
179 AppWindow.prototype.getMinHeight = function() { 183 AppWindow.prototype.getMinHeight = function() {
180 return appWindowData.innerBounds.minHeight; 184 return appWindowData.innerBounds.minHeight;
181 }; 185 };
182 AppWindow.prototype.getMaxWidth = function() { 186 AppWindow.prototype.getMaxWidth = function() {
183 return appWindowData.innerBounds.maxWidth; 187 return appWindowData.innerBounds.maxWidth;
184 }; 188 };
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 296
293 function onAppWindowClosed() { 297 function onAppWindowClosed() {
294 if (!currentAppWindow) 298 if (!currentAppWindow)
295 return; 299 return;
296 dispatchEventIfExists(currentAppWindow, "onClosed"); 300 dispatchEventIfExists(currentAppWindow, "onClosed");
297 } 301 }
298 302
299 exports.binding = appWindow.generate(); 303 exports.binding = appWindow.generate();
300 exports.onAppWindowClosed = onAppWindowClosed; 304 exports.onAppWindowClosed = onAppWindowClosed;
301 exports.updateAppWindowProperties = updateAppWindowProperties; 305 exports.updateAppWindowProperties = updateAppWindowProperties;
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/app_window.idl ('k') | chrome/test/data/extensions/platform_apps/window_api/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698