OLD | NEW |
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 }; | 237 }; |
238 AppWindow.prototype.isMaximized = function() { | 238 AppWindow.prototype.isMaximized = function() { |
239 return appWindowData.maximized; | 239 return appWindowData.maximized; |
240 }; | 240 }; |
241 AppWindow.prototype.isAlwaysOnTop = function() { | 241 AppWindow.prototype.isAlwaysOnTop = function() { |
242 return appWindowData.alwaysOnTop; | 242 return appWindowData.alwaysOnTop; |
243 }; | 243 }; |
244 AppWindow.prototype.alphaEnabled = function() { | 244 AppWindow.prototype.alphaEnabled = function() { |
245 return appWindowData.alphaEnabled; | 245 return appWindowData.alphaEnabled; |
246 }; | 246 }; |
| 247 AppWindow.prototype.canSetVisibleOnAllWorkspaces = function () { |
| 248 return appWindowData.canSetVisibleOnAllWorkspaces; |
| 249 }; |
247 AppWindow.prototype.handleWindowFirstShownForTests = function(callback) { | 250 AppWindow.prototype.handleWindowFirstShownForTests = function(callback) { |
248 // This allows test apps to get have their callback run even if they | 251 // This allows test apps to get have their callback run even if they |
249 // call this after the first show has happened. | 252 // call this after the first show has happened. |
250 if (this.firstShowHasHappened) { | 253 if (this.firstShowHasHappened) { |
251 callback(); | 254 callback(); |
252 return; | 255 return; |
253 } | 256 } |
254 this.onWindowFirstShownForTests.addListener(callback); | 257 this.onWindowFirstShownForTests.addListener(callback); |
255 } | 258 } |
256 | 259 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 maxWidth: params.outerBounds.maxWidth, | 301 maxWidth: params.outerBounds.maxWidth, |
299 maxHeight: params.outerBounds.maxHeight | 302 maxHeight: params.outerBounds.maxHeight |
300 }, | 303 }, |
301 fullscreen: params.fullscreen, | 304 fullscreen: params.fullscreen, |
302 minimized: params.minimized, | 305 minimized: params.minimized, |
303 maximized: params.maximized, | 306 maximized: params.maximized, |
304 alwaysOnTop: params.alwaysOnTop, | 307 alwaysOnTop: params.alwaysOnTop, |
305 hasFrameColor: params.hasFrameColor, | 308 hasFrameColor: params.hasFrameColor, |
306 activeFrameColor: params.activeFrameColor, | 309 activeFrameColor: params.activeFrameColor, |
307 inactiveFrameColor: params.inactiveFrameColor, | 310 inactiveFrameColor: params.inactiveFrameColor, |
308 alphaEnabled: params.alphaEnabled | 311 alphaEnabled: params.alphaEnabled, |
| 312 canSetVisibleOnAllWorkspaces: params.canSetVisibleOnAllWorkspaces |
309 }; | 313 }; |
310 currentAppWindow = new AppWindow; | 314 currentAppWindow = new AppWindow; |
311 }); | 315 }); |
312 }); | 316 }); |
313 | 317 |
314 function boundsEqual(bounds1, bounds2) { | 318 function boundsEqual(bounds1, bounds2) { |
315 if (!bounds1 || !bounds2) | 319 if (!bounds1 || !bounds2) |
316 return false; | 320 return false; |
317 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && | 321 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && |
318 bounds1.width == bounds2.width && bounds1.height == bounds2.height); | 322 bounds1.width == bounds2.width && bounds1.height == bounds2.height); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 constraints[key] = 0; | 396 constraints[key] = 0; |
393 }); | 397 }); |
394 | 398 |
395 currentWindowInternal.setSizeConstraints(boundsType, constraints); | 399 currentWindowInternal.setSizeConstraints(boundsType, constraints); |
396 } | 400 } |
397 | 401 |
398 exports.binding = appWindow.generate(); | 402 exports.binding = appWindow.generate(); |
399 exports.onAppWindowClosed = onAppWindowClosed; | 403 exports.onAppWindowClosed = onAppWindowClosed; |
400 exports.updateAppWindowProperties = updateAppWindowProperties; | 404 exports.updateAppWindowProperties = updateAppWindowProperties; |
401 exports.appWindowShownForTests = onAppWindowShownForTests; | 405 exports.appWindowShownForTests = onAppWindowShownForTests; |
OLD | NEW |