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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 }; | 233 }; |
234 AppWindow.prototype.isMinimized = function() { | 234 AppWindow.prototype.isMinimized = function() { |
235 return appWindowData.minimized; | 235 return appWindowData.minimized; |
236 }; | 236 }; |
237 AppWindow.prototype.isMaximized = function() { | 237 AppWindow.prototype.isMaximized = function() { |
238 return appWindowData.maximized; | 238 return appWindowData.maximized; |
239 }; | 239 }; |
240 AppWindow.prototype.isAlwaysOnTop = function() { | 240 AppWindow.prototype.isAlwaysOnTop = function() { |
241 return appWindowData.alwaysOnTop; | 241 return appWindowData.alwaysOnTop; |
242 }; | 242 }; |
243 AppWindow.prototype.alphaEnabled = function() { | |
244 return appWindowData.alphaEnabled; | |
245 }; | |
243 | 246 |
244 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { | 247 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
245 return appWindowData.id; | 248 return appWindowData.id; |
246 }}); | 249 }}); |
247 | 250 |
248 // These properties are for testing. | 251 // These properties are for testing. |
249 Object.defineProperty( | 252 Object.defineProperty( |
250 AppWindow.prototype, 'hasFrameColor', {get: function() { | 253 AppWindow.prototype, 'hasFrameColor', {get: function() { |
251 return appWindowData.hasFrameColor; | 254 return appWindowData.hasFrameColor; |
252 }}); | 255 }}); |
(...skipping 29 matching lines...) Expand all Loading... | |
282 | 285 |
283 minWidth: params.outerBounds.minWidth, | 286 minWidth: params.outerBounds.minWidth, |
284 minHeight: params.outerBounds.minHeight, | 287 minHeight: params.outerBounds.minHeight, |
285 maxWidth: params.outerBounds.maxWidth, | 288 maxWidth: params.outerBounds.maxWidth, |
286 maxHeight: params.outerBounds.maxHeight | 289 maxHeight: params.outerBounds.maxHeight |
287 }, | 290 }, |
288 fullscreen: params.fullscreen, | 291 fullscreen: params.fullscreen, |
289 minimized: params.minimized, | 292 minimized: params.minimized, |
290 maximized: params.maximized, | 293 maximized: params.maximized, |
291 alwaysOnTop: params.alwaysOnTop, | 294 alwaysOnTop: params.alwaysOnTop, |
295 alphaEnabled: params.alphaEnabled, | |
292 hasFrameColor: params.hasFrameColor, | 296 hasFrameColor: params.hasFrameColor, |
293 activeFrameColor: params.activeFrameColor, | 297 activeFrameColor: params.activeFrameColor, |
294 inactiveFrameColor: params.inactiveFrameColor | 298 inactiveFrameColor: params.inactiveFrameColor |
295 }; | 299 }; |
296 currentAppWindow = new AppWindow; | 300 currentAppWindow = new AppWindow; |
297 }); | 301 }); |
298 }); | 302 }); |
299 | 303 |
300 function boundsEqual(bounds1, bounds2) { | 304 function boundsEqual(bounds1, bounds2) { |
301 if (!bounds1 || !bounds2) | 305 if (!bounds1 || !bounds2) |
(...skipping 29 matching lines...) Expand all Loading... | |
331 dispatchEventIfExists(currentWindow, "onFullscreened"); | 335 dispatchEventIfExists(currentWindow, "onFullscreened"); |
332 if (!oldData.minimized && update.minimized) | 336 if (!oldData.minimized && update.minimized) |
333 dispatchEventIfExists(currentWindow, "onMinimized"); | 337 dispatchEventIfExists(currentWindow, "onMinimized"); |
334 if (!oldData.maximized && update.maximized) | 338 if (!oldData.maximized && update.maximized) |
335 dispatchEventIfExists(currentWindow, "onMaximized"); | 339 dispatchEventIfExists(currentWindow, "onMaximized"); |
336 | 340 |
337 if ((oldData.fullscreen && !update.fullscreen) || | 341 if ((oldData.fullscreen && !update.fullscreen) || |
338 (oldData.minimized && !update.minimized) || | 342 (oldData.minimized && !update.minimized) || |
339 (oldData.maximized && !update.maximized)) | 343 (oldData.maximized && !update.maximized)) |
340 dispatchEventIfExists(currentWindow, "onRestored"); | 344 dispatchEventIfExists(currentWindow, "onRestored"); |
345 | |
346 if (oldData.alphaEnabled != update.alphaEnabled) | |
347 dispatchEventIfExists(currentWindow, "onAlphaEnabledChanged"); | |
benwells
2014/05/12 04:25:17
With the curernt code, this will never happen, and
garykac
2014/07/09 23:19:21
Removed for later cl. This should be called when t
jackhou1
2014/07/10 03:06:55
CL is here btw: https://codereview.chromium.org/37
garykac
2014/07/25 22:50:31
Acknowledged.
| |
341 }; | 348 }; |
342 | 349 |
343 function onAppWindowClosed() { | 350 function onAppWindowClosed() { |
344 if (!currentAppWindow) | 351 if (!currentAppWindow) |
345 return; | 352 return; |
346 dispatchEventIfExists(currentAppWindow, "onClosed"); | 353 dispatchEventIfExists(currentAppWindow, "onClosed"); |
347 } | 354 } |
348 | 355 |
349 function updateBounds(boundsType, bounds) { | 356 function updateBounds(boundsType, bounds) { |
350 if (!currentWindowInternal) | 357 if (!currentWindowInternal) |
(...skipping 13 matching lines...) Expand all Loading... | |
364 if (value === null) | 371 if (value === null) |
365 constraints[key] = 0; | 372 constraints[key] = 0; |
366 }); | 373 }); |
367 | 374 |
368 currentWindowInternal.setSizeConstraints(boundsType, constraints); | 375 currentWindowInternal.setSizeConstraints(boundsType, constraints); |
369 } | 376 } |
370 | 377 |
371 exports.binding = appWindow.generate(); | 378 exports.binding = appWindow.generate(); |
372 exports.onAppWindowClosed = onAppWindowClosed; | 379 exports.onAppWindowClosed = onAppWindowClosed; |
373 exports.updateAppWindowProperties = updateAppWindowProperties; | 380 exports.updateAppWindowProperties = updateAppWindowProperties; |
OLD | NEW |