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 Binding = require('binding').Binding; | 7 var Binding = require('binding').Binding; |
8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
9 var chrome = requireNative('chrome').GetChrome(); | 9 var chrome = requireNative('chrome').GetChrome(); |
10 var sendRequest = require('sendRequest').sendRequest; | 10 var sendRequest = require('sendRequest').sendRequest; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 }; | 115 }; |
116 | 116 |
117 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { | 117 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
118 return chromeHidden.appWindowData.id; | 118 return chromeHidden.appWindowData.id; |
119 }}); | 119 }}); |
120 | 120 |
121 chromeHidden.appWindowData = { | 121 chromeHidden.appWindowData = { |
122 id: params.id || '', | 122 id: params.id || '', |
123 bounds: { left: params.bounds.left, top: params.bounds.top, | 123 bounds: { left: params.bounds.left, top: params.bounds.top, |
124 width: params.bounds.width, height: params.bounds.height }, | 124 width: params.bounds.width, height: params.bounds.height }, |
125 fullscreen: false, | 125 fullscreen: params.fullscreen, |
126 minimized: false, | 126 minimized: params.minimized, |
127 maximized: false | 127 maximized: params.maximized |
128 }; | 128 }; |
129 chromeHidden.currentAppWindow = new AppWindow; | 129 chromeHidden.currentAppWindow = new AppWindow; |
130 }); | 130 }); |
131 }); | 131 }); |
132 | 132 |
133 function boundsEqual(bounds1, bounds2) { | 133 function boundsEqual(bounds1, bounds2) { |
134 if (!bounds1 || !bounds2) | 134 if (!bounds1 || !bounds2) |
135 return false; | 135 return false; |
136 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && | 136 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && |
137 bounds1.width == bounds2.width && bounds1.height == bounds2.height); | 137 bounds1.width == bounds2.width && bounds1.height == bounds2.height); |
(...skipping 18 matching lines...) Expand all Loading... |
156 if (!oldData.maximized && update.maximized) | 156 if (!oldData.maximized && update.maximized) |
157 currentWindow["onMaximized"].dispatch(); | 157 currentWindow["onMaximized"].dispatch(); |
158 | 158 |
159 if ((oldData.fullscreen && !update.fullscreen) || | 159 if ((oldData.fullscreen && !update.fullscreen) || |
160 (oldData.minimized && !update.minimized) || | 160 (oldData.minimized && !update.minimized) || |
161 (oldData.maximized && !update.maximized)) | 161 (oldData.maximized && !update.maximized)) |
162 currentWindow["onRestored"].dispatch(); | 162 currentWindow["onRestored"].dispatch(); |
163 }; | 163 }; |
164 | 164 |
165 exports.binding = appWindow.generate(); | 165 exports.binding = appWindow.generate(); |
OLD | NEW |