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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 AppWindow.prototype.contentWindow = window; | 96 AppWindow.prototype.contentWindow = window; |
97 AppWindow.prototype.onClosed = new Event(); | 97 AppWindow.prototype.onClosed = new Event(); |
98 AppWindow.prototype.close = function() { | 98 AppWindow.prototype.close = function() { |
99 this.contentWindow.close(); | 99 this.contentWindow.close(); |
100 }; | 100 }; |
101 AppWindow.prototype.getBounds = function() { | 101 AppWindow.prototype.getBounds = function() { |
102 var bounds = appWindowData.bounds; | 102 var bounds = appWindowData.bounds; |
103 return { left: bounds.left, top: bounds.top, | 103 return { left: bounds.left, top: bounds.top, |
104 width: bounds.width, height: bounds.height }; | 104 width: bounds.width, height: bounds.height }; |
105 }; | 105 }; |
| 106 AppWindow.prototype.getMinWidth = function() { |
| 107 return appWindowData.minWidth; |
| 108 }; |
| 109 AppWindow.prototype.getMinHeight = function() { |
| 110 return appWindowData.minHeight; |
| 111 }; |
| 112 AppWindow.prototype.getMaxWidth = function() { |
| 113 return appWindowData.maxWidth; |
| 114 }; |
| 115 AppWindow.prototype.getMaxHeight = function() { |
| 116 return appWindowData.maxHeight; |
| 117 }; |
106 AppWindow.prototype.isFullscreen = function() { | 118 AppWindow.prototype.isFullscreen = function() { |
107 return appWindowData.fullscreen; | 119 return appWindowData.fullscreen; |
108 }; | 120 }; |
109 AppWindow.prototype.isMinimized = function() { | 121 AppWindow.prototype.isMinimized = function() { |
110 return appWindowData.minimized; | 122 return appWindowData.minimized; |
111 }; | 123 }; |
112 AppWindow.prototype.isMaximized = function() { | 124 AppWindow.prototype.isMaximized = function() { |
113 return appWindowData.maximized; | 125 return appWindowData.maximized; |
114 }; | 126 }; |
115 AppWindow.prototype.isAlwaysOnTop = function() { | 127 AppWindow.prototype.isAlwaysOnTop = function() { |
116 return appWindowData.alwaysOnTop; | 128 return appWindowData.alwaysOnTop; |
117 }; | 129 }; |
118 | 130 |
119 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { | 131 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
120 return appWindowData.id; | 132 return appWindowData.id; |
121 }}); | 133 }}); |
122 | 134 |
123 appWindowData = { | 135 appWindowData = { |
124 id: params.id || '', | 136 id: params.id || '', |
125 bounds: { left: params.bounds.left, top: params.bounds.top, | 137 bounds: { left: params.bounds.left, top: params.bounds.top, |
126 width: params.bounds.width, height: params.bounds.height }, | 138 width: params.bounds.width, height: params.bounds.height }, |
| 139 minWidth: params.minWidth, |
| 140 minHeight: params.minHeight, |
| 141 maxWidth: params.maxWidth, |
| 142 maxHeight: params.maxHeight, |
127 fullscreen: params.fullscreen, | 143 fullscreen: params.fullscreen, |
128 minimized: params.minimized, | 144 minimized: params.minimized, |
129 maximized: params.maximized, | 145 maximized: params.maximized, |
130 alwaysOnTop: params.alwaysOnTop | 146 alwaysOnTop: params.alwaysOnTop |
131 }; | 147 }; |
132 currentAppWindow = new AppWindow; | 148 currentAppWindow = new AppWindow; |
133 }); | 149 }); |
134 }); | 150 }); |
135 | 151 |
136 function boundsEqual(bounds1, bounds2) { | 152 function boundsEqual(bounds1, bounds2) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 194 |
179 function onAppWindowClosed() { | 195 function onAppWindowClosed() { |
180 if (!currentAppWindow) | 196 if (!currentAppWindow) |
181 return; | 197 return; |
182 dispatchEventIfExists(currentAppWindow, "onClosed"); | 198 dispatchEventIfExists(currentAppWindow, "onClosed"); |
183 } | 199 } |
184 | 200 |
185 exports.binding = appWindow.generate(); | 201 exports.binding = appWindow.generate(); |
186 exports.onAppWindowClosed = onAppWindowClosed; | 202 exports.onAppWindowClosed = onAppWindowClosed; |
187 exports.updateAppWindowProperties = updateAppWindowProperties; | 203 exports.updateAppWindowProperties = updateAppWindowProperties; |
OLD | NEW |