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 | 6 * @fileoverview |
7 * This file contains global declarations used by the CEEE Firefox add-on. | 7 * This file contains global declarations used by the CEEE Firefox add-on. |
8 * Global variables defined in overlay.js are global only to a single top-level | 8 * Global variables defined in overlay.js are global only to a single top-level |
9 * window, and not to the entire Firefox app. | 9 * window, and not to the entire Firefox app. |
10 * | 10 * |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 'window': w, | 135 'window': w, |
136 'tabBrowser': mainBrowser, | 136 'tabBrowser': mainBrowser, |
137 'index': index | 137 'index': index |
138 }; | 138 }; |
139 } | 139 } |
140 } | 140 } |
141 } | 141 } |
142 }; | 142 }; |
143 | 143 |
144 /** | 144 /** |
| 145 * Find the window with the given a Chrome Frame session id. |
| 146 * |
| 147 * @param {number} id The Chrome Frame session Id of the window to find. |
| 148 * @return The window that contains the Chrome Frame instance with the |
| 149 * specified session Id, or null if no window is found. |
| 150 * @public |
| 151 */ |
| 152 CEEE_mozilla_windows.findWindowFromCfSessionId = function(id) { |
| 153 var e = this.service.getEnumerator(this.WINDOW_TYPE); |
| 154 while (e.hasMoreElements()) { |
| 155 var win = e.getNext(); |
| 156 var cf = win.document.getElementById(CEEE_globals.CHROME_FRAME_ID); |
| 157 if (cf.sessionid == id) |
| 158 return win; |
| 159 } |
| 160 return null; |
| 161 }; |
| 162 |
| 163 /** |
145 * Global object used as a place-holder for API routines accessing the Mozilla | 164 * Global object used as a place-holder for API routines accessing the Mozilla |
146 * tabs interface. | 165 * tabs interface. |
147 * @public | 166 * @public |
148 */ | 167 */ |
149 var CEEE_mozilla_tabs = CEEE_mozilla_tabs || { | 168 var CEEE_mozilla_tabs = CEEE_mozilla_tabs || { |
150 /** @const */ TAB_ID: 'ceee_tabid' | 169 /** @const */ TAB_ID: 'ceee_tabid' |
151 }; | 170 }; |
152 | 171 |
153 /** | 172 /** |
154 * Get the unique id of the given tab. If the tab does not have | 173 * Get the unique id of the given tab. If the tab does not have |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 }; | 389 }; |
371 | 390 |
372 | 391 |
373 /** | 392 /** |
374 * A class to hold all global variables and methods. | 393 * A class to hold all global variables and methods. |
375 */ | 394 */ |
376 var CEEE_globals = CEEE_globals || { | 395 var CEEE_globals = CEEE_globals || { |
377 /** @const */ MAIN_BROWSER_ID: 'content', | 396 /** @const */ MAIN_BROWSER_ID: 'content', |
378 /** @const */ ADDON_ID: 'ceee@google.com', | 397 /** @const */ ADDON_ID: 'ceee@google.com', |
379 | 398 |
| 399 /** |
| 400 * Value used for id attribute of the ChromeFrame <embed> element. |
| 401 * @const |
| 402 */ |
| 403 CHROME_FRAME_ID: 'ceee-browser', |
| 404 |
380 /** The integer id for the next window. @private */ | 405 /** The integer id for the next window. @private */ |
381 nextWindowId_: 0, | 406 nextWindowId_: 0, |
382 | 407 |
383 /** The integer id for the next tab. @private */ | 408 /** The integer id for the next tab. @private */ |
384 nextTabId_: 0, | 409 nextTabId_: 0, |
385 | 410 |
386 /** The integer id for the next tab. @private */ | 411 /** The integer id for the next tab. @private */ |
387 nextPortId_: 0, | 412 nextPortId_: 0, |
388 | 413 |
389 /** Preferences object for CEEE. @private */ | 414 /** Preferences object for CEEE. @private */ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 * @param {Object} obj 'this' object for the function. | 533 * @param {Object} obj 'this' object for the function. |
509 * @return {function(?)} A closure of a first argument. | 534 * @return {function(?)} A closure of a first argument. |
510 */ | 535 */ |
511 CEEE_globals.hitch = function(func, obj /* , arg1, arg2,... */) { | 536 CEEE_globals.hitch = function(func, obj /* , arg1, arg2,... */) { |
512 var args = Array.prototype.slice.call(arguments, 2); | 537 var args = Array.prototype.slice.call(arguments, 2); |
513 return function() { | 538 return function() { |
514 var a = Array.prototype.slice.call(arguments); | 539 var a = Array.prototype.slice.call(arguments); |
515 return func.apply(obj, args.concat(a)); | 540 return func.apply(obj, args.concat(a)); |
516 }; | 541 }; |
517 }; | 542 }; |
OLD | NEW |