OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 /** | 5 /** |
6 * @fileoverview This file contains the implementation of the Chrome extension | 6 * @fileoverview This file contains the implementation of the Chrome extension |
7 * windows APIs for the CEEE Firefox add-on. This file is loaded by the | 7 * windows APIs for the CEEE Firefox add-on. This file is loaded by the |
8 * overlay.xul file, and requires that overlay.js has already been loaded. | 8 * overlay.xul file, and requires that overlay.js has already been loaded. |
9 * | 9 * |
10 * @supported Firefox 3.x | 10 * @supported Firefox 3.x |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (!win) { | 136 if (!win) { |
137 throw(new Error(CEEE_window_internal_.CMD_GET_WINDOW + | 137 throw(new Error(CEEE_window_internal_.CMD_GET_WINDOW + |
138 ': invalid window id=' + id)); | 138 ': invalid window id=' + id)); |
139 } | 139 } |
140 | 140 |
141 return this.buildWindowValue(win); | 141 return this.buildWindowValue(win); |
142 }; | 142 }; |
143 | 143 |
144 CEEE_window_internal_.CMD_GET_CURRENT_WINDOW = 'windows.getCurrent'; | 144 CEEE_window_internal_.CMD_GET_CURRENT_WINDOW = 'windows.getCurrent'; |
145 CEEE_window_internal_.getCurrentWindow_ = function(cmd, data) { | 145 CEEE_window_internal_.getCurrentWindow_ = function(cmd, data) { |
146 return this.buildWindowValue(window); | 146 var tab = data.tab; |
| 147 if (tab) { |
| 148 var win = CEEE_mozilla_windows.findWindowFromCfSessionId(tab.id); |
| 149 if (win) |
| 150 return this.buildWindowValue(win); |
| 151 } |
147 }; | 152 }; |
148 | 153 |
149 CEEE_window_internal_.CMD_GET_LAST_FOCUSED_WINDOW = | 154 CEEE_window_internal_.CMD_GET_LAST_FOCUSED_WINDOW = |
150 'windows.getLastFocused'; | 155 'windows.getLastFocused'; |
151 CEEE_window_internal_.getLastFocusedWindow_ = function(cmd, data) { | 156 CEEE_window_internal_.getLastFocusedWindow_ = function(cmd, data) { |
152 var win = CEEE_mozilla_windows.service.getMostRecentWindow( | 157 var win = CEEE_mozilla_windows.service.getMostRecentWindow( |
153 CEEE_mozilla_windows.WINDOW_TYPE); | 158 CEEE_mozilla_windows.WINDOW_TYPE); |
154 return this.buildWindowValue(win); | 159 return this.buildWindowValue(win); |
155 }; | 160 }; |
156 | 161 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 windows, | 351 windows, |
347 windows.removeWindow_); | 352 windows.removeWindow_); |
348 | 353 |
349 // Install the error/status reporting methods for this module from the | 354 // Install the error/status reporting methods for this module from the |
350 // owning CEEE instance. | 355 // owning CEEE instance. |
351 windows.logInfo_ = ceeeInstance.logInfo; | 356 windows.logInfo_ = ceeeInstance.logInfo; |
352 windows.logError_ = ceeeInstance.logError; | 357 windows.logError_ = ceeeInstance.logError; |
353 | 358 |
354 return windows; | 359 return windows; |
355 } | 360 } |
OLD | NEW |