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 | 127 |
116 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { | 128 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
117 return appWindowData.id; | 129 return appWindowData.id; |
118 }}); | 130 }}); |
119 | 131 |
120 appWindowData = { | 132 appWindowData = { |
121 id: params.id || '', | 133 id: params.id || '', |
122 bounds: { left: params.bounds.left, top: params.bounds.top, | 134 bounds: { left: params.bounds.left, top: params.bounds.top, |
123 width: params.bounds.width, height: params.bounds.height }, | 135 width: params.bounds.width, height: params.bounds.height }, |
| 136 minWidth: params.minWidth, |
| 137 minHeight: params.minHeight, |
| 138 maxWidth: params.maxWidth, |
| 139 maxHeight: params.maxHeight, |
124 fullscreen: params.fullscreen, | 140 fullscreen: params.fullscreen, |
125 minimized: params.minimized, | 141 minimized: params.minimized, |
126 maximized: params.maximized | 142 maximized: params.maximized |
127 }; | 143 }; |
128 currentAppWindow = new AppWindow; | 144 currentAppWindow = new AppWindow; |
129 }); | 145 }); |
130 }); | 146 }); |
131 | 147 |
132 function boundsEqual(bounds1, bounds2) { | 148 function boundsEqual(bounds1, bounds2) { |
133 if (!bounds1 || !bounds2) | 149 if (!bounds1 || !bounds2) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 190 |
175 function onAppWindowClosed() { | 191 function onAppWindowClosed() { |
176 if (!currentAppWindow) | 192 if (!currentAppWindow) |
177 return; | 193 return; |
178 dispatchEventIfExists(currentAppWindow, "onClosed"); | 194 dispatchEventIfExists(currentAppWindow, "onClosed"); |
179 } | 195 } |
180 | 196 |
181 exports.binding = appWindow.generate(); | 197 exports.binding = appWindow.generate(); |
182 exports.onAppWindowClosed = onAppWindowClosed; | 198 exports.onAppWindowClosed = onAppWindowClosed; |
183 exports.updateAppWindowProperties = updateAppWindowProperties; | 199 exports.updateAppWindowProperties = updateAppWindowProperties; |
OLD | NEW |