Chromium Code Reviews| 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 bindings for the app_window API. | 5 // Custom bindings for the app_window API. |
| 6 | 6 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 8 var sendRequest = require('sendRequest').sendRequest; | 8 var sendRequest = require('sendRequest').sendRequest; |
| 9 var appWindowNatives = requireNative('app_window'); | 9 var appWindowNatives = requireNative('app_window'); |
| 10 var forEach = require('utils').forEach; | 10 var forEach = require('utils').forEach; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 AppWindow.prototype[fn] = | 76 AppWindow.prototype[fn] = |
| 77 chromeHidden.internalAPIs.app.currentWindowInternal[fn]; | 77 chromeHidden.internalAPIs.app.currentWindowInternal[fn]; |
| 78 }); | 78 }); |
| 79 AppWindow.prototype.moveTo = window.moveTo.bind(window); | 79 AppWindow.prototype.moveTo = window.moveTo.bind(window); |
| 80 AppWindow.prototype.resizeTo = window.resizeTo.bind(window); | 80 AppWindow.prototype.resizeTo = window.resizeTo.bind(window); |
| 81 AppWindow.prototype.contentWindow = window; | 81 AppWindow.prototype.contentWindow = window; |
| 82 AppWindow.prototype.onClosed = new chrome.Event; | 82 AppWindow.prototype.onClosed = new chrome.Event; |
| 83 AppWindow.prototype.close = function() { | 83 AppWindow.prototype.close = function() { |
| 84 this.contentWindow.close(); | 84 this.contentWindow.close(); |
| 85 }; | 85 }; |
| 86 AppWindow.prototype.getBounds = function() { | |
| 87 var bounds = chromeHidden.appWindowData.bounds; | |
| 88 return { left: bounds.left, top: bounds.top, | |
| 89 width: bounds.width, height:bounds.height }; | |
|
jeremya
2012/10/31 00:32:46
nit: missing space
asargent_no_longer_on_chrome
2012/10/31 05:37:35
Done.
| |
| 90 }; | |
| 86 | 91 |
| 87 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { | 92 Object.defineProperty(AppWindow.prototype, 'id', {get: function() { |
| 88 return chromeHidden.appWindowData.id; | 93 return chromeHidden.appWindowData.id; |
| 89 }}); | 94 }}); |
| 90 | 95 |
| 91 chromeHidden.appWindowData = { | 96 chromeHidden.appWindowData = { |
| 92 id: params.id || '' | 97 id: params.id || '', |
| 98 bounds: { left: 0, top: 0, width: 0, height: 0 } | |
| 93 }; | 99 }; |
| 94 chromeHidden.currentAppWindow = new AppWindow; | 100 chromeHidden.currentAppWindow = new AppWindow; |
| 95 }); | 101 }); |
| 96 }); | 102 }); |
| 103 | |
| 104 chromeHidden.updateAppWindowBounds = function(info) { | |
| 105 var data = chromeHidden.appWindowData; | |
| 106 if (!data) | |
| 107 return; | |
| 108 data.bounds.left = info.left; | |
| 109 data.bounds.top = info.top; | |
| 110 data.bounds.width = info.width; | |
| 111 data.bounds.height = info.height; | |
| 112 }; | |
| OLD | NEW |