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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return appWindowData.maximized; | 139 return appWindowData.maximized; |
140 }; | 140 }; |
141 AppWindow.prototype.isAlwaysOnTop = function() { | 141 AppWindow.prototype.isAlwaysOnTop = function() { |
142 return appWindowData.alwaysOnTop; | 142 return appWindowData.alwaysOnTop; |
143 }; | 143 }; |
144 | 144 |
145 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { | 145 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
146 return appWindowData.id; | 146 return appWindowData.id; |
147 }}); | 147 }}); |
148 | 148 |
| 149 // These properties are for testing. |
| 150 Object.defineProperty( |
| 151 AppWindow.prototype, 'hasFrameColor', {get: function() { |
| 152 return appWindowData.hasFrameColor; |
| 153 }}); |
| 154 |
| 155 Object.defineProperty(AppWindow.prototype, 'frameColor', {get: function() { |
| 156 return appWindowData.frameColor; |
| 157 }}); |
| 158 |
149 appWindowData = { | 159 appWindowData = { |
150 id: params.id || '', | 160 id: params.id || '', |
151 bounds: { left: params.bounds.left, top: params.bounds.top, | 161 bounds: { left: params.bounds.left, top: params.bounds.top, |
152 width: params.bounds.width, height: params.bounds.height }, | 162 width: params.bounds.width, height: params.bounds.height }, |
153 minWidth: params.minWidth, | 163 minWidth: params.minWidth, |
154 minHeight: params.minHeight, | 164 minHeight: params.minHeight, |
155 maxWidth: params.maxWidth, | 165 maxWidth: params.maxWidth, |
156 maxHeight: params.maxHeight, | 166 maxHeight: params.maxHeight, |
157 fullscreen: params.fullscreen, | 167 fullscreen: params.fullscreen, |
158 minimized: params.minimized, | 168 minimized: params.minimized, |
159 maximized: params.maximized, | 169 maximized: params.maximized, |
160 alwaysOnTop: params.alwaysOnTop | 170 alwaysOnTop: params.alwaysOnTop, |
| 171 hasFrameColor: params.hasFrameColor, |
| 172 frameColor: params.frameColor |
161 }; | 173 }; |
162 currentAppWindow = new AppWindow; | 174 currentAppWindow = new AppWindow; |
163 }); | 175 }); |
164 }); | 176 }); |
165 | 177 |
166 function boundsEqual(bounds1, bounds2) { | 178 function boundsEqual(bounds1, bounds2) { |
167 if (!bounds1 || !bounds2) | 179 if (!bounds1 || !bounds2) |
168 return false; | 180 return false; |
169 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && | 181 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && |
170 bounds1.width == bounds2.width && bounds1.height == bounds2.height); | 182 bounds1.width == bounds2.width && bounds1.height == bounds2.height); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 220 |
209 function onAppWindowClosed() { | 221 function onAppWindowClosed() { |
210 if (!currentAppWindow) | 222 if (!currentAppWindow) |
211 return; | 223 return; |
212 dispatchEventIfExists(currentAppWindow, "onClosed"); | 224 dispatchEventIfExists(currentAppWindow, "onClosed"); |
213 } | 225 } |
214 | 226 |
215 exports.binding = appWindow.generate(); | 227 exports.binding = appWindow.generate(); |
216 exports.onAppWindowClosed = onAppWindowClosed; | 228 exports.onAppWindowClosed = onAppWindowClosed; |
217 exports.updateAppWindowProperties = updateAppWindowProperties; | 229 exports.updateAppWindowProperties = updateAppWindowProperties; |
OLD | NEW |