50 const Ci = Components.interfaces;
52 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
56 XPCOMUtils.defineLazyServiceGetter(
this,
"_focusManager",
57 "@mozilla.org/focus-manager;1",
81 switch (aEvent.type) {
102 if (
aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
108 if (windowEntry.lastSelectedBrowser)
109 this.decreasePriority(windowEntry.lastSelectedBrowser);
112 windowEntry.lastSelectedBrowser =
aBrowser;
117 return aBrowser.webNavigation.QueryInterface(
Ci.nsIDocumentLoader)
118 .loadGroup.QueryInterface(
Ci.nsISupportsPriority);
121 increasePriority:
function(
aBrowser) {
125 decreasePriority:
function(
aBrowser) {
133 addWindow:
function(aWindow) {
135 _windows.push({
window: aWindow, lastSelectedBrowser:
null });
147 if (aWindow == _focusManager.activeWindow)
148 this.handleFocusedWindow(aWindow);
150 this.decreasePriority(aWindow);
153 BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
156 removeWindow:
function(aWindow) {
157 if (aWindow == _lastFocusedWindow)
158 _lastFocusedWindow =
null;
161 _windows.splice(this.getEntryIndex(aWindow), 1);
172 onActivate:
function(aWindow, aHasFocus) {
174 if (aWindow == _lastFocusedWindow)
178 this.handleFocusedWindow(aWindow);
181 this.increasePriority(aWindow);
184 handleFocusedWindow:
function(aWindow) {
186 if (_lastFocusedWindow)
187 this.decreasePriority(_lastFocusedWindow);
190 _lastFocusedWindow = aWindow;
194 increasePriority:
function(aWindow) {
195 aWindow.gBrowser.browsers.forEach(
function(
aBrowser) {
196 BrowserHelper.increasePriority(
aBrowser);
200 decreasePriority:
function(aWindow) {
201 aWindow.gBrowser.browsers.forEach(
function(
aBrowser) {
202 BrowserHelper.decreasePriority(
aBrowser);
206 getEntry:
function(aWindow) {
207 return _windows[this.getEntryIndex(aWindow)];
210 getEntryIndex:
function(aWindow) {
212 for (let
i = 0;
i < _windows.length;
i++)
213 if (_windows[
i].
window == aWindow)
function _handleEvent(aEvent)
function trackBrowserWindow(aWindow)
_updateTextAndScrollDataForTab aBrowser
_dialogDatepicker onSelect
_getSelectedPageStyle s i