| 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 Binding = require('binding').Binding; | 8 var Binding = require('binding').Binding; |
| 9 var Event = require('event_bindings').Event; | 9 var Event = require('event_bindings').Event; |
| 10 var forEach = require('utils').forEach; | 10 var forEach = require('utils').forEach; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 }; | 105 }; |
| 106 AppWindow.prototype.isFullscreen = function() { | 106 AppWindow.prototype.isFullscreen = function() { |
| 107 return appWindowData.fullscreen; | 107 return appWindowData.fullscreen; |
| 108 }; | 108 }; |
| 109 AppWindow.prototype.isMinimized = function() { | 109 AppWindow.prototype.isMinimized = function() { |
| 110 return appWindowData.minimized; | 110 return appWindowData.minimized; |
| 111 }; | 111 }; |
| 112 AppWindow.prototype.isMaximized = function() { | 112 AppWindow.prototype.isMaximized = function() { |
| 113 return appWindowData.maximized; | 113 return appWindowData.maximized; |
| 114 }; | 114 }; |
| 115 AppWindow.prototype.isAlwaysOnTop = function() { |
| 116 return appWindowData.alwaysOnTop; |
| 117 }; |
| 115 | 118 |
| 116 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { | 119 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
| 117 return appWindowData.id; | 120 return appWindowData.id; |
| 118 }}); | 121 }}); |
| 119 | 122 |
| 120 appWindowData = { | 123 appWindowData = { |
| 121 id: params.id || '', | 124 id: params.id || '', |
| 122 bounds: { left: params.bounds.left, top: params.bounds.top, | 125 bounds: { left: params.bounds.left, top: params.bounds.top, |
| 123 width: params.bounds.width, height: params.bounds.height }, | 126 width: params.bounds.width, height: params.bounds.height }, |
| 124 fullscreen: params.fullscreen, | 127 fullscreen: params.fullscreen, |
| 125 minimized: params.minimized, | 128 minimized: params.minimized, |
| 126 maximized: params.maximized | 129 maximized: params.maximized, |
| 130 alwaysOnTop: params.alwaysOnTop |
| 127 }; | 131 }; |
| 128 currentAppWindow = new AppWindow; | 132 currentAppWindow = new AppWindow; |
| 129 }); | 133 }); |
| 130 }); | 134 }); |
| 131 | 135 |
| 132 function boundsEqual(bounds1, bounds2) { | 136 function boundsEqual(bounds1, bounds2) { |
| 133 if (!bounds1 || !bounds2) | 137 if (!bounds1 || !bounds2) |
| 134 return false; | 138 return false; |
| 135 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && | 139 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && |
| 136 bounds1.width == bounds2.width && bounds1.height == bounds2.height); | 140 bounds1.width == bounds2.width && bounds1.height == bounds2.height); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 178 |
| 175 function onAppWindowClosed() { | 179 function onAppWindowClosed() { |
| 176 if (!currentAppWindow) | 180 if (!currentAppWindow) |
| 177 return; | 181 return; |
| 178 dispatchEventIfExists(currentAppWindow, "onClosed"); | 182 dispatchEventIfExists(currentAppWindow, "onClosed"); |
| 179 } | 183 } |
| 180 | 184 |
| 181 exports.binding = appWindow.generate(); | 185 exports.binding = appWindow.generate(); |
| 182 exports.onAppWindowClosed = onAppWindowClosed; | 186 exports.onAppWindowClosed = onAppWindowClosed; |
| 183 exports.updateAppWindowProperties = updateAppWindowProperties; | 187 exports.updateAppWindowProperties = updateAppWindowProperties; |
| OLD | NEW |