Backed out 2 changesets (bug 1470510) for build bustage on /build/src/widget/cocoa/nsChildView.mm. CLOSED TREE

Backed out changeset 5967bf633574 (bug 1470510)
Backed out changeset 067a556bb614 (bug 1470510)

--HG--
rename : xpfe/appshell/nsIAppWindow.idl => xpfe/appshell/nsIXULWindow.idl
rename : xpfe/appshell/AppWindow.cpp => xpfe/appshell/nsXULWindow.cpp
rename : xpfe/appshell/AppWindow.h => xpfe/appshell/nsXULWindow.h
extra : amend_source : 752d828c6a0726c3f2df57a25741e38b36b75d6b
This commit is contained in:
Dorel Luca 2019-11-04 19:18:56 +02:00
Родитель b1b874a300
Коммит 0207ce5451
71 изменённых файлов: 1673 добавлений и 1557 удалений

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#ifdef MOZ_XUL #ifdef MOZ_XUL
# include "nsIAppWindow.h" # include "nsIXULWindow.h"
#endif #endif
using namespace mozilla; using namespace mozilla;
@ -97,18 +97,18 @@ role RootAccessible::NativeRole() const {
uint32_t RootAccessible::GetChromeFlags() const { uint32_t RootAccessible::GetChromeFlags() const {
// Return the flag set for the top level window as defined // Return the flag set for the top level window as defined
// by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME] // by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
// Not simple: nsIAppWindow is not just a QI from nsIDOMWindow // Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode); nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode);
NS_ENSURE_TRUE(docShell, 0); NS_ENSURE_TRUE(docShell, 0);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner; nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
docShell->GetTreeOwner(getter_AddRefs(treeOwner)); docShell->GetTreeOwner(getter_AddRefs(treeOwner));
NS_ENSURE_TRUE(treeOwner, 0); NS_ENSURE_TRUE(treeOwner, 0);
nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(treeOwner)); nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwner));
if (!appWin) { if (!xulWin) {
return 0; return 0;
} }
uint32_t chromeFlags; uint32_t chromeFlags;
appWin->GetChromeFlags(&chromeFlags); xulWin->GetChromeFlags(&chromeFlags);
return chromeFlags; return chromeFlags;
} }
#endif #endif

Просмотреть файл

@ -1759,7 +1759,7 @@ var gBrowserInit = {
// This needs setting up before we create the first remote browser. // This needs setting up before we create the first remote browser.
window.docShell.treeOwner window.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).XULBrowserWindow = window.XULBrowserWindow; .getInterface(Ci.nsIXULWindow).XULBrowserWindow = window.XULBrowserWindow;
window.browserDOMWindow = new nsBrowserAccess(); window.browserDOMWindow = new nsBrowserAccess();
gBrowser = window._gBrowser; gBrowser = window._gBrowser;
@ -2534,7 +2534,7 @@ var gBrowserInit = {
window.XULBrowserWindow = null; window.XULBrowserWindow = null;
window.docShell.treeOwner window.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).XULBrowserWindow = null; .getInterface(Ci.nsIXULWindow).XULBrowserWindow = null;
window.browserDOMWindow = null; window.browserDOMWindow = null;
}, },
}; };

Просмотреть файл

@ -449,11 +449,11 @@ let LEGACY_ACTORS = {
// Set the size to use when the user leaves the maximized mode. // Set the size to use when the user leaves the maximized mode.
// The persisted size is the outer size, but the height/width // The persisted size is the outer size, but the height/width
// attributes set the inner size. // attributes set the inner size.
let appWin = win.docShell.treeOwner let xulWin = win.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow); .getInterface(Ci.nsIXULWindow);
height -= appWin.outerToInnerHeightDifferenceInCSSPixels; height -= xulWin.outerToInnerHeightDifferenceInCSSPixels;
width -= appWin.outerToInnerWidthDifferenceInCSSPixels; width -= xulWin.outerToInnerWidthDifferenceInCSSPixels;
docElt.setAttribute("height", height); docElt.setAttribute("height", height);
docElt.setAttribute("width", width); docElt.setAttribute("width", width);
} else { } else {

Просмотреть файл

@ -131,7 +131,7 @@ var DownloadsTaskbar = {
// Activate the indicator on the specified window. // Activate the indicator on the specified window.
let docShell = aWindow.docShell.treeOwner let docShell = aWindow.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).docShell; .getInterface(Ci.nsIXULWindow).docShell;
this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell); this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell);
// If the DownloadSummary object has already been created, we should update // If the DownloadSummary object has already been created, we should update

Просмотреть файл

@ -1009,7 +1009,7 @@ class Window extends WindowBase {
} }
get alwaysOnTop() { get alwaysOnTop() {
return this.appWindow.zLevel >= Ci.nsIAppWindow.raisedZ; return this.xulWindow.zLevel >= Ci.nsIXULWindow.raisedZ;
} }
get isLastFocused() { get isLastFocused() {

Просмотреть файл

@ -172,7 +172,7 @@ add_task(async function testWindowCreate() {
if (expected.chromeFlags) { if (expected.chromeFlags) {
let { chromeFlags } = latestWindow.docShell.treeOwner let { chromeFlags } = latestWindow.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow); .getInterface(Ci.nsIXULWindow);
for (let flag of expected.chromeFlags) { for (let flag of expected.chromeFlags) {
ok( ok(
chromeFlags & Ci.nsIWebBrowserChrome[flag], chromeFlags & Ci.nsIWebBrowserChrome[flag],

Просмотреть файл

@ -2,7 +2,7 @@
/** /**
* Given some window in the parent process, ensure that * Given some window in the parent process, ensure that
* the nsIAppWindow has the CHROME_PRIVATE_WINDOW chromeFlag, * the nsIXULWindow has the CHROME_PRIVATE_WINDOW chromeFlag,
* and that the usePrivateBrowsing property is set to true on * and that the usePrivateBrowsing property is set to true on
* both the window's nsILoadContext, as well as on the initial * both the window's nsILoadContext, as well as on the initial
* browser's content docShell nsILoadContext. * browser's content docShell nsILoadContext.
@ -15,7 +15,7 @@ function assertWindowIsPrivate(win) {
let winDocShell = win.docShell; let winDocShell = win.docShell;
let chromeFlags = winDocShell.treeOwner let chromeFlags = winDocShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).chromeFlags; .getInterface(Ci.nsIXULWindow).chromeFlags;
if (!win.gBrowser.selectedBrowser.hasContentOpener) { if (!win.gBrowser.selectedBrowser.hasContentOpener) {
Assert.ok( Assert.ok(

Просмотреть файл

@ -244,10 +244,10 @@ class TelemetryHandler {
* This is called when a new window is opened, and handles registration of * This is called when a new window is opened, and handles registration of
* that window if it is a browser window. * that window if it is a browser window.
* *
* @param {nsIAppWindow} appWin The xul window that was opened. * @param {nsIXULWindow} xulWin The xul window that was opened.
*/ */
onOpenWindow(appWin) { onOpenWindow(xulWin) {
let win = appWin.docShell.domWindow; let win = xulWin.docShell.domWindow;
win.addEventListener( win.addEventListener(
"load", "load",
() => { () => {
@ -268,10 +268,10 @@ class TelemetryHandler {
* Listener that is called when a window is closed, and handles deregistration of * Listener that is called when a window is closed, and handles deregistration of
* that window if it is a browser window. * that window if it is a browser window.
* *
* @param {nsIAppWindow} appWin The xul window that was closed. * @param {nsIXULWindow} xulWin The xul window that was closed.
*/ */
onCloseWindow(appWin) { onCloseWindow(xulWin) {
let win = appWin.docShell.domWindow; let win = xulWin.docShell.domWindow;
if ( if (
win.document.documentElement.getAttribute("windowtype") != win.document.documentElement.getAttribute("windowtype") !=

Просмотреть файл

@ -5259,7 +5259,7 @@ var SessionStoreInternal = {
}, },
/** /**
* on popup windows, the AppWindow's attributes seem not to be set correctly * on popup windows, the XULWindow's attributes seem not to be set correctly
* we use thus JSDOMWindow attributes for sizemode and normal window attributes * we use thus JSDOMWindow attributes for sizemode and normal window attributes
* (and hope for reasonable values when maximized/minimized - since then * (and hope for reasonable values when maximized/minimized - since then
* outerWidth/outerHeight aren't the dimensions of the restored window) * outerWidth/outerHeight aren't the dimensions of the restored window)
@ -5298,13 +5298,13 @@ var SessionStoreInternal = {
} }
// Width and height attribute report the inner size, but we want // Width and height attribute report the inner size, but we want
// to store the outer size, so add the difference. // to store the outer size, so add the difference.
let appWin = aWindow.docShell.treeOwner let xulWin = aWindow.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow); .getInterface(Ci.nsIXULWindow);
let diff = let diff =
aAttribute == "width" aAttribute == "width"
? appWin.outerToInnerWidthDifferenceInCSSPixels ? xulWin.outerToInnerWidthDifferenceInCSSPixels
: appWin.outerToInnerHeightDifferenceInCSSPixels; : xulWin.outerToInnerHeightDifferenceInCSSPixels;
return attr + diff; return attr + diff;
} }
} }

Просмотреть файл

@ -123,8 +123,8 @@ startupRecorder.prototype = {
// not other types (for example, the gfx sanity test window) // not other types (for example, the gfx sanity test window)
if (topic == firstPaintNotification) { if (topic == firstPaintNotification) {
// In the case we're handling xul-window-visible, we'll have been handed // In the case we're handling xul-window-visible, we'll have been handed
// an nsIAppWindow instead of an nsIDOMWindow. // an nsIXULWindow instead of an nsIDOMWindow.
if (subject instanceof Ci.nsIAppWindow) { if (subject instanceof Ci.nsIXULWindow) {
subject = subject subject = subject
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow); .getInterface(Ci.nsIDOMWindow);

Просмотреть файл

@ -289,12 +289,12 @@ BrowserTabList.prototype._getChildren = function(window) {
}; };
BrowserTabList.prototype.getList = function(browserActorOptions) { BrowserTabList.prototype.getList = function(browserActorOptions) {
const topAppWindow = Services.wm.getMostRecentWindow( const topXULWindow = Services.wm.getMostRecentWindow(
DebuggerServer.chromeWindowType DebuggerServer.chromeWindowType
); );
let selectedBrowser = null; let selectedBrowser = null;
if (topAppWindow) { if (topXULWindow) {
selectedBrowser = this._getSelectedBrowser(topAppWindow); selectedBrowser = this._getSelectedBrowser(topXULWindow);
} }
// As a sanity check, make sure all the actors presently in our map get // As a sanity check, make sure all the actors presently in our map get
@ -416,11 +416,11 @@ BrowserTabList.prototype.getTab = function(
}); });
} }
const topAppWindow = Services.wm.getMostRecentWindow( const topXULWindow = Services.wm.getMostRecentWindow(
DebuggerServer.chromeWindowType DebuggerServer.chromeWindowType
); );
if (topAppWindow) { if (topXULWindow) {
const selectedBrowser = this._getSelectedBrowser(topAppWindow); const selectedBrowser = this._getSelectedBrowser(topXULWindow);
return this._getActorForBrowser(selectedBrowser, browserActorOptions); return this._getActorForBrowser(selectedBrowser, browserActorOptions);
} }
return Promise.reject({ return Promise.reject({
@ -781,7 +781,7 @@ BrowserTabList.prototype.onOpenWindow = DevToolsUtils.makeInfallible(function(
BrowserTabList.prototype.onCloseWindow = DevToolsUtils.makeInfallible(function( BrowserTabList.prototype.onCloseWindow = DevToolsUtils.makeInfallible(function(
window window
) { ) {
if (window instanceof Ci.nsIAppWindow) { if (window instanceof Ci.nsIXULWindow) {
window = window.docShell.domWindow; window = window.docShell.domWindow;
} }

Просмотреть файл

@ -4984,7 +4984,7 @@ nsDocShell::SetParentNativeWindow(nativeWindow aParentNativeWindow) {
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::GetNativeHandle(nsAString& aNativeHandle) { nsDocShell::GetNativeHandle(nsAString& aNativeHandle) {
// the nativeHandle should be accessed from nsIAppWindow // the nativeHandle should be accessed from nsIXULWindow
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }

Просмотреть файл

@ -360,7 +360,7 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
if (browserChild) { if (browserChild) {
// The XUL window to resize is in the parent process, but there we // The XUL window to resize is in the parent process, but there we
// won't be able to get aShellItem to do the hack in // won't be able to get aShellItem to do the hack in
// AppWindow::SizeShellTo, so let's send the width and height of // nsXULWindow::SizeShellTo, so let's send the width and height of
// aShellItem too. // aShellItem too.
nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(aShellItem)); nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(aShellItem));
NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE); NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE);
@ -588,7 +588,7 @@ nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow) {
NS_IMETHODIMP NS_IMETHODIMP
nsDocShellTreeOwner::GetNativeHandle(nsAString& aNativeHandle) { nsDocShellTreeOwner::GetNativeHandle(nsAString& aNativeHandle) {
// the nativeHandle should be accessed from nsIAppWindow // the nativeHandle should be accessed from nsIXULWindow
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }

Просмотреть файл

@ -33,7 +33,7 @@ add_task(async function() {
let chromeFlags = win.docShell.treeOwner let chromeFlags = win.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).chromeFlags; .getInterface(Ci.nsIXULWindow).chromeFlags;
let expected = CHROME_ALL; let expected = CHROME_ALL;

Просмотреть файл

@ -312,7 +312,7 @@
#ifdef MOZ_XUL #ifdef MOZ_XUL
# include "mozilla/dom/XULBroadcastManager.h" # include "mozilla/dom/XULBroadcastManager.h"
# include "mozilla/dom/XULPersist.h" # include "mozilla/dom/XULPersist.h"
# include "nsIAppWindow.h" # include "nsIXULWindow.h"
# include "nsIChromeRegistry.h" # include "nsIChromeRegistry.h"
# include "nsXULPrototypeDocument.h" # include "nsXULPrototypeDocument.h"
# include "nsXULCommandDispatcher.h" # include "nsXULCommandDispatcher.h"
@ -8381,7 +8381,7 @@ void Document::SetMayStartLayout(bool aMayStartLayout) {
// Before starting layout, check whether we're a toplevel chrome // Before starting layout, check whether we're a toplevel chrome
// window. If we are, setup some state so that we don't have to restyle // window. If we are, setup some state so that we don't have to restyle
// the whole tree after StartLayout. // the whole tree after StartLayout.
if (nsCOMPtr<nsIAppWindow> win = GetAppWindowIfToplevelChrome()) { if (nsCOMPtr<nsIXULWindow> win = GetXULWindowIfToplevelChrome()) {
// We're the chrome document! // We're the chrome document!
win->BeforeStartLayout(); win->BeforeStartLayout();
} }
@ -14275,23 +14275,23 @@ already_AddRefed<XPathResult> Document::Evaluate(
aType, aResult, rv); aType, aResult, rv);
} }
already_AddRefed<nsIAppWindow> Document::GetAppWindowIfToplevelChrome() const { already_AddRefed<nsIXULWindow> Document::GetXULWindowIfToplevelChrome() const {
nsCOMPtr<nsIDocShellTreeItem> item = GetDocShell(); nsCOMPtr<nsIDocShellTreeItem> item = GetDocShell();
if (!item) { if (!item) {
return nullptr; return nullptr;
} }
nsCOMPtr<nsIDocShellTreeOwner> owner; nsCOMPtr<nsIDocShellTreeOwner> owner;
item->GetTreeOwner(getter_AddRefs(owner)); item->GetTreeOwner(getter_AddRefs(owner));
nsCOMPtr<nsIAppWindow> appWin = do_GetInterface(owner); nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(owner);
if (!appWin) { if (!xulWin) {
return nullptr; return nullptr;
} }
nsCOMPtr<nsIDocShell> appWinShell; nsCOMPtr<nsIDocShell> xulWinShell;
appWin->GetDocShell(getter_AddRefs(appWinShell)); xulWin->GetDocShell(getter_AddRefs(xulWinShell));
if (!SameCOMIdentity(appWinShell, item)) { if (!SameCOMIdentity(xulWinShell, item)) {
return nullptr; return nullptr;
} }
return appWin.forget(); return xulWin.forget();
} }
Document* Document::GetTopLevelContentDocument() { Document* Document::GetTopLevelContentDocument() {

Просмотреть файл

@ -133,7 +133,7 @@ class nsWindowSizes;
class nsDOMCaretPosition; class nsDOMCaretPosition;
class nsViewportInfo; class nsViewportInfo;
class nsIGlobalObject; class nsIGlobalObject;
class nsIAppWindow; class nsIXULWindow;
class nsXULPrototypeDocument; class nsXULPrototypeDocument;
class nsXULPrototypeElement; class nsXULPrototypeElement;
class PermissionDelegateHandler; class PermissionDelegateHandler;
@ -3536,9 +3536,9 @@ class Document : public nsINode,
Document* GetTopLevelContentDocument(); Document* GetTopLevelContentDocument();
const Document* GetTopLevelContentDocument() const; const Document* GetTopLevelContentDocument() const;
// Returns the associated app window if this is a top-level chrome document, // Returns the associated XUL window if this is a top-level chrome document,
// null otherwise. // null otherwise.
already_AddRefed<nsIAppWindow> GetAppWindowIfToplevelChrome() const; already_AddRefed<nsIXULWindow> GetXULWindowIfToplevelChrome() const;
already_AddRefed<Element> CreateElement( already_AddRefed<Element> CreateElement(
const nsAString& aTagName, const ElementCreationOptionsOrString& aOptions, const nsAString& aTagName, const ElementCreationOptionsOrString& aOptions,

Просмотреть файл

@ -18,7 +18,7 @@
#include "nsISHEntry.h" #include "nsISHEntry.h"
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIAppShellService.h" #include "nsIAppShellService.h"
#include "nsAppShellCID.h" #include "nsAppShellCID.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
@ -351,7 +351,7 @@ nsresult nsCCUncollectableMarker::Observe(nsISupports* aSubject,
bool hasHiddenWindow = false; bool hasHiddenWindow = false;
appShell->GetHasHiddenWindow(&hasHiddenWindow); appShell->GetHasHiddenWindow(&hasHiddenWindow);
if (hasHiddenWindow) { if (hasHiddenWindow) {
nsCOMPtr<nsIAppWindow> hw; nsCOMPtr<nsIXULWindow> hw;
appShell->GetHiddenWindow(getter_AddRefs(hw)); appShell->GetHiddenWindow(getter_AddRefs(hw));
nsCOMPtr<nsIDocShell> shell; nsCOMPtr<nsIDocShell> shell;
hw->GetDocShell(getter_AddRefs(shell)); hw->GetDocShell(getter_AddRefs(shell));

Просмотреть файл

@ -24,7 +24,7 @@
#include "nsIWebNavigation.h" #include "nsIWebNavigation.h"
#include "nsCaret.h" #include "nsCaret.h"
#include "nsIBaseWindow.h" #include "nsIBaseWindow.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsViewManager.h" #include "nsViewManager.h"
#include "nsFrameSelection.h" #include "nsFrameSelection.h"
#include "mozilla/dom/Document.h" #include "mozilla/dom/Document.h"
@ -700,10 +700,10 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
NS_ASSERTION(currentWindow, "window raised with no window current"); NS_ASSERTION(currentWindow, "window raised with no window current");
if (!currentWindow) return NS_OK; if (!currentWindow) return NS_OK;
// If there is no nsIAppWindow, then this is an embedded or child process // If there is no nsIXULWindow, then this is an embedded or child process
// window. Pass false for aWindowRaised so that commands get updated. // window. Pass false for aWindowRaised so that commands get updated.
nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(baseWindow)); nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(baseWindow));
Focus(currentWindow, currentFocus, 0, true, false, appWin != nullptr, true); Focus(currentWindow, currentFocus, 0, true, false, xulWin != nullptr, true);
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -39,7 +39,7 @@
#include "nsSubDocumentFrame.h" #include "nsSubDocumentFrame.h"
#include "nsError.h" #include "nsError.h"
#include "nsISHistory.h" #include "nsISHistory.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIMozBrowserFrame.h" #include "nsIMozBrowserFrame.h"
#include "nsISHistory.h" #include "nsISHistory.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"
@ -2598,7 +2598,7 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
!parentOwner) { !parentOwner) {
return false; return false;
} }
nsCOMPtr<nsIAppWindow> window(do_GetInterface(parentOwner)); nsCOMPtr<nsIXULWindow> window(do_GetInterface(parentOwner));
if (window && NS_FAILED(window->GetChromeFlags(&chromeFlags))) { if (window && NS_FAILED(window->GetChromeFlags(&chromeFlags))) {
return false; return false;
} }

Просмотреть файл

@ -160,6 +160,7 @@
#include "mozilla/EventStateManager.h" #include "mozilla/EventStateManager.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
#include "nsIXULWindow.h"
#include "nsITimedChannel.h" #include "nsITimedChannel.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#ifdef MOZ_XUL #ifdef MOZ_XUL

Просмотреть файл

@ -154,7 +154,7 @@
#include "mozilla/EventStateManager.h" #include "mozilla/EventStateManager.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsITimedChannel.h" #include "nsITimedChannel.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "mozilla/dom/CustomEvent.h" #include "mozilla/dom/CustomEvent.h"
@ -1546,7 +1546,7 @@ void nsGlobalWindowOuter::SetInitialPrincipalToSubject(
// We should never create windows with an expanded principal. // We should never create windows with an expanded principal.
// If we have a system principal, make sure we're not using it for a content // If we have a system principal, make sure we're not using it for a content
// docshell. // docshell.
// NOTE: Please keep this logic in sync with AppWindow::Initialize(). // NOTE: Please keep this logic in sync with nsWebShellWindow::Initialize().
if (nsContentUtils::IsExpandedPrincipal(newWindowPrincipal) || if (nsContentUtils::IsExpandedPrincipal(newWindowPrincipal) ||
(nsContentUtils::IsSystemPrincipal(newWindowPrincipal) && (nsContentUtils::IsSystemPrincipal(newWindowPrincipal) &&
GetDocShell()->ItemType() != nsIDocShellTreeItem::typeChrome)) { GetDocShell()->ItemType() != nsIDocShellTreeItem::typeChrome)) {
@ -4404,9 +4404,9 @@ nsresult nsGlobalWindowOuter::SetFullscreenInternal(FullscreenReason aReason,
// Prevent chrome documents which are still loading from resizing // Prevent chrome documents which are still loading from resizing
// the window after we set fullscreen mode. // the window after we set fullscreen mode.
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow(); nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(treeOwnerAsWin)); nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwnerAsWin));
if (aFullscreen && appWin) { if (aFullscreen && xulWin) {
appWin->SetIntrinsicallySized(false); xulWin->SetIntrinsicallySized(false);
} }
// Set this before so if widget sends an event indicating its // Set this before so if widget sends an event indicating its
@ -6795,10 +6795,10 @@ void nsGlobalWindowOuter::ActivateOrDeactivate(bool aActivate) {
// Get the top level widget's nsGlobalWindowOuter // Get the top level widget's nsGlobalWindowOuter
nsCOMPtr<nsPIDOMWindowOuter> topLevelWindow; nsCOMPtr<nsPIDOMWindowOuter> topLevelWindow;
// widgetListener should be an AppWindow // widgetListener should be a nsXULWindow
nsIWidgetListener* listener = topLevelWidget->GetWidgetListener(); nsIWidgetListener* listener = topLevelWidget->GetWidgetListener();
if (listener) { if (listener) {
nsCOMPtr<nsIAppWindow> window = listener->GetAppWindow(); nsCOMPtr<nsIXULWindow> window = listener->GetXULWindow();
nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(window)); nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(window));
topLevelWindow = do_GetInterface(req); topLevelWindow = do_GetInterface(req);
} }

Просмотреть файл

@ -72,7 +72,7 @@
#include "nsIWebBrowserChrome.h" #include "nsIWebBrowserChrome.h"
#include "nsIWebProtocolHandlerRegistrar.h" #include "nsIWebProtocolHandlerRegistrar.h"
#include "nsIXULBrowserWindow.h" #include "nsIXULBrowserWindow.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsViewManager.h" #include "nsViewManager.h"
#include "nsVariant.h" #include "nsVariant.h"
#include "nsIWidget.h" #include "nsIWidget.h"
@ -410,7 +410,7 @@ nsIXULBrowserWindow* BrowserParent::GetXULBrowserWindow() {
return nullptr; return nullptr;
} }
nsCOMPtr<nsIAppWindow> window = do_GetInterface(treeOwner); nsCOMPtr<nsIXULWindow> window = do_GetInterface(treeOwner);
if (!window) { if (!window) {
return nullptr; return nullptr;
} }
@ -798,9 +798,9 @@ mozilla::ipc::IPCResult BrowserParent::RecvSizeShellTo(
height = mDimensions.height; height = mDimensions.height;
} }
nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(treeOwner)); nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwner));
NS_ENSURE_TRUE(appWin, IPC_OK()); NS_ENSURE_TRUE(xulWin, IPC_OK());
appWin->SizeShellToWithLimit(width, height, aShellItemWidth, xulWin->SizeShellToWithLimit(width, height, aShellItemWidth,
aShellItemHeight); aShellItemHeight);
return IPC_OK(); return IPC_OK();

Просмотреть файл

@ -178,7 +178,7 @@
#include "nsIURIFixup.h" #include "nsIURIFixup.h"
#include "nsIURL.h" #include "nsIURL.h"
#include "nsIDocShellTreeOwner.h" #include "nsIDocShellTreeOwner.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIDOMChromeWindow.h" #include "nsIDOMChromeWindow.h"
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h" #include "nsPIWindowWatcher.h"

Просмотреть файл

@ -13,7 +13,7 @@
# include "nsIStringEnumerator.h" # include "nsIStringEnumerator.h"
#endif #endif
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -25,12 +25,12 @@ static bool IsRootElement(Element* aElement) {
static bool ShouldPersistAttribute(Element* aElement, nsAtom* aAttribute) { static bool ShouldPersistAttribute(Element* aElement, nsAtom* aAttribute) {
if (IsRootElement(aElement)) { if (IsRootElement(aElement)) {
// This is not an element of the top document, its owner is // This is not an element of the top document, its owner is
// not an AppWindow. Persist it. // not an nsXULWindow. Persist it.
if (aElement->OwnerDoc()->GetInProcessParentDocument()) { if (aElement->OwnerDoc()->GetInProcessParentDocument()) {
return true; return true;
} }
// The following attributes of xul:window should be handled in // The following attributes of xul:window should be handled in
// AppWindow::SavePersistentAttributes instead of here. // nsXULWindow::SavePersistentAttributes instead of here.
if (aAttribute == nsGkAtoms::screenX || aAttribute == nsGkAtoms::screenY || if (aAttribute == nsGkAtoms::screenX || aAttribute == nsGkAtoms::screenY ||
aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height || aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height ||
aAttribute == nsGkAtoms::sizemode) { aAttribute == nsGkAtoms::sizemode) {
@ -66,7 +66,7 @@ void XULPersist::AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
// //
// XXX Namespace handling broken :-( // XXX Namespace handling broken :-(
nsAutoString persist; nsAutoString persist;
// Persistence of attributes of xul:window is handled in AppWindow. // Persistence of attributes of xul:window is handled in nsXULWindow.
if (aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::persist, persist) && if (aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::persist, persist) &&
ShouldPersistAttribute(aElement, aAttribute) && !persist.IsEmpty() && ShouldPersistAttribute(aElement, aAttribute) && !persist.IsEmpty() &&
// XXXldb This should check that it's a token, not just a substring. // XXXldb This should check that it's a token, not just a substring.
@ -135,10 +135,10 @@ void XULPersist::Persist(Element* aElement, int32_t aNameSpaceID,
return; return;
} }
// Persisting attributes to top level windows is handled by AppWindow. // Persisting attributes to top level windows is handled by nsXULWindow.
if (IsRootElement(aElement)) { if (IsRootElement(aElement)) {
if (nsCOMPtr<nsIAppWindow> win = if (nsCOMPtr<nsIXULWindow> win =
mDocument->GetAppWindowIfToplevelChrome()) { mDocument->GetXULWindowIfToplevelChrome()) {
return; return;
} }
} }
@ -300,10 +300,10 @@ nsresult XULPersist::ApplyPersistentAttributesToElements(
} }
// Applying persistent attributes to top level windows is handled // Applying persistent attributes to top level windows is handled
// by AppWindow. // by nsXULWindow.
if (IsRootElement(element)) { if (IsRootElement(element)) {
if (nsCOMPtr<nsIAppWindow> win = if (nsCOMPtr<nsIXULWindow> win =
mDocument->GetAppWindowIfToplevelChrome()) { mDocument->GetXULWindowIfToplevelChrome()) {
continue; continue;
} }
} }

Просмотреть файл

@ -13,7 +13,7 @@ this.damp = class extends ExtensionAPI {
damp: { damp: {
startTest() { startTest() {
let { rootURI } = context.extension; let { rootURI } = context.extension;
let window = context.appWindow; let window = context.xulWindow;
if (!("Damp" in window)) { if (!("Damp" in window)) {
let script = rootURI.resolve("content/damp.js"); let script = rootURI.resolve("content/damp.js");
Services.scriptloader.loadSubScript(script, window); Services.scriptloader.loadSubScript(script, window);

Просмотреть файл

@ -55,7 +55,7 @@ async function startTest(context) {
Cu.forceGC(); Cu.forceGC();
Cu.forceCC(); Cu.forceCC();
Cu.forceShrinkingGC(); Cu.forceShrinkingGC();
let win = context.appWindow; let win = context.xulWindow;
await openDelay(win); await openDelay(win);
let mozAfterPaint = waitForBrowserPaint(); let mozAfterPaint = waitForBrowserPaint();

Просмотреть файл

@ -1079,7 +1079,7 @@ nsWebBrowser::SetParentNativeWindow(nativeWindow aParentNativeWindow) {
NS_IMETHODIMP NS_IMETHODIMP
nsWebBrowser::GetNativeHandle(nsAString& aNativeHandle) { nsWebBrowser::GetNativeHandle(nsAString& aNativeHandle) {
// the nativeHandle should be accessed from nsIAppWindow // the nativeHandle should be accessed from nsIXULWindow
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }

Просмотреть файл

@ -808,14 +808,14 @@ class ExtensionPageContextParent extends ProxyContextParent {
} }
// The window that contains this context. This may change due to moving tabs. // The window that contains this context. This may change due to moving tabs.
get appWindow() { get xulWindow() {
let win = this.xulBrowser.ownerGlobal; let win = this.xulBrowser.ownerGlobal;
return win.docShell.rootTreeItem.domWindow; return win.docShell.rootTreeItem.domWindow;
} }
get currentWindow() { get currentWindow() {
if (this.viewType !== "background") { if (this.viewType !== "background") {
return this.appWindow; return this.xulWindow;
} }
} }

Просмотреть файл

@ -843,14 +843,14 @@ class WindowBase {
} }
/** /**
* @property {nsIAppWindow} appWindow * @property {nsIXULWindow} xulWindow
* The nsIAppWindow object for this browser window. * The nsIXULWindow object for this browser window.
* @readonly * @readonly
*/ */
get appWindow() { get xulWindow() {
return this.window.docShell.treeOwner return this.window.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow); .getInterface(Ci.nsIXULWindow);
} }
/** /**
@ -876,7 +876,7 @@ class WindowBase {
* @readonly * @readonly
*/ */
get type() { get type() {
let { chromeFlags } = this.appWindow; let { chromeFlags } = this.xulWindow;
if (chromeFlags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) { if (chromeFlags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) {
return "popup"; return "popup";

Просмотреть файл

@ -11,7 +11,7 @@
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIDocShellTreeOwner.h" #include "nsIDocShellTreeOwner.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsXPCOM.h" #include "nsXPCOM.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
@ -75,8 +75,8 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(
nsCOMPtr<nsIDocShellTreeOwner> owner; nsCOMPtr<nsIDocShellTreeOwner> owner;
docShell->GetTreeOwner(getter_AddRefs(owner)); docShell->GetTreeOwner(getter_AddRefs(owner));
nsCOMPtr<nsIAppWindow> ownerAppWindow = do_GetInterface(owner); nsCOMPtr<nsIXULWindow> ownerXULWindow = do_GetInterface(owner);
nsCOMPtr<mozIDOMWindowProxy> ownerWindow = do_GetInterface(ownerAppWindow); nsCOMPtr<mozIDOMWindowProxy> ownerWindow = do_GetInterface(ownerXULWindow);
NS_ENSURE_STATE(ownerWindow); NS_ENSURE_STATE(ownerWindow);
nsCOMPtr<nsPIDOMWindowOuter> piOwnerWindow = nsCOMPtr<nsPIDOMWindowOuter> piOwnerWindow =

Просмотреть файл

@ -138,7 +138,7 @@ function getPromptState(ui) {
// We can't just check window.opener because that'll be // We can't just check window.opener because that'll be
// a content window, which therefore isn't exposed (it'll lie and // a content window, which therefore isn't exposed (it'll lie and
// be null). // be null).
let flags = treeOwner.getInterface(Ci.nsIAppWindow).chromeFlags; let flags = treeOwner.getInterface(Ci.nsIXULWindow).chromeFlags;
state.chrome = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0; state.chrome = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0;
state.dialog = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) != 0; state.dialog = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) != 0;
state.chromeDependent = state.chromeDependent =

Просмотреть файл

@ -17,7 +17,7 @@
#include "nsIPrefService.h" #include "nsIPrefService.h"
#include "nsIPrefBranch.h" #include "nsIPrefBranch.h"
#include "nsITimer.h" #include "nsITimer.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIWebProgress.h" #include "nsIWebProgress.h"
#include "nsPresContext.h" #include "nsPresContext.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
@ -666,7 +666,7 @@ bool TabListener::UpdateSessionStore(uint32_t aFlushId, bool aIsFinal) {
if (!treeOwner) { if (!treeOwner) {
return false; return false;
} }
nsCOMPtr<nsIAppWindow> window(do_GetInterface(treeOwner)); nsCOMPtr<nsIXULWindow> window(do_GetInterface(treeOwner));
if (!window) { if (!window) {
return false; return false;
} }

Просмотреть файл

@ -21,7 +21,7 @@
#include "nsIWindowMediator.h" #include "nsIWindowMediator.h"
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
#include "nsIXULRuntime.h" #include "nsIXULRuntime.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsNativeCharsetUtils.h" #include "nsNativeCharsetUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
@ -318,7 +318,7 @@ nsAppStartup::Quit(uint32_t aMode) {
bool usefulHiddenWindow; bool usefulHiddenWindow;
appShell->GetApplicationProvidedHiddenWindow(&usefulHiddenWindow); appShell->GetApplicationProvidedHiddenWindow(&usefulHiddenWindow);
nsCOMPtr<nsIAppWindow> hiddenWindow; nsCOMPtr<nsIXULWindow> hiddenWindow;
appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow)); appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
// If the remaining windows are useful, we won't quit: // If the remaining windows are useful, we won't quit:
if (!hiddenWindow || usefulHiddenWindow) { if (!hiddenWindow || usefulHiddenWindow) {
@ -597,16 +597,16 @@ nsAppStartup::CreateChromeWindow(nsIWebBrowserChrome* aParent,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsCOMPtr<nsIAppWindow> newWindow; nsCOMPtr<nsIXULWindow> newWindow;
if (aParent) { if (aParent) {
nsCOMPtr<nsIAppWindow> appParent(do_GetInterface(aParent)); nsCOMPtr<nsIXULWindow> xulParent(do_GetInterface(aParent));
NS_ASSERTION(appParent, NS_ASSERTION(xulParent,
"window created using non-app parent. that's unexpected, but " "window created using non-XUL parent. that's unexpected, but "
"may work."); "may work.");
if (appParent) if (xulParent)
appParent->CreateNewWindow(aChromeFlags, aOpeningTab, aOpener, xulParent->CreateNewWindow(aChromeFlags, aOpeningTab, aOpener,
aNextRemoteTabId, getter_AddRefs(newWindow)); aNextRemoteTabId, getter_AddRefs(newWindow));
// And if it fails, don't try again without a parent. It could fail // And if it fails, don't try again without a parent. It could fail
// intentionally (bug 115969). // intentionally (bug 115969).

Просмотреть файл

@ -71,7 +71,7 @@
#include "mozilla/dom/BrowserHost.h" #include "mozilla/dom/BrowserHost.h"
#include "mozilla/dom/DocGroup.h" #include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabGroup.h" #include "mozilla/dom/TabGroup.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIXULBrowserWindow.h" #include "nsIXULBrowserWindow.h"
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "ReferrerInfo.h" #include "ReferrerInfo.h"
@ -911,17 +911,17 @@ nsresult nsWindowWatcher::OpenWindowInternal(
} }
if (newChrome) { if (newChrome) {
nsCOMPtr<nsIAppWindow> appWin = do_GetInterface(newChrome); nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(newChrome);
if (appWin) { if (xulWin) {
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWin; nsCOMPtr<nsIXULBrowserWindow> xulBrowserWin;
appWin->GetXULBrowserWindow(getter_AddRefs(xulBrowserWin)); xulWin->GetXULBrowserWindow(getter_AddRefs(xulBrowserWin));
if (xulBrowserWin) { if (xulBrowserWin) {
nsPIDOMWindowOuter* openerWindow = nsPIDOMWindowOuter* openerWindow =
aForceNoOpener ? nullptr : parentWindow.get(); aForceNoOpener ? nullptr : parentWindow.get();
xulBrowserWin->ForceInitialBrowserNonRemote(openerWindow); xulBrowserWin->ForceInitialBrowserNonRemote(openerWindow);
} }
} }
/* It might be a chrome AppWindow, in which case it won't have /* It might be a chrome nsXULWindow, in which case it won't have
an nsIDOMWindow (primary content shell). But in that case, it'll an nsIDOMWindow (primary content shell). But in that case, it'll
be able to hand over an nsIDocShellTreeItem directly. */ be able to hand over an nsIDocShellTreeItem directly. */
nsCOMPtr<nsPIDOMWindowOuter> newWindow(do_GetInterface(newChrome)); nsCOMPtr<nsPIDOMWindowOuter> newWindow(do_GetInterface(newChrome));
@ -2372,9 +2372,9 @@ void nsWindowWatcher::SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner,
} }
if (aIsCallerChrome) { if (aIsCallerChrome) {
nsCOMPtr<nsIAppWindow> appWin = do_GetInterface(treeOwnerAsWin); nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(treeOwnerAsWin);
if (appWin && aSizeSpec.mLockAspectRatio) { if (xulWin && aSizeSpec.mLockAspectRatio) {
appWin->LockAspectRatio(true); xulWin->LockAspectRatio(true);
} }
} }

Просмотреть файл

@ -152,7 +152,7 @@ registerCleanupFunction(() => {
function getParentChromeFlags(win) { function getParentChromeFlags(win) {
return win.docShell.treeOwner return win.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).chromeFlags; .getInterface(Ci.nsIXULWindow).chromeFlags;
} }
/** /**

Просмотреть файл

@ -20,7 +20,7 @@ function assertFlags(win) {
let loadContext = docShell.QueryInterface(Ci.nsILoadContext); let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
let chromeFlags = docShell.treeOwner let chromeFlags = docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).chromeFlags; .getInterface(Ci.nsIXULWindow).chromeFlags;
Assert.ok( Assert.ok(
loadContext.useRemoteTabs, loadContext.useRemoteTabs,
"Should be using remote tabs on the load context" "Should be using remote tabs on the load context"

Просмотреть файл

@ -20,7 +20,7 @@ Tests the alwaysOnTop window feature for the Windows OS.
let docShell = win.docShell; let docShell = win.docShell;
let chromeFlags = docShell.treeOwner let chromeFlags = docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow) .getInterface(Ci.nsIXULWindow)
.chromeFlags; .chromeFlags;
let hasFlag = !!(chromeFlags & Ci.nsIWebBrowserChrome.CHROME_ALWAYS_ON_TOP); let hasFlag = !!(chromeFlags & Ci.nsIWebBrowserChrome.CHROME_ALWAYS_ON_TOP);
is(hasFlag, expected, "Window should have CHROME_ALWAYS_ON_TOP flag."); is(hasFlag, expected, "Window should have CHROME_ALWAYS_ON_TOP flag.");

Просмотреть файл

@ -20,7 +20,7 @@ that is opened reports itself as being modal.
BrowserTestUtils.domWindowOpened().then((win) => { BrowserTestUtils.domWindowOpened().then((win) => {
let treeOwner = win.docShell.treeOwner; let treeOwner = win.docShell.treeOwner;
let chromeFlags = treeOwner.QueryInterface(Ci.nsIInterfaceRequestor) let chromeFlags = treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow) .getInterface(Ci.nsIXULWindow)
.chromeFlags; .chromeFlags;
ok(chromeFlags & Ci.nsIWebBrowserChrome.CHROME_MODAL, ok(chromeFlags & Ci.nsIWebBrowserChrome.CHROME_MODAL,
"Should have the modal chrome flag"); "Should have the modal chrome flag");

Просмотреть файл

@ -56,7 +56,7 @@ const XULStore = {
const value = node.getAttribute(attr); const value = node.getAttribute(attr);
if (node.localName == "window") { if (node.localName == "window") {
log("Persisting attributes to windows is handled by AppWindow."); log("Persisting attributes to windows is handled by nsXULWindow.");
return; return;
} }

Просмотреть файл

@ -142,7 +142,7 @@ XULStore.prototype = {
const value = node.getAttribute(attr); const value = node.getAttribute(attr);
if (node.localName == "window") { if (node.localName == "window") {
this.log("Persisting attributes to windows is handled by AppWindow."); this.log("Persisting attributes to windows is handled by nsXULWindow.");
return; return;
} }

Просмотреть файл

@ -66,7 +66,7 @@
window.docShell window.docShell
.treeOwner .treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow) .getInterface(Ci.nsIXULWindow)
.XULBrowserWindow = gXULBrowserWindow; .XULBrowserWindow = gXULBrowserWindow;
gFindBar = document.getElementById("FindToolbar"); gFindBar = document.getElementById("FindToolbar");

Просмотреть файл

@ -784,7 +784,7 @@
try { try {
this._xulBrowserWindow = window.docShell.treeOwner this._xulBrowserWindow = window.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIAppWindow).XULBrowserWindow; .getInterface(Ci.nsIXULWindow).XULBrowserWindow;
} catch (ex) {} } catch (ex) {}
if (!this._xulBrowserWindow) { if (!this._xulBrowserWindow) {
return false; return false;

Просмотреть файл

@ -44,6 +44,8 @@
* "soft" shutdown, passwords are flushed. * "soft" shutdown, passwords are flushed.
*/ */
interface nsIXULWindow;
[scriptable, uuid(5fdf8480-1f98-11d4-8077-00600811a9c3)] [scriptable, uuid(5fdf8480-1f98-11d4-8077-00600811a9c3)]
interface nsINativeAppSupport : nsISupports { interface nsINativeAppSupport : nsISupports {
// Startup/shutdown. // Startup/shutdown.

Просмотреть файл

@ -50,7 +50,7 @@ using mozilla::dom::ContentParent;
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsIWidgetListener.h" #include "nsIWidgetListener.h"
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsAppShell.h" #include "nsAppShell.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
@ -1285,11 +1285,11 @@ void nsWindow::GeckoViewSupport::Open(
aInitData); aInitData);
if (window->mWidgetListener) { if (window->mWidgetListener) {
nsCOMPtr<nsIAppWindow> appWindow(window->mWidgetListener->GetAppWindow()); nsCOMPtr<nsIXULWindow> xulWindow(window->mWidgetListener->GetXULWindow());
if (appWindow) { if (xulWindow) {
// Our window is not intrinsically sized, so tell AppWindow to // Our window is not intrinsically sized, so tell nsXULWindow to
// not set a size for us. // not set a size for us.
appWindow->SetIntrinsicallySized(false); xulWindow->SetIntrinsicallySized(false);
} }
} }
} }

Просмотреть файл

@ -22,7 +22,7 @@
#include "nsIAppShellService.h" #include "nsIAppShellService.h"
#include "nsIOSPermissionRequest.h" #include "nsIOSPermissionRequest.h"
#include "nsIRunnable.h" #include "nsIRunnable.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIBaseWindow.h" #include "nsIBaseWindow.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsMenuUtilsX.h" #include "nsMenuUtilsX.h"
@ -274,7 +274,7 @@ nsIWidget* nsCocoaUtils::GetHiddenWindowWidget() {
return nullptr; return nullptr;
} }
nsCOMPtr<nsIAppWindow> hiddenWindow; nsCOMPtr<nsIXULWindow> hiddenWindow;
appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow)); appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
if (!hiddenWindow) { if (!hiddenWindow) {
// Don't warn, this happens during shutdown, bug 358607. // Don't warn, this happens during shutdown, bug 358607.
@ -284,7 +284,7 @@ nsIWidget* nsCocoaUtils::GetHiddenWindowWidget() {
nsCOMPtr<nsIBaseWindow> baseHiddenWindow; nsCOMPtr<nsIBaseWindow> baseHiddenWindow;
baseHiddenWindow = do_GetInterface(hiddenWindow); baseHiddenWindow = do_GetInterface(hiddenWindow);
if (!baseHiddenWindow) { if (!baseHiddenWindow) {
NS_WARNING("Couldn't get nsIBaseWindow from hidden window (nsIAppWindow)"); NS_WARNING("Couldn't get nsIBaseWindow from hidden window (nsIXULWindow)");
return nullptr; return nullptr;
} }

Просмотреть файл

@ -19,7 +19,7 @@
#include "nsIAppShellService.h" #include "nsIAppShellService.h"
#include "nsIBaseWindow.h" #include "nsIBaseWindow.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsToolkit.h" #include "nsToolkit.h"
#include "nsTouchBarNativeAPIDefines.h" #include "nsTouchBarNativeAPIDefines.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
@ -665,7 +665,7 @@ void nsCocoaWindow::SetModal(bool aState) {
// appears over behave as they should. We can't rely on native methods to // appears over behave as they should. We can't rely on native methods to
// do this, for the following reason: The OS runs modal non-sheet windows // do this, for the following reason: The OS runs modal non-sheet windows
// in an event loop (using [NSApplication runModalForWindow:] or similar // in an event loop (using [NSApplication runModalForWindow:] or similar
// methods) that's incompatible with the modal event loop in AppWindow:: // methods) that's incompatible with the modal event loop in nsXULWindow::
// ShowModal() (each of these event loops is "exclusive", and can't run at // ShowModal() (each of these event loops is "exclusive", and can't run at
// the same time as other (similar) event loops). // the same time as other (similar) event loops).
if (mWindowType != eWindowType_sheet) { if (mWindowType != eWindowType_sheet) {
@ -1653,7 +1653,7 @@ void nsCocoaWindow::BackingScaleFactorChanged() {
mBackingScaleFactor = newScale; mBackingScaleFactor = newScale;
if (!mWidgetListener || mWidgetListener->GetAppWindow()) { if (!mWidgetListener || mWidgetListener->GetXULWindow()) {
return; return;
} }

Просмотреть файл

@ -34,7 +34,7 @@
#include "ClientLayerManager.h" #include "ClientLayerManager.h"
#include "mozilla/layers/Compositor.h" #include "mozilla/layers/Compositor.h"
#include "nsIXULRuntime.h" #include "nsIXULRuntime.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIBaseWindow.h" #include "nsIBaseWindow.h"
#include "nsXULPopupManager.h" #include "nsXULPopupManager.h"
#include "nsIWidgetListener.h" #include "nsIWidgetListener.h"
@ -1642,10 +1642,10 @@ nsIRollupListener* nsBaseWidget::GetActiveRollupListener() {
void nsBaseWidget::NotifyWindowDestroyed() { void nsBaseWidget::NotifyWindowDestroyed() {
if (!mWidgetListener) return; if (!mWidgetListener) return;
nsCOMPtr<nsIAppWindow> window = mWidgetListener->GetAppWindow(); nsCOMPtr<nsIXULWindow> window = mWidgetListener->GetXULWindow();
nsCOMPtr<nsIBaseWindow> appWindow(do_QueryInterface(window)); nsCOMPtr<nsIBaseWindow> xulWindow(do_QueryInterface(window));
if (appWindow) { if (xulWindow) {
appWindow->Destroy(); xulWindow->Destroy();
} }
} }
@ -2028,11 +2028,11 @@ void nsBaseWidget::NotifyLiveResizeStarted() {
if (!mWidgetListener) { if (!mWidgetListener) {
return; return;
} }
nsCOMPtr<nsIAppWindow> appWindow = mWidgetListener->GetAppWindow(); nsCOMPtr<nsIXULWindow> xulWindow = mWidgetListener->GetXULWindow();
if (!appWindow) { if (!xulWindow) {
return; return;
} }
mLiveResizeListeners = appWindow->GetLiveResizeListeners(); mLiveResizeListeners = xulWindow->GetLiveResizeListeners();
for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) { for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) {
mLiveResizeListeners[i]->LiveResizeStarted(); mLiveResizeListeners[i]->LiveResizeStarted();
} }

Просмотреть файл

@ -8,14 +8,14 @@
#include "nsRegion.h" #include "nsRegion.h"
#include "nsView.h" #include "nsView.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "mozilla/BasicEvents.h" #include "mozilla/BasicEvents.h"
#include "mozilla/PresShell.h" #include "mozilla/PresShell.h"
using namespace mozilla; using namespace mozilla;
nsIAppWindow* nsIWidgetListener::GetAppWindow() { return nullptr; } nsIXULWindow* nsIWidgetListener::GetXULWindow() { return nullptr; }
nsView* nsIWidgetListener::GetView() { return nullptr; } nsView* nsIWidgetListener::GetView() { return nullptr; }

Просмотреть файл

@ -16,7 +16,7 @@
class nsView; class nsView;
class nsIWidget; class nsIWidget;
class nsIAppWindow; class nsIXULWindow;
namespace mozilla { namespace mozilla {
class PresShell; class PresShell;
@ -45,11 +45,11 @@ enum nsWindowZ {
class nsIWidgetListener { class nsIWidgetListener {
public: public:
/** /**
* If this listener is for an nsIAppWindow, return it. If this is null, then * If this listener is for an nsIXULWindow, return it. If this is null, then
* this is likely a listener for a view, which can be determined using * this is likely a listener for a view, which can be determined using
* GetView. If both methods return null, this will be an nsWebBrowser. * GetView. If both methods return null, this will be an nsWebBrowser.
*/ */
virtual nsIAppWindow* GetAppWindow(); virtual nsIXULWindow* GetXULWindow();
/** /**
* If this listener is for an nsView, return it. * If this listener is for an nsView, return it.

Просмотреть файл

@ -16,7 +16,7 @@
#include "nsIRunnable.h" #include "nsIRunnable.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIWebBrowserChrome.h" #include "nsIWebBrowserChrome.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsAppShellCID.h" #include "nsAppShellCID.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
@ -361,14 +361,14 @@ bool Test4Internal(nsIAppShell* aAppShell) {
uint32_t flags = nsIWebBrowserChrome::CHROME_DEFAULT; uint32_t flags = nsIWebBrowserChrome::CHROME_DEFAULT;
nsCOMPtr<nsIAppWindow> appWindow; nsCOMPtr<nsIXULWindow> xulWindow;
if (NS_FAILED(appService->CreateTopLevelWindow( if (NS_FAILED(appService->CreateTopLevelWindow(
nullptr, uri, flags, 100, 100, nullptr, getter_AddRefs(appWindow)))) { nullptr, uri, flags, 100, 100, nullptr, getter_AddRefs(xulWindow)))) {
fail("Failed to create new window"); fail("Failed to create new window");
return false; return false;
} }
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(appWindow); nsCOMPtr<nsIDOMWindow> window = do_GetInterface(xulWindow);
if (!window) { if (!window) {
fail("Can't get dom window!"); fail("Can't get dom window!");
return false; return false;

Просмотреть файл

@ -20,7 +20,7 @@
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsISupportsImpl.h" #include "nsISupportsImpl.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsWindowDefs.h" #include "nsWindowDefs.h"
@ -42,7 +42,7 @@ class HWNDGetter : public mozilla::Runnable {
// Jump through some hoops to locate the hidden window. // Jump through some hoops to locate the hidden window.
nsCOMPtr<nsIAppShellService> appShell( nsCOMPtr<nsIAppShellService> appShell(
do_GetService(NS_APPSHELLSERVICE_CONTRACTID)); do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
nsCOMPtr<nsIAppWindow> hiddenWindow; nsCOMPtr<nsIXULWindow> hiddenWindow;
nsresult rv = appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow)); nsresult rv = appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {

Просмотреть файл

@ -16,6 +16,7 @@
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIAppShellService.h" #include "nsIAppShellService.h"
#include "nsAppShellCID.h" #include "nsAppShellCID.h"
#include "nsIXULWindow.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/WidgetUtils.h" #include "mozilla/WidgetUtils.h"
#include "mozilla/WindowsVersion.h" #include "mozilla/WindowsVersion.h"

Просмотреть файл

@ -11,11 +11,11 @@ MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
XPIDL_SOURCES += [ XPIDL_SOURCES += [
'nsIAppShellService.idl', 'nsIAppShellService.idl',
'nsIAppWindow.idl',
'nsIWindowlessBrowser.idl', 'nsIWindowlessBrowser.idl',
'nsIWindowMediator.idl', 'nsIWindowMediator.idl',
'nsIWindowMediatorListener.idl', 'nsIWindowMediatorListener.idl',
'nsIXULBrowserWindow.idl', 'nsIXULBrowserWindow.idl',
'nsIXULWindow.idl',
] ]
XPIDL_MODULE = 'appshell' XPIDL_MODULE = 'appshell'
@ -26,12 +26,13 @@ EXPORTS += [
] ]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'AppWindow.cpp',
'nsAppShellService.cpp', 'nsAppShellService.cpp',
'nsAppShellWindowEnumerator.cpp', 'nsAppShellWindowEnumerator.cpp',
'nsChromeTreeOwner.cpp', 'nsChromeTreeOwner.cpp',
'nsContentTreeOwner.cpp', 'nsContentTreeOwner.cpp',
'nsWebShellWindow.cpp',
'nsWindowMediator.cpp', 'nsWindowMediator.cpp',
'nsXULWindow.cpp',
] ]
XPCOM_MANIFESTS += [ XPCOM_MANIFESTS += [

Просмотреть файл

@ -17,7 +17,7 @@
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h" #include "nsPIWindowWatcher.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "AppWindow.h" #include "nsWebShellWindow.h"
#include "nsWidgetInitData.h" #include "nsWidgetInitData.h"
#include "nsWidgetsCID.h" #include "nsWidgetsCID.h"
@ -133,7 +133,7 @@ nsAppShellService::CreateHiddenWindow() {
rv = NS_NewURI(getter_AddRefs(url), hiddenWindowURL); rv = NS_NewURI(getter_AddRefs(url), hiddenWindowURL);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
RefPtr<AppWindow> newWindow; RefPtr<nsWebShellWindow> newWindow;
rv = rv =
JustCreateTopWindow(nullptr, url, chromeMask, initialWidth, initialHeight, JustCreateTopWindow(nullptr, url, chromeMask, initialWidth, initialHeight,
true, nullptr, nullptr, getter_AddRefs(newWindow)); true, nullptr, nullptr, getter_AddRefs(newWindow));
@ -166,16 +166,16 @@ nsAppShellService::DestroyHiddenWindow() {
*/ */
NS_IMETHODIMP NS_IMETHODIMP
nsAppShellService::CreateTopLevelWindow( nsAppShellService::CreateTopLevelWindow(
nsIAppWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask, nsIXULWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
int32_t aInitialWidth, int32_t aInitialHeight, nsIRemoteTab* aOpeningTab, int32_t aInitialWidth, int32_t aInitialHeight, nsIRemoteTab* aOpeningTab,
mozIDOMWindowProxy* aOpenerWindow, nsIAppWindow** aResult) mozIDOMWindowProxy* aOpenerWindow, nsIXULWindow** aResult)
{ {
nsresult rv; nsresult rv;
StartupTimeline::RecordOnce(StartupTimeline::CREATE_TOP_LEVEL_WINDOW); StartupTimeline::RecordOnce(StartupTimeline::CREATE_TOP_LEVEL_WINDOW);
RefPtr<AppWindow> newWindow; RefPtr<nsWebShellWindow> newWindow;
rv = JustCreateTopWindow(aParent, aUrl, aChromeMask, aInitialWidth, rv = JustCreateTopWindow(aParent, aUrl, aChromeMask, aInitialWidth,
aInitialHeight, false, aOpeningTab, aOpenerWindow, aInitialHeight, false, aOpeningTab, aOpenerWindow,
getter_AddRefs(newWindow)); getter_AddRefs(newWindow));
@ -184,7 +184,7 @@ nsAppShellService::CreateTopLevelWindow(
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
// the addref resulting from this is the owning addref for this window // the addref resulting from this is the owning addref for this window
RegisterTopLevelWindow(*aResult); RegisterTopLevelWindow(*aResult);
nsCOMPtr<nsIAppWindow> parent; nsCOMPtr<nsIXULWindow> parent;
if (aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT) parent = aParent; if (aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT) parent = aParent;
(*aResult)->SetZLevel(CalculateWindowZLevel(parent, aChromeMask)); (*aResult)->SetZLevel(CalculateWindowZLevel(parent, aChromeMask));
} }
@ -485,15 +485,15 @@ nsAppShellService::CreateWindowlessBrowser(bool aIsChrome,
return NS_OK; return NS_OK;
} }
uint32_t nsAppShellService::CalculateWindowZLevel(nsIAppWindow* aParent, uint32_t nsAppShellService::CalculateWindowZLevel(nsIXULWindow* aParent,
uint32_t aChromeMask) { uint32_t aChromeMask) {
uint32_t zLevel; uint32_t zLevel;
zLevel = nsIAppWindow::normalZ; zLevel = nsIXULWindow::normalZ;
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RAISED) if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RAISED)
zLevel = nsIAppWindow::raisedZ; zLevel = nsIXULWindow::raisedZ;
else if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_LOWERED) else if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_LOWERED)
zLevel = nsIAppWindow::loweredZ; zLevel = nsIXULWindow::loweredZ;
#ifdef XP_MACOSX #ifdef XP_MACOSX
/* Platforms on which modal windows are always application-modal, not /* Platforms on which modal windows are always application-modal, not
@ -528,7 +528,7 @@ static bool CheckForFullscreenWindow() {
if (!wm) return false; if (!wm) return false;
nsCOMPtr<nsISimpleEnumerator> windowList; nsCOMPtr<nsISimpleEnumerator> windowList;
wm->GetAppWindowEnumerator(nullptr, getter_AddRefs(windowList)); wm->GetXULWindowEnumerator(nullptr, getter_AddRefs(windowList));
if (!windowList) return false; if (!windowList) return false;
for (;;) { for (;;) {
@ -555,17 +555,17 @@ static bool CheckForFullscreenWindow() {
* Just do the window-making part of CreateTopLevelWindow * Just do the window-making part of CreateTopLevelWindow
*/ */
nsresult nsAppShellService::JustCreateTopWindow( nsresult nsAppShellService::JustCreateTopWindow(
nsIAppWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask, nsIXULWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
int32_t aInitialWidth, int32_t aInitialHeight, bool aIsHiddenWindow, int32_t aInitialWidth, int32_t aInitialHeight, bool aIsHiddenWindow,
nsIRemoteTab* aOpeningTab, mozIDOMWindowProxy* aOpenerWindow, nsIRemoteTab* aOpeningTab, mozIDOMWindowProxy* aOpenerWindow,
AppWindow** aResult) { nsWebShellWindow** aResult) {
*aResult = nullptr; *aResult = nullptr;
NS_ENSURE_STATE(!mXPCOMWillShutDown); NS_ENSURE_STATE(!mXPCOMWillShutDown);
nsCOMPtr<nsIAppWindow> parent; nsCOMPtr<nsIXULWindow> parent;
if (aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT) parent = aParent; if (aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT) parent = aParent;
RefPtr<AppWindow> window = new AppWindow(aChromeMask); RefPtr<nsWebShellWindow> window = new nsWebShellWindow(aChromeMask);
#ifdef XP_WIN #ifdef XP_WIN
// If the parent is currently fullscreen, tell the child to ignore persisted // If the parent is currently fullscreen, tell the child to ignore persisted
@ -737,7 +737,7 @@ nsresult nsAppShellService::JustCreateTopWindow(
} }
NS_IMETHODIMP NS_IMETHODIMP
nsAppShellService::GetHiddenWindow(nsIAppWindow** aWindow) { nsAppShellService::GetHiddenWindow(nsIXULWindow** aWindow) {
NS_ENSURE_ARG_POINTER(aWindow); NS_ENSURE_ARG_POINTER(aWindow);
EnsureHiddenWindow(); EnsureHiddenWindow();
@ -784,7 +784,7 @@ nsAppShellService::GetApplicationProvidedHiddenWindow(bool* aAPHW) {
* Register a new top level window (created elsewhere) * Register a new top level window (created elsewhere)
*/ */
NS_IMETHODIMP NS_IMETHODIMP
nsAppShellService::RegisterTopLevelWindow(nsIAppWindow* aWindow) { nsAppShellService::RegisterTopLevelWindow(nsIXULWindow* aWindow) {
NS_ENSURE_ARG_POINTER(aWindow); NS_ENSURE_ARG_POINTER(aWindow);
nsCOMPtr<nsIDocShell> docShell; nsCOMPtr<nsIDocShell> docShell;
@ -816,15 +816,15 @@ nsAppShellService::RegisterTopLevelWindow(nsIAppWindow* aWindow) {
if (obssvc) { if (obssvc) {
obssvc->NotifyObservers(aWindow, "xul-window-registered", nullptr); obssvc->NotifyObservers(aWindow, "xul-window-registered", nullptr);
AppWindow* appWindow = static_cast<AppWindow*>(aWindow); nsXULWindow* xulWindow = static_cast<nsXULWindow*>(aWindow);
appWindow->WasRegistered(); xulWindow->WasRegistered();
} }
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsAppShellService::UnregisterTopLevelWindow(nsIAppWindow* aWindow) { nsAppShellService::UnregisterTopLevelWindow(nsIXULWindow* aWindow) {
if (mXPCOMShuttingDown) { if (mXPCOMShuttingDown) {
/* return an error code in order to: /* return an error code in order to:
- avoid doing anything with other member variables while we are in - avoid doing anything with other member variables while we are in

Просмотреть файл

@ -10,7 +10,7 @@
#include "nsIObserver.h" #include "nsIObserver.h"
// Interfaces Needed // Interfaces Needed
#include "AppWindow.h" #include "nsWebShellWindow.h"
#include "nsStringFwd.h" #include "nsStringFwd.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsIRemoteTab.h" #include "nsIRemoteTab.h"
@ -37,15 +37,15 @@ class nsAppShellService final : public nsIAppShellService, public nsIObserver {
void EnsureHiddenWindow(); void EnsureHiddenWindow();
nsresult JustCreateTopWindow(nsIAppWindow* aParent, nsIURI* aUrl, nsresult JustCreateTopWindow(nsIXULWindow* aParent, nsIURI* aUrl,
uint32_t aChromeMask, int32_t aInitialWidth, uint32_t aChromeMask, int32_t aInitialWidth,
int32_t aInitialHeight, bool aIsHiddenWindow, int32_t aInitialHeight, bool aIsHiddenWindow,
nsIRemoteTab* aOpeningTab, nsIRemoteTab* aOpeningTab,
mozIDOMWindowProxy* aOpenerWindow, mozIDOMWindowProxy* aOpenerWindow,
mozilla::AppWindow** aResult); nsWebShellWindow** aResult);
uint32_t CalculateWindowZLevel(nsIAppWindow* aParent, uint32_t aChromeMask); uint32_t CalculateWindowZLevel(nsIXULWindow* aParent, uint32_t aChromeMask);
RefPtr<mozilla::AppWindow> mHiddenWindow; RefPtr<nsWebShellWindow> mHiddenWindow;
bool mXPCOMWillShutDown; bool mXPCOMWillShutDown;
bool mXPCOMShuttingDown; bool mXPCOMShuttingDown;
uint16_t mModalWindowCount; uint16_t mModalWindowCount;

Просмотреть файл

@ -11,7 +11,7 @@
#include "nsIFactory.h" #include "nsIFactory.h"
#include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsWindowMediator.h" #include "nsWindowMediator.h"
@ -23,9 +23,9 @@ using mozilla::dom::Element;
// static helper functions // static helper functions
// //
static void GetAttribute(nsIAppWindow* inWindow, const nsAString& inAttribute, static void GetAttribute(nsIXULWindow* inWindow, const nsAString& inAttribute,
nsAString& outValue); nsAString& outValue);
static void GetWindowType(nsIAppWindow* inWindow, nsString& outType); static void GetWindowType(nsIXULWindow* inWindow, nsString& outType);
static Element* GetElementFromDocShell(nsIDocShell* aShell) { static Element* GetElementFromDocShell(nsIDocShell* aShell) {
nsCOMPtr<nsIContentViewer> cv; nsCOMPtr<nsIContentViewer> cv;
@ -41,7 +41,7 @@ static Element* GetElementFromDocShell(nsIDocShell* aShell) {
} }
// generic "retrieve the value of a XUL attribute" function // generic "retrieve the value of a XUL attribute" function
void GetAttribute(nsIAppWindow* inWindow, const nsAString& inAttribute, void GetAttribute(nsIXULWindow* inWindow, const nsAString& inAttribute,
nsAString& outValue) { nsAString& outValue) {
nsCOMPtr<nsIDocShell> shell; nsCOMPtr<nsIDocShell> shell;
if (inWindow && NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell)))) { if (inWindow && NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell)))) {
@ -54,7 +54,7 @@ void GetAttribute(nsIAppWindow* inWindow, const nsAString& inAttribute,
// retrieve the window type, stored as the value of a particular // retrieve the window type, stored as the value of a particular
// attribute in its XUL window tag // attribute in its XUL window tag
void GetWindowType(nsIAppWindow* aWindow, nsString& outType) { void GetWindowType(nsIXULWindow* aWindow, nsString& outType) {
GetAttribute(aWindow, NS_LITERAL_STRING("windowtype"), outType); GetAttribute(aWindow, NS_LITERAL_STRING("windowtype"), outType);
} }
@ -62,10 +62,10 @@ void GetWindowType(nsIAppWindow* aWindow, nsString& outType) {
// nsWindowInfo // nsWindowInfo
// //
nsWindowInfo::nsWindowInfo(nsIAppWindow* inWindow, int32_t inTimeStamp) nsWindowInfo::nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp)
: mWindow(inWindow), : mWindow(inWindow),
mTimeStamp(inTimeStamp), mTimeStamp(inTimeStamp),
mZLevel(nsIAppWindow::normalZ) { mZLevel(nsIXULWindow::normalZ) {
ReferenceSelf(true, true); ReferenceSelf(true, true);
} }
@ -187,16 +187,16 @@ NS_IMETHODIMP nsASDOMWindowEnumerator::GetNext(nsISupports** retval) {
} }
// //
// nsASAppWindowEnumerator // nsASXULWindowEnumerator
// //
nsASAppWindowEnumerator::nsASAppWindowEnumerator(const char16_t* aTypeString, nsASXULWindowEnumerator::nsASXULWindowEnumerator(const char16_t* aTypeString,
nsWindowMediator& aMediator) nsWindowMediator& aMediator)
: nsAppShellWindowEnumerator(aTypeString, aMediator) {} : nsAppShellWindowEnumerator(aTypeString, aMediator) {}
nsASAppWindowEnumerator::~nsASAppWindowEnumerator() {} nsASXULWindowEnumerator::~nsASXULWindowEnumerator() {}
NS_IMETHODIMP nsASAppWindowEnumerator::GetNext(nsISupports** retval) { NS_IMETHODIMP nsASXULWindowEnumerator::GetNext(nsISupports** retval) {
if (!retval) return NS_ERROR_INVALID_ARG; if (!retval) return NS_ERROR_INVALID_ARG;
*retval = nullptr; *retval = nullptr;
@ -225,7 +225,7 @@ nsWindowInfo* nsASDOMWindowEarlyToLateEnumerator::FindNext() {
nsWindowInfo *info, *listEnd; nsWindowInfo *info, *listEnd;
bool allWindows = mType.IsEmpty(); bool allWindows = mType.IsEmpty();
// see AppWindowEarlyToLateEnumerator::FindNext // see nsXULWindowEarlyToLateEnumerator::FindNext
if (!mCurrentPosition) return nullptr; if (!mCurrentPosition) return nullptr;
info = mCurrentPosition->mYounger; info = mCurrentPosition->mYounger;
@ -240,19 +240,19 @@ nsWindowInfo* nsASDOMWindowEarlyToLateEnumerator::FindNext() {
} }
// //
// nsASAppWindowEarlyToLateEnumerator // nsASXULWindowEarlyToLateEnumerator
// //
nsASAppWindowEarlyToLateEnumerator::nsASAppWindowEarlyToLateEnumerator( nsASXULWindowEarlyToLateEnumerator::nsASXULWindowEarlyToLateEnumerator(
const char16_t* aTypeString, nsWindowMediator& aMediator) const char16_t* aTypeString, nsWindowMediator& aMediator)
: nsASAppWindowEnumerator(aTypeString, aMediator) { : nsASXULWindowEnumerator(aTypeString, aMediator) {
mCurrentPosition = aMediator.mOldestWindow; mCurrentPosition = aMediator.mOldestWindow;
AdjustInitialPosition(); AdjustInitialPosition();
} }
nsASAppWindowEarlyToLateEnumerator::~nsASAppWindowEarlyToLateEnumerator() {} nsASXULWindowEarlyToLateEnumerator::~nsASXULWindowEarlyToLateEnumerator() {}
nsWindowInfo* nsASAppWindowEarlyToLateEnumerator::FindNext() { nsWindowInfo* nsASXULWindowEarlyToLateEnumerator::FindNext() {
nsWindowInfo *info, *listEnd; nsWindowInfo *info, *listEnd;
bool allWindows = mType.IsEmpty(); bool allWindows = mType.IsEmpty();
@ -277,23 +277,23 @@ nsWindowInfo* nsASAppWindowEarlyToLateEnumerator::FindNext() {
} }
// //
// nsASAppWindowFrontToBackEnumerator // nsASXULWindowFrontToBackEnumerator
// //
nsASAppWindowFrontToBackEnumerator::nsASAppWindowFrontToBackEnumerator( nsASXULWindowFrontToBackEnumerator::nsASXULWindowFrontToBackEnumerator(
const char16_t* aTypeString, nsWindowMediator& aMediator) const char16_t* aTypeString, nsWindowMediator& aMediator)
: nsASAppWindowEnumerator(aTypeString, aMediator) { : nsASXULWindowEnumerator(aTypeString, aMediator) {
mCurrentPosition = aMediator.mTopmostWindow; mCurrentPosition = aMediator.mTopmostWindow;
AdjustInitialPosition(); AdjustInitialPosition();
} }
nsASAppWindowFrontToBackEnumerator::~nsASAppWindowFrontToBackEnumerator() {} nsASXULWindowFrontToBackEnumerator::~nsASXULWindowFrontToBackEnumerator() {}
nsWindowInfo* nsASAppWindowFrontToBackEnumerator::FindNext() { nsWindowInfo* nsASXULWindowFrontToBackEnumerator::FindNext() {
nsWindowInfo *info, *listEnd; nsWindowInfo *info, *listEnd;
bool allWindows = mType.IsEmpty(); bool allWindows = mType.IsEmpty();
// see AppWindowEarlyToLateEnumerator::FindNext // see nsXULWindowEarlyToLateEnumerator::FindNext
if (!mCurrentPosition) return nullptr; if (!mCurrentPosition) return nullptr;
info = mCurrentPosition->mLower; info = mCurrentPosition->mLower;
@ -308,24 +308,24 @@ nsWindowInfo* nsASAppWindowFrontToBackEnumerator::FindNext() {
} }
// //
// nsASAppWindowBackToFrontEnumerator // nsASXULWindowBackToFrontEnumerator
// //
nsASAppWindowBackToFrontEnumerator::nsASAppWindowBackToFrontEnumerator( nsASXULWindowBackToFrontEnumerator::nsASXULWindowBackToFrontEnumerator(
const char16_t* aTypeString, nsWindowMediator& aMediator) const char16_t* aTypeString, nsWindowMediator& aMediator)
: nsASAppWindowEnumerator(aTypeString, aMediator) { : nsASXULWindowEnumerator(aTypeString, aMediator) {
mCurrentPosition = mCurrentPosition =
aMediator.mTopmostWindow ? aMediator.mTopmostWindow->mHigher : nullptr; aMediator.mTopmostWindow ? aMediator.mTopmostWindow->mHigher : nullptr;
AdjustInitialPosition(); AdjustInitialPosition();
} }
nsASAppWindowBackToFrontEnumerator::~nsASAppWindowBackToFrontEnumerator() {} nsASXULWindowBackToFrontEnumerator::~nsASXULWindowBackToFrontEnumerator() {}
nsWindowInfo* nsASAppWindowBackToFrontEnumerator::FindNext() { nsWindowInfo* nsASXULWindowBackToFrontEnumerator::FindNext() {
nsWindowInfo *info, *listEnd; nsWindowInfo *info, *listEnd;
bool allWindows = mType.IsEmpty(); bool allWindows = mType.IsEmpty();
// see AppWindowEarlyToLateEnumerator::FindNext // see nsXULWindowEarlyToLateEnumerator::FindNext
if (!mCurrentPosition) return nullptr; if (!mCurrentPosition) return nullptr;
info = mCurrentPosition->mHigher; info = mCurrentPosition->mHigher;

Просмотреть файл

@ -10,7 +10,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsSimpleEnumerator.h" #include "nsSimpleEnumerator.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
class nsWindowMediator; class nsWindowMediator;
@ -19,10 +19,10 @@ class nsWindowMediator;
// //
struct nsWindowInfo { struct nsWindowInfo {
nsWindowInfo(nsIAppWindow* inWindow, int32_t inTimeStamp); nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp);
~nsWindowInfo(); ~nsWindowInfo();
nsCOMPtr<nsIAppWindow> mWindow; nsCOMPtr<nsIXULWindow> mWindow;
int32_t mTimeStamp; int32_t mTimeStamp;
uint32_t mZLevel; uint32_t mZLevel;
@ -72,14 +72,14 @@ class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator {
NS_IMETHOD GetNext(nsISupports** retval) override; NS_IMETHOD GetNext(nsISupports** retval) override;
}; };
class nsASAppWindowEnumerator : public nsAppShellWindowEnumerator { class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator {
public: public:
nsASAppWindowEnumerator(const char16_t* aTypeString, nsASXULWindowEnumerator(const char16_t* aTypeString,
nsWindowMediator& inMediator); nsWindowMediator& inMediator);
virtual ~nsASAppWindowEnumerator(); virtual ~nsASXULWindowEnumerator();
NS_IMETHOD GetNext(nsISupports** retval) override; NS_IMETHOD GetNext(nsISupports** retval) override;
const nsID& DefaultInterface() override { return NS_GET_IID(nsIAppWindow); } const nsID& DefaultInterface() override { return NS_GET_IID(nsIXULWindow); }
}; };
// //
@ -97,34 +97,34 @@ class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator {
virtual nsWindowInfo* FindNext() override; virtual nsWindowInfo* FindNext() override;
}; };
class nsASAppWindowEarlyToLateEnumerator : public nsASAppWindowEnumerator { class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator {
public: public:
nsASAppWindowEarlyToLateEnumerator(const char16_t* aTypeString, nsASXULWindowEarlyToLateEnumerator(const char16_t* aTypeString,
nsWindowMediator& inMediator); nsWindowMediator& inMediator);
virtual ~nsASAppWindowEarlyToLateEnumerator(); virtual ~nsASXULWindowEarlyToLateEnumerator();
protected: protected:
virtual nsWindowInfo* FindNext() override; virtual nsWindowInfo* FindNext() override;
}; };
class nsASAppWindowFrontToBackEnumerator : public nsASAppWindowEnumerator { class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator {
public: public:
nsASAppWindowFrontToBackEnumerator(const char16_t* aTypeString, nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString,
nsWindowMediator& inMediator); nsWindowMediator& inMediator);
virtual ~nsASAppWindowFrontToBackEnumerator(); virtual ~nsASXULWindowFrontToBackEnumerator();
protected: protected:
virtual nsWindowInfo* FindNext() override; virtual nsWindowInfo* FindNext() override;
}; };
class nsASAppWindowBackToFrontEnumerator : public nsASAppWindowEnumerator { class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator {
public: public:
nsASAppWindowBackToFrontEnumerator(const char16_t* aTypeString, nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString,
nsWindowMediator& inMediator); nsWindowMediator& inMediator);
virtual ~nsASAppWindowBackToFrontEnumerator(); virtual ~nsASXULWindowBackToFrontEnumerator();
protected: protected:
virtual nsWindowInfo* FindNext() override; virtual nsWindowInfo* FindNext() override;

Просмотреть файл

@ -6,7 +6,7 @@
// Local Includes // Local Includes
#include "nsChromeTreeOwner.h" #include "nsChromeTreeOwner.h"
#include "AppWindow.h" #include "nsXULWindow.h"
// Helper Classes // Helper Classes
#include "nsString.h" #include "nsString.h"
@ -43,7 +43,7 @@ const nsLiteralString kSpace(u" ");
//*** nsChromeTreeOwner: Object Management //*** nsChromeTreeOwner: Object Management
//***************************************************************************** //*****************************************************************************
nsChromeTreeOwner::nsChromeTreeOwner() : mAppWindow(nullptr) {} nsChromeTreeOwner::nsChromeTreeOwner() : mXULWindow(nullptr) {}
nsChromeTreeOwner::~nsChromeTreeOwner() {} nsChromeTreeOwner::~nsChromeTreeOwner() {}
@ -71,24 +71,24 @@ NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink) {
NS_ENSURE_ARG_POINTER(aSink); NS_ENSURE_ARG_POINTER(aSink);
if (aIID.Equals(NS_GET_IID(nsIPrompt))) { if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetInterface(aIID, aSink); return mXULWindow->GetInterface(aIID, aSink);
} }
if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) { if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetInterface(aIID, aSink); return mXULWindow->GetInterface(aIID, aSink);
} }
if (aIID.Equals(NS_GET_IID(nsIWebBrowserChrome))) { if (aIID.Equals(NS_GET_IID(nsIWebBrowserChrome))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetInterface(aIID, aSink); return mXULWindow->GetInterface(aIID, aSink);
} }
if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow))) { if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetInterface(aIID, aSink); return mXULWindow->GetInterface(aIID, aSink);
} }
if (aIID.Equals(NS_GET_IID(nsIAppWindow))) { if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->QueryInterface(aIID, aSink); return mXULWindow->QueryInterface(aIID, aSink);
} }
return QueryInterface(aIID, aSink); return QueryInterface(aIID, aSink);
@ -101,75 +101,75 @@ NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink) {
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell, nsChromeTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
bool aPrimary) { bool aPrimary) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->ContentShellAdded(aContentShell, aPrimary); return mXULWindow->ContentShellAdded(aContentShell, aPrimary);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) { nsChromeTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->ContentShellRemoved(aContentShell); return mXULWindow->ContentShellRemoved(aContentShell);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetPrimaryContentShell( NS_IMETHODIMP nsChromeTreeOwner::GetPrimaryContentShell(
nsIDocShellTreeItem** aShell) { nsIDocShellTreeItem** aShell) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPrimaryContentShell(aShell); return mXULWindow->GetPrimaryContentShell(aShell);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) { nsChromeTreeOwner::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->RemoteTabAdded(aTab, aPrimary); return mXULWindow->RemoteTabAdded(aTab, aPrimary);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::RemoteTabRemoved(nsIRemoteTab* aTab) { nsChromeTreeOwner::RemoteTabRemoved(nsIRemoteTab* aTab) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->RemoteTabRemoved(aTab); return mXULWindow->RemoteTabRemoved(aTab);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::GetPrimaryRemoteTab(nsIRemoteTab** aTab) { nsChromeTreeOwner::GetPrimaryRemoteTab(nsIRemoteTab** aTab) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPrimaryRemoteTab(aTab); return mXULWindow->GetPrimaryRemoteTab(aTab);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) { nsChromeTreeOwner::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPrimaryContentSize(aWidth, aHeight); return mXULWindow->GetPrimaryContentSize(aWidth, aHeight);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) { nsChromeTreeOwner::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPrimaryContentSize(aWidth, aHeight); return mXULWindow->SetPrimaryContentSize(aWidth, aHeight);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) { nsChromeTreeOwner::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetRootShellSize(aWidth, aHeight); return mXULWindow->GetRootShellSize(aWidth, aHeight);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::SetRootShellSize(int32_t aWidth, int32_t aHeight) { nsChromeTreeOwner::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetRootShellSize(aWidth, aHeight); return mXULWindow->SetRootShellSize(aWidth, aHeight);
} }
NS_IMETHODIMP nsChromeTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, NS_IMETHODIMP nsChromeTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
int32_t aCX, int32_t aCY) { int32_t aCX, int32_t aCY) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SizeShellTo(aShellItem, aCX, aCY); return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize, nsChromeTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize,
bool aPersistSizeMode) { bool aPersistSizeMode) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement(); nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
if (!docShellElement) return NS_ERROR_FAILURE; if (!docShellElement) return NS_ERROR_FAILURE;
nsAutoString persistString; nsAutoString persistString;
@ -204,8 +204,8 @@ nsChromeTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize,
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize, nsChromeTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize,
bool* aPersistSizeMode) { bool* aPersistSizeMode) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement(); nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
if (!docShellElement) return NS_ERROR_FAILURE; if (!docShellElement) return NS_ERROR_FAILURE;
nsAutoString persistString; nsAutoString persistString;
@ -227,8 +227,8 @@ nsChromeTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize,
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::GetTabCount(uint32_t* aResult) { nsChromeTreeOwner::GetTabCount(uint32_t* aResult) {
if (mAppWindow) { if (mXULWindow) {
return mAppWindow->GetTabCount(aResult); return mXULWindow->GetTabCount(aResult);
} }
*aResult = 0; *aResult = 0;
@ -237,8 +237,8 @@ nsChromeTreeOwner::GetTabCount(uint32_t* aResult) {
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::GetHasPrimaryContent(bool* aResult) { nsChromeTreeOwner::GetHasPrimaryContent(bool* aResult) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetHasPrimaryContent(aResult); return mXULWindow->GetHasPrimaryContent(aResult);
} }
//***************************************************************************** //*****************************************************************************
@ -261,69 +261,69 @@ NS_IMETHODIMP nsChromeTreeOwner::Create() {
} }
NS_IMETHODIMP nsChromeTreeOwner::Destroy() { NS_IMETHODIMP nsChromeTreeOwner::Destroy() {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->Destroy(); return mXULWindow->Destroy();
} }
NS_IMETHODIMP nsChromeTreeOwner::GetUnscaledDevicePixelsPerCSSPixel( NS_IMETHODIMP nsChromeTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(
double* aScale) { double* aScale) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale); return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetDevicePixelsPerDesktopPixel( NS_IMETHODIMP nsChromeTreeOwner::GetDevicePixelsPerDesktopPixel(
double* aScale) { double* aScale) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetDevicePixelsPerDesktopPixel(aScale); return mXULWindow->GetDevicePixelsPerDesktopPixel(aScale);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetPositionDesktopPix(int32_t x, int32_t y) { NS_IMETHODIMP nsChromeTreeOwner::SetPositionDesktopPix(int32_t x, int32_t y) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPositionDesktopPix(x, y); return mXULWindow->SetPositionDesktopPix(x, y);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetPosition(int32_t x, int32_t y) { NS_IMETHODIMP nsChromeTreeOwner::SetPosition(int32_t x, int32_t y) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPosition(x, y); return mXULWindow->SetPosition(x, y);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetPosition(int32_t* x, int32_t* y) { NS_IMETHODIMP nsChromeTreeOwner::GetPosition(int32_t* x, int32_t* y) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPosition(x, y); return mXULWindow->GetPosition(x, y);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetSize(int32_t cx, int32_t cy, NS_IMETHODIMP nsChromeTreeOwner::SetSize(int32_t cx, int32_t cy,
bool fRepaint) { bool fRepaint) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetSize(cx, cy, fRepaint); return mXULWindow->SetSize(cx, cy, fRepaint);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetSize(int32_t* cx, int32_t* cy) { NS_IMETHODIMP nsChromeTreeOwner::GetSize(int32_t* cx, int32_t* cy) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetSize(cx, cy); return mXULWindow->GetSize(cx, cy);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetPositionAndSize(int32_t x, int32_t y, NS_IMETHODIMP nsChromeTreeOwner::SetPositionAndSize(int32_t x, int32_t y,
int32_t cx, int32_t cy, int32_t cx, int32_t cy,
uint32_t aFlags) { uint32_t aFlags) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPositionAndSize(x, y, cx, cy, aFlags); return mXULWindow->SetPositionAndSize(x, y, cx, cy, aFlags);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(int32_t* x, int32_t* y, NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(int32_t* x, int32_t* y,
int32_t* cx, int32_t* cy) { int32_t* cx, int32_t* cy) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPositionAndSize(x, y, cx, cy); return mXULWindow->GetPositionAndSize(x, y, cx, cy);
} }
NS_IMETHODIMP nsChromeTreeOwner::Repaint(bool aForce) { NS_IMETHODIMP nsChromeTreeOwner::Repaint(bool aForce) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->Repaint(aForce); return mXULWindow->Repaint(aForce);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetParentWidget(nsIWidget** aParentWidget) { NS_IMETHODIMP nsChromeTreeOwner::GetParentWidget(nsIWidget** aParentWidget) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetParentWidget(aParentWidget); return mXULWindow->GetParentWidget(aParentWidget);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetParentWidget(nsIWidget* aParentWidget) { NS_IMETHODIMP nsChromeTreeOwner::SetParentWidget(nsIWidget* aParentWidget) {
@ -333,8 +333,8 @@ NS_IMETHODIMP nsChromeTreeOwner::SetParentWidget(nsIWidget* aParentWidget) {
NS_IMETHODIMP nsChromeTreeOwner::GetParentNativeWindow( NS_IMETHODIMP nsChromeTreeOwner::GetParentNativeWindow(
nativeWindow* aParentNativeWindow) { nativeWindow* aParentNativeWindow) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetParentNativeWindow(aParentNativeWindow); return mXULWindow->GetParentNativeWindow(aParentNativeWindow);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetParentNativeWindow( NS_IMETHODIMP nsChromeTreeOwner::SetParentNativeWindow(
@ -344,53 +344,53 @@ NS_IMETHODIMP nsChromeTreeOwner::SetParentNativeWindow(
} }
NS_IMETHODIMP nsChromeTreeOwner::GetNativeHandle(nsAString& aNativeHandle) { NS_IMETHODIMP nsChromeTreeOwner::GetNativeHandle(nsAString& aNativeHandle) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetNativeHandle(aNativeHandle); return mXULWindow->GetNativeHandle(aNativeHandle);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetVisibility(bool* aVisibility) { NS_IMETHODIMP nsChromeTreeOwner::GetVisibility(bool* aVisibility) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetVisibility(aVisibility); return mXULWindow->GetVisibility(aVisibility);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetVisibility(bool aVisibility) { NS_IMETHODIMP nsChromeTreeOwner::SetVisibility(bool aVisibility) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetVisibility(aVisibility); return mXULWindow->SetVisibility(aVisibility);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetEnabled(bool* aEnabled) { NS_IMETHODIMP nsChromeTreeOwner::GetEnabled(bool* aEnabled) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetEnabled(aEnabled); return mXULWindow->GetEnabled(aEnabled);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetEnabled(bool aEnable) { NS_IMETHODIMP nsChromeTreeOwner::SetEnabled(bool aEnable) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetEnabled(aEnable); return mXULWindow->SetEnabled(aEnable);
} }
NS_IMETHODIMP nsChromeTreeOwner::GetMainWidget(nsIWidget** aMainWidget) { NS_IMETHODIMP nsChromeTreeOwner::GetMainWidget(nsIWidget** aMainWidget) {
NS_ENSURE_ARG_POINTER(aMainWidget); NS_ENSURE_ARG_POINTER(aMainWidget);
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
*aMainWidget = mAppWindow->mWindow; *aMainWidget = mXULWindow->mWindow;
NS_IF_ADDREF(*aMainWidget); NS_IF_ADDREF(*aMainWidget);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsChromeTreeOwner::SetFocus() { NS_IMETHODIMP nsChromeTreeOwner::SetFocus() {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetFocus(); return mXULWindow->SetFocus();
} }
NS_IMETHODIMP nsChromeTreeOwner::GetTitle(nsAString& aTitle) { NS_IMETHODIMP nsChromeTreeOwner::GetTitle(nsAString& aTitle) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetTitle(aTitle); return mXULWindow->GetTitle(aTitle);
} }
NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const nsAString& aTitle) { NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const nsAString& aTitle) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetTitle(aTitle); return mXULWindow->SetTitle(aTitle);
} }
//***************************************************************************** //*****************************************************************************
@ -419,12 +419,12 @@ NS_IMETHODIMP
nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress, nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIURI* aLocation, nsIRequest* aRequest, nsIURI* aLocation,
uint32_t aFlags) { uint32_t aFlags) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
// If loading a new root .xul document, then redo chrome. // If loading a new root .xul document, then redo chrome.
if (aWebProgress) { if (aWebProgress) {
nsCOMPtr<nsIDocShell> docshell; nsCOMPtr<nsIDocShell> docshell;
mAppWindow->GetDocShell(getter_AddRefs(docshell)); mXULWindow->GetDocShell(getter_AddRefs(docshell));
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(docshell)); nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(docshell));
if (webProgress != aWebProgress) { if (webProgress != aWebProgress) {
@ -432,7 +432,7 @@ nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
} }
} }
mAppWindow->mChromeLoaded = false; mXULWindow->mChromeLoaded = false;
return NS_OK; return NS_OK;
} }
@ -464,10 +464,8 @@ nsChromeTreeOwner::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
// nsChromeTreeOwner: Accessors // nsChromeTreeOwner: Accessors
//***************************************************************************** //*****************************************************************************
void nsChromeTreeOwner::AppWindow(mozilla::AppWindow* aAppWindow) { void nsChromeTreeOwner::XULWindow(nsXULWindow* aXULWindow) {
mAppWindow = aAppWindow; mXULWindow = aXULWindow;
} }
mozilla::AppWindow* nsChromeTreeOwner::AppWindow() { nsXULWindow* nsChromeTreeOwner::XULWindow() { return mXULWindow; }
return mAppWindow;
}

Просмотреть файл

@ -18,16 +18,14 @@
#include "nsIWebProgressListener.h" #include "nsIWebProgressListener.h"
#include "nsWeakReference.h" #include "nsWeakReference.h"
namespace mozilla { class nsXULWindow;
class AppWindow;
}
class nsChromeTreeOwner : public nsIDocShellTreeOwner, class nsChromeTreeOwner : public nsIDocShellTreeOwner,
public nsIBaseWindow, public nsIBaseWindow,
public nsIInterfaceRequestor, public nsIInterfaceRequestor,
public nsIWebProgressListener, public nsIWebProgressListener,
public nsSupportsWeakReference { public nsSupportsWeakReference {
friend class mozilla::AppWindow; friend class nsXULWindow;
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -41,11 +39,11 @@ class nsChromeTreeOwner : public nsIDocShellTreeOwner,
nsChromeTreeOwner(); nsChromeTreeOwner();
virtual ~nsChromeTreeOwner(); virtual ~nsChromeTreeOwner();
void AppWindow(mozilla::AppWindow* aAppWindow); void XULWindow(nsXULWindow* aXULWindow);
mozilla::AppWindow* AppWindow(); nsXULWindow* XULWindow();
protected: protected:
mozilla::AppWindow* mAppWindow; nsXULWindow* mXULWindow;
}; };
#endif /* nsChromeTreeOwner_h__ */ #endif /* nsChromeTreeOwner_h__ */

Просмотреть файл

@ -7,7 +7,7 @@
// Local Includes // Local Includes
#include "nsContentTreeOwner.h" #include "nsContentTreeOwner.h"
#include "AppWindow.h" #include "nsXULWindow.h"
// Helper Classes // Helper Classes
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
@ -78,7 +78,7 @@ class nsSiteWindow : public nsIEmbeddingSiteWindow {
//***************************************************************************** //*****************************************************************************
nsContentTreeOwner::nsContentTreeOwner(bool fPrimary) nsContentTreeOwner::nsContentTreeOwner(bool fPrimary)
: mAppWindow(nullptr), mPrimary(fPrimary) { : mXULWindow(nullptr), mPrimary(fPrimary) {
// note if this fails, QI on nsIEmbeddingSiteWindow(2) will simply fail // note if this fails, QI on nsIEmbeddingSiteWindow(2) will simply fail
mSiteWindow = new nsSiteWindow(this); mSiteWindow = new nsSiteWindow(this);
} }
@ -122,26 +122,26 @@ NS_IMETHODIMP nsContentTreeOwner::GetInterface(const nsIID& aIID,
*aSink = 0; *aSink = 0;
if (aIID.Equals(NS_GET_IID(nsIPrompt))) { if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetInterface(aIID, aSink); return mXULWindow->GetInterface(aIID, aSink);
} }
if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) { if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetInterface(aIID, aSink); return mXULWindow->GetInterface(aIID, aSink);
} }
if (aIID.Equals(NS_GET_IID(nsIDocShellTreeItem))) { if (aIID.Equals(NS_GET_IID(nsIDocShellTreeItem))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIDocShell> shell; nsCOMPtr<nsIDocShell> shell;
mAppWindow->GetDocShell(getter_AddRefs(shell)); mXULWindow->GetDocShell(getter_AddRefs(shell));
if (shell) return shell->QueryInterface(aIID, aSink); if (shell) return shell->QueryInterface(aIID, aSink);
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
if (aIID.Equals(NS_GET_IID(nsIDOMWindow)) || if (aIID.Equals(NS_GET_IID(nsIDOMWindow)) ||
aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) { aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIDocShellTreeItem> shell; nsCOMPtr<nsIDocShellTreeItem> shell;
mAppWindow->GetPrimaryContentShell(getter_AddRefs(shell)); mXULWindow->GetPrimaryContentShell(getter_AddRefs(shell));
if (shell) { if (shell) {
nsCOMPtr<nsIInterfaceRequestor> thing(do_QueryInterface(shell)); nsCOMPtr<nsIInterfaceRequestor> thing(do_QueryInterface(shell));
if (thing) return thing->GetInterface(aIID, aSink); if (thing) return thing->GetInterface(aIID, aSink);
@ -149,9 +149,9 @@ NS_IMETHODIMP nsContentTreeOwner::GetInterface(const nsIID& aIID,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
if (aIID.Equals(NS_GET_IID(nsIAppWindow))) { if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->QueryInterface(aIID, aSink); return mXULWindow->QueryInterface(aIID, aSink);
} }
return QueryInterface(aIID, aSink); return QueryInterface(aIID, aSink);
@ -164,75 +164,75 @@ NS_IMETHODIMP nsContentTreeOwner::GetInterface(const nsIID& aIID,
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell, nsContentTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
bool aPrimary) { bool aPrimary) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->ContentShellAdded(aContentShell, aPrimary); return mXULWindow->ContentShellAdded(aContentShell, aPrimary);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) { nsContentTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->ContentShellRemoved(aContentShell); return mXULWindow->ContentShellRemoved(aContentShell);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell) { nsContentTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPrimaryContentShell(aShell); return mXULWindow->GetPrimaryContentShell(aShell);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) { nsContentTreeOwner::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->RemoteTabAdded(aTab, aPrimary); return mXULWindow->RemoteTabAdded(aTab, aPrimary);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::RemoteTabRemoved(nsIRemoteTab* aTab) { nsContentTreeOwner::RemoteTabRemoved(nsIRemoteTab* aTab) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->RemoteTabRemoved(aTab); return mXULWindow->RemoteTabRemoved(aTab);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::GetPrimaryRemoteTab(nsIRemoteTab** aTab) { nsContentTreeOwner::GetPrimaryRemoteTab(nsIRemoteTab** aTab) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPrimaryRemoteTab(aTab); return mXULWindow->GetPrimaryRemoteTab(aTab);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) { nsContentTreeOwner::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPrimaryContentSize(aWidth, aHeight); return mXULWindow->GetPrimaryContentSize(aWidth, aHeight);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) { nsContentTreeOwner::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPrimaryContentSize(aWidth, aHeight); return mXULWindow->SetPrimaryContentSize(aWidth, aHeight);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) { nsContentTreeOwner::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetRootShellSize(aWidth, aHeight); return mXULWindow->GetRootShellSize(aWidth, aHeight);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::SetRootShellSize(int32_t aWidth, int32_t aHeight) { nsContentTreeOwner::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetRootShellSize(aWidth, aHeight); return mXULWindow->SetRootShellSize(aWidth, aHeight);
} }
NS_IMETHODIMP nsContentTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, NS_IMETHODIMP nsContentTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
int32_t aCX, int32_t aCY) { int32_t aCX, int32_t aCY) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SizeShellTo(aShellItem, aCX, aCY); return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize, nsContentTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize,
bool aPersistSizeMode) { bool aPersistSizeMode) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement(); nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
if (!docShellElement) return NS_ERROR_FAILURE; if (!docShellElement) return NS_ERROR_FAILURE;
nsAutoString persistString; nsAutoString persistString;
@ -299,8 +299,8 @@ nsContentTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize,
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize, nsContentTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize,
bool* aPersistSizeMode) { bool* aPersistSizeMode) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement(); nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
if (!docShellElement) return NS_ERROR_FAILURE; if (!docShellElement) return NS_ERROR_FAILURE;
nsAutoString persistString; nsAutoString persistString;
@ -326,8 +326,8 @@ nsContentTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize,
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::GetTabCount(uint32_t* aResult) { nsContentTreeOwner::GetTabCount(uint32_t* aResult) {
if (mAppWindow) { if (mXULWindow) {
return mAppWindow->GetTabCount(aResult); return mXULWindow->GetTabCount(aResult);
} }
*aResult = 0; *aResult = 0;
@ -336,8 +336,8 @@ nsContentTreeOwner::GetTabCount(uint32_t* aResult) {
NS_IMETHODIMP NS_IMETHODIMP
nsContentTreeOwner::GetHasPrimaryContent(bool* aResult) { nsContentTreeOwner::GetHasPrimaryContent(bool* aResult) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetHasPrimaryContent(aResult); return mXULWindow->GetHasPrimaryContent(aResult);
} }
//***************************************************************************** //*****************************************************************************
@ -347,10 +347,10 @@ nsContentTreeOwner::GetHasPrimaryContent(bool* aResult) {
NS_IMETHODIMP nsContentTreeOwner::OnBeforeLinkTraversal( NS_IMETHODIMP nsContentTreeOwner::OnBeforeLinkTraversal(
const nsAString& originalTarget, nsIURI* linkURI, nsINode* linkNode, const nsAString& originalTarget, nsIURI* linkURI, nsINode* linkNode,
bool isAppTab, nsAString& _retval) { bool isAppTab, nsAString& _retval) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow; nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
mAppWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow)); mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
if (xulBrowserWindow) if (xulBrowserWindow)
return xulBrowserWindow->OnBeforeLinkTraversal(originalTarget, linkURI, return xulBrowserWindow->OnBeforeLinkTraversal(originalTarget, linkURI,
@ -364,10 +364,10 @@ NS_IMETHODIMP nsContentTreeOwner::ShouldLoadURI(
nsIDocShell* aDocShell, nsIURI* aURI, nsIReferrerInfo* aReferrerInfo, nsIDocShell* aDocShell, nsIURI* aURI, nsIReferrerInfo* aReferrerInfo,
bool aHasPostData, nsIPrincipal* aTriggeringPrincipal, bool aHasPostData, nsIPrincipal* aTriggeringPrincipal,
nsIContentSecurityPolicy* aCsp, bool* _retval) { nsIContentSecurityPolicy* aCsp, bool* _retval) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow; nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
mAppWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow)); mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
if (xulBrowserWindow) if (xulBrowserWindow)
return xulBrowserWindow->ShouldLoadURI(aDocShell, aURI, aReferrerInfo, return xulBrowserWindow->ShouldLoadURI(aDocShell, aURI, aReferrerInfo,
@ -404,10 +404,10 @@ NS_IMETHODIMP nsContentTreeOwner::SetStatusWithContext(
// We only allow the status to be set from the primary content shell // We only allow the status to be set from the primary content shell
if (!mPrimary && aStatusType != STATUS_LINK) return NS_OK; if (!mPrimary && aStatusType != STATUS_LINK) return NS_OK;
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow; nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
mAppWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow)); mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
if (xulBrowserWindow) { if (xulBrowserWindow) {
switch (aStatusType) { switch (aStatusType) {
@ -436,23 +436,23 @@ NS_IMETHODIMP nsContentTreeOwner::SetStatus(uint32_t aStatusType,
} }
NS_IMETHODIMP nsContentTreeOwner::SetChromeFlags(uint32_t aChromeFlags) { NS_IMETHODIMP nsContentTreeOwner::SetChromeFlags(uint32_t aChromeFlags) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetChromeFlags(aChromeFlags); return mXULWindow->SetChromeFlags(aChromeFlags);
} }
NS_IMETHODIMP nsContentTreeOwner::GetChromeFlags(uint32_t* aChromeFlags) { NS_IMETHODIMP nsContentTreeOwner::GetChromeFlags(uint32_t* aChromeFlags) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetChromeFlags(aChromeFlags); return mXULWindow->GetChromeFlags(aChromeFlags);
} }
NS_IMETHODIMP nsContentTreeOwner::ShowAsModal() { NS_IMETHODIMP nsContentTreeOwner::ShowAsModal() {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->ShowModal(); return mXULWindow->ShowModal();
} }
NS_IMETHODIMP nsContentTreeOwner::IsWindowModal(bool* _retval) { NS_IMETHODIMP nsContentTreeOwner::IsWindowModal(bool* _retval) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
*_retval = mAppWindow->mContinueModalLoop; *_retval = mXULWindow->mContinueModalLoop;
return NS_OK; return NS_OK;
} }
@ -477,71 +477,71 @@ NS_IMETHODIMP nsContentTreeOwner::Create() {
} }
NS_IMETHODIMP nsContentTreeOwner::Destroy() { NS_IMETHODIMP nsContentTreeOwner::Destroy() {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->Destroy(); return mXULWindow->Destroy();
} }
NS_IMETHODIMP nsContentTreeOwner::GetUnscaledDevicePixelsPerCSSPixel( NS_IMETHODIMP nsContentTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(
double* aScale) { double* aScale) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale); return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
} }
NS_IMETHODIMP nsContentTreeOwner::GetDevicePixelsPerDesktopPixel( NS_IMETHODIMP nsContentTreeOwner::GetDevicePixelsPerDesktopPixel(
double* aScale) { double* aScale) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetDevicePixelsPerDesktopPixel(aScale); return mXULWindow->GetDevicePixelsPerDesktopPixel(aScale);
} }
NS_IMETHODIMP nsContentTreeOwner::SetPositionDesktopPix(int32_t aX, NS_IMETHODIMP nsContentTreeOwner::SetPositionDesktopPix(int32_t aX,
int32_t aY) { int32_t aY) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPositionDesktopPix(aX, aY); return mXULWindow->SetPositionDesktopPix(aX, aY);
} }
NS_IMETHODIMP nsContentTreeOwner::SetPosition(int32_t aX, int32_t aY) { NS_IMETHODIMP nsContentTreeOwner::SetPosition(int32_t aX, int32_t aY) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPosition(aX, aY); return mXULWindow->SetPosition(aX, aY);
} }
NS_IMETHODIMP nsContentTreeOwner::GetPosition(int32_t* aX, int32_t* aY) { NS_IMETHODIMP nsContentTreeOwner::GetPosition(int32_t* aX, int32_t* aY) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPosition(aX, aY); return mXULWindow->GetPosition(aX, aY);
} }
NS_IMETHODIMP nsContentTreeOwner::SetSize(int32_t aCX, int32_t aCY, NS_IMETHODIMP nsContentTreeOwner::SetSize(int32_t aCX, int32_t aCY,
bool aRepaint) { bool aRepaint) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetSize(aCX, aCY, aRepaint); return mXULWindow->SetSize(aCX, aCY, aRepaint);
} }
NS_IMETHODIMP nsContentTreeOwner::GetSize(int32_t* aCX, int32_t* aCY) { NS_IMETHODIMP nsContentTreeOwner::GetSize(int32_t* aCX, int32_t* aCY) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetSize(aCX, aCY); return mXULWindow->GetSize(aCX, aCY);
} }
NS_IMETHODIMP nsContentTreeOwner::SetPositionAndSize(int32_t aX, int32_t aY, NS_IMETHODIMP nsContentTreeOwner::SetPositionAndSize(int32_t aX, int32_t aY,
int32_t aCX, int32_t aCY, int32_t aCX, int32_t aCY,
uint32_t aFlags) { uint32_t aFlags) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetPositionAndSize(aX, aY, aCX, aCY, aFlags); return mXULWindow->SetPositionAndSize(aX, aY, aCX, aCY, aFlags);
} }
NS_IMETHODIMP nsContentTreeOwner::GetPositionAndSize(int32_t* aX, int32_t* aY, NS_IMETHODIMP nsContentTreeOwner::GetPositionAndSize(int32_t* aX, int32_t* aY,
int32_t* aCX, int32_t* aCX,
int32_t* aCY) { int32_t* aCY) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetPositionAndSize(aX, aY, aCX, aCY); return mXULWindow->GetPositionAndSize(aX, aY, aCX, aCY);
} }
NS_IMETHODIMP nsContentTreeOwner::Repaint(bool aForce) { NS_IMETHODIMP nsContentTreeOwner::Repaint(bool aForce) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->Repaint(aForce); return mXULWindow->Repaint(aForce);
} }
NS_IMETHODIMP nsContentTreeOwner::GetParentWidget(nsIWidget** aParentWidget) { NS_IMETHODIMP nsContentTreeOwner::GetParentWidget(nsIWidget** aParentWidget) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetParentWidget(aParentWidget); return mXULWindow->GetParentWidget(aParentWidget);
} }
NS_IMETHODIMP nsContentTreeOwner::SetParentWidget(nsIWidget* aParentWidget) { NS_IMETHODIMP nsContentTreeOwner::SetParentWidget(nsIWidget* aParentWidget) {
@ -551,8 +551,8 @@ NS_IMETHODIMP nsContentTreeOwner::SetParentWidget(nsIWidget* aParentWidget) {
NS_IMETHODIMP nsContentTreeOwner::GetParentNativeWindow( NS_IMETHODIMP nsContentTreeOwner::GetParentNativeWindow(
nativeWindow* aParentNativeWindow) { nativeWindow* aParentNativeWindow) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetParentNativeWindow(aParentNativeWindow); return mXULWindow->GetParentNativeWindow(aParentNativeWindow);
} }
NS_IMETHODIMP nsContentTreeOwner::SetParentNativeWindow( NS_IMETHODIMP nsContentTreeOwner::SetParentNativeWindow(
@ -562,49 +562,49 @@ NS_IMETHODIMP nsContentTreeOwner::SetParentNativeWindow(
} }
NS_IMETHODIMP nsContentTreeOwner::GetNativeHandle(nsAString& aNativeHandle) { NS_IMETHODIMP nsContentTreeOwner::GetNativeHandle(nsAString& aNativeHandle) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetNativeHandle(aNativeHandle); return mXULWindow->GetNativeHandle(aNativeHandle);
} }
NS_IMETHODIMP nsContentTreeOwner::GetVisibility(bool* aVisibility) { NS_IMETHODIMP nsContentTreeOwner::GetVisibility(bool* aVisibility) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetVisibility(aVisibility); return mXULWindow->GetVisibility(aVisibility);
} }
NS_IMETHODIMP nsContentTreeOwner::SetVisibility(bool aVisibility) { NS_IMETHODIMP nsContentTreeOwner::SetVisibility(bool aVisibility) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetVisibility(aVisibility); return mXULWindow->SetVisibility(aVisibility);
} }
NS_IMETHODIMP nsContentTreeOwner::GetEnabled(bool* aEnabled) { NS_IMETHODIMP nsContentTreeOwner::GetEnabled(bool* aEnabled) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetEnabled(aEnabled); return mXULWindow->GetEnabled(aEnabled);
} }
NS_IMETHODIMP nsContentTreeOwner::SetEnabled(bool aEnable) { NS_IMETHODIMP nsContentTreeOwner::SetEnabled(bool aEnable) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetEnabled(aEnable); return mXULWindow->SetEnabled(aEnable);
} }
NS_IMETHODIMP nsContentTreeOwner::GetMainWidget(nsIWidget** aMainWidget) { NS_IMETHODIMP nsContentTreeOwner::GetMainWidget(nsIWidget** aMainWidget) {
NS_ENSURE_ARG_POINTER(aMainWidget); NS_ENSURE_ARG_POINTER(aMainWidget);
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
*aMainWidget = mAppWindow->mWindow; *aMainWidget = mXULWindow->mWindow;
NS_IF_ADDREF(*aMainWidget); NS_IF_ADDREF(*aMainWidget);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsContentTreeOwner::SetFocus() { NS_IMETHODIMP nsContentTreeOwner::SetFocus() {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->SetFocus(); return mXULWindow->SetFocus();
} }
NS_IMETHODIMP nsContentTreeOwner::GetTitle(nsAString& aTitle) { NS_IMETHODIMP nsContentTreeOwner::GetTitle(nsAString& aTitle) {
NS_ENSURE_STATE(mAppWindow); NS_ENSURE_STATE(mXULWindow);
return mAppWindow->GetTitle(aTitle); return mXULWindow->GetTitle(aTitle);
} }
NS_IMETHODIMP nsContentTreeOwner::SetTitle(const nsAString& aTitle) { NS_IMETHODIMP nsContentTreeOwner::SetTitle(const nsAString& aTitle) {
@ -629,7 +629,7 @@ nsContentTreeOwner::ProvideWindow(
*aReturn = nullptr; *aReturn = nullptr;
if (!mAppWindow) { if (!mXULWindow) {
// Nothing to do here // Nothing to do here
return NS_OK; return NS_OK;
} }
@ -690,11 +690,11 @@ nsContentTreeOwner::ProvideWindow(
} }
nsCOMPtr<mozIDOMWindowProxy> domWin; nsCOMPtr<mozIDOMWindowProxy> domWin;
mAppWindow->GetWindowDOMWindow(getter_AddRefs(domWin)); mXULWindow->GetWindowDOMWindow(getter_AddRefs(domWin));
nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(domWin); nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(domWin);
if (!chromeWin) { if (!chromeWin) {
// Really odd... but whatever // Really odd... but whatever
NS_WARNING("AppWindow's DOMWindow is not a chrome window"); NS_WARNING("nsXULWindow's DOMWindow is not a chrome window");
return NS_OK; return NS_OK;
} }
@ -756,13 +756,11 @@ class nsContentTitleSettingEvent : public Runnable {
}; };
#endif #endif
void nsContentTreeOwner::AppWindow(mozilla::AppWindow* aAppWindow) { void nsContentTreeOwner::XULWindow(nsXULWindow* aXULWindow) {
mAppWindow = aAppWindow; mXULWindow = aXULWindow;
} }
mozilla::AppWindow* nsContentTreeOwner::AppWindow() { nsXULWindow* nsContentTreeOwner::XULWindow() { return mXULWindow; }
return mAppWindow;
}
//***************************************************************************** //*****************************************************************************
//*** nsSiteWindow implementation //*** nsSiteWindow implementation
@ -806,7 +804,7 @@ nsSiteWindow::SetFocus(void) {
and it's better for our purposes to not pick a document and and it's better for our purposes to not pick a document and
focus it, but allow nsGlobalWindow to carry on unhindered. focus it, but allow nsGlobalWindow to carry on unhindered.
*/ */
AppWindow *window = mAggregator->AppWindow(); nsXULWindow *window = mAggregator->XULWindow();
if (window) { if (window) {
nsCOMPtr<nsIDocShell> docshell; nsCOMPtr<nsIDocShell> docshell;
window->GetDocShell(getter_AddRefs(docshell)); window->GetDocShell(getter_AddRefs(docshell));
@ -827,15 +825,15 @@ nsSiteWindow::Blur(void) {
NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
nsCOMPtr<nsISimpleEnumerator> windowEnumerator; nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
nsCOMPtr<nsIAppWindow> appWindow; nsCOMPtr<nsIXULWindow> xulWindow;
bool more, foundUs; bool more, foundUs;
AppWindow* ourWindow = mAggregator->AppWindow(); nsXULWindow* ourWindow = mAggregator->XULWindow();
{ {
nsCOMPtr<nsIWindowMediator> windowMediator( nsCOMPtr<nsIWindowMediator> windowMediator(
do_GetService(kWindowMediatorCID)); do_GetService(kWindowMediatorCID));
if (windowMediator) if (windowMediator)
windowMediator->GetZOrderAppWindowEnumerator( windowMediator->GetZOrderXULWindowEnumerator(
0, true, getter_AddRefs(windowEnumerator)); 0, true, getter_AddRefs(windowEnumerator));
} }
@ -846,30 +844,30 @@ nsSiteWindow::Blur(void) {
windowEnumerator->HasMoreElements(&more); windowEnumerator->HasMoreElements(&more);
while (more) { while (more) {
nsCOMPtr<nsISupports> nextWindow; nsCOMPtr<nsISupports> nextWindow;
nsCOMPtr<nsIAppWindow> nextAppWindow; nsCOMPtr<nsIXULWindow> nextXULWindow;
windowEnumerator->GetNext(getter_AddRefs(nextWindow)); windowEnumerator->GetNext(getter_AddRefs(nextWindow));
nextAppWindow = do_QueryInterface(nextWindow); nextXULWindow = do_QueryInterface(nextWindow);
// got it!(?) // got it!(?)
if (foundUs) { if (foundUs) {
appWindow = nextAppWindow; xulWindow = nextXULWindow;
break; break;
} }
// remember the very first one, in case we have to wrap // remember the very first one, in case we have to wrap
if (!appWindow) appWindow = nextAppWindow; if (!xulWindow) xulWindow = nextXULWindow;
// look for us // look for us
if (nextAppWindow == ourWindow) foundUs = true; if (nextXULWindow == ourWindow) foundUs = true;
windowEnumerator->HasMoreElements(&more); windowEnumerator->HasMoreElements(&more);
} }
// change focus to the window we just found // change focus to the window we just found
if (appWindow) { if (xulWindow) {
nsCOMPtr<nsIDocShell> docshell; nsCOMPtr<nsIDocShell> docshell;
appWindow->GetDocShell(getter_AddRefs(docshell)); xulWindow->GetDocShell(getter_AddRefs(docshell));
if (!docshell) { if (!docshell) {
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -19,9 +19,7 @@
#include "nsIWebBrowserChrome3.h" #include "nsIWebBrowserChrome3.h"
#include "nsIWindowProvider.h" #include "nsIWindowProvider.h"
namespace mozilla { class nsXULWindow;
class AppWindow;
}
class nsSiteWindow; class nsSiteWindow;
class nsContentTreeOwner final : public nsIDocShellTreeOwner, class nsContentTreeOwner final : public nsIDocShellTreeOwner,
@ -29,7 +27,7 @@ class nsContentTreeOwner final : public nsIDocShellTreeOwner,
public nsIInterfaceRequestor, public nsIInterfaceRequestor,
public nsIWebBrowserChrome3, public nsIWebBrowserChrome3,
public nsIWindowProvider { public nsIWindowProvider {
friend class mozilla::AppWindow; friend class nsXULWindow;
friend class nsSiteWindow; friend class nsSiteWindow;
public: public:
@ -47,11 +45,11 @@ class nsContentTreeOwner final : public nsIDocShellTreeOwner,
explicit nsContentTreeOwner(bool fPrimary); explicit nsContentTreeOwner(bool fPrimary);
virtual ~nsContentTreeOwner(); virtual ~nsContentTreeOwner();
void AppWindow(mozilla::AppWindow* aAppWindow); void XULWindow(nsXULWindow* aXULWindow);
mozilla::AppWindow* AppWindow(); nsXULWindow* XULWindow();
protected: protected:
mozilla::AppWindow* mAppWindow; nsXULWindow* mXULWindow;
nsSiteWindow* mSiteWindow; nsSiteWindow* mSiteWindow;
bool mPrimary; bool mPrimary;
}; };

Просмотреть файл

@ -5,7 +5,7 @@
#include "nsISupports.idl" #include "nsISupports.idl"
interface nsIAppWindow; interface nsIXULWindow;
interface nsIWindowlessBrowser; interface nsIWindowlessBrowser;
interface nsIURI; interface nsIURI;
interface mozIDOMWindowProxy; interface mozIDOMWindowProxy;
@ -42,7 +42,7 @@ interface nsIAppShellService : nsISupports
* Can be left null. * Can be left null.
*/ */
const long SIZE_TO_CONTENT = -1; const long SIZE_TO_CONTENT = -1;
nsIAppWindow createTopLevelWindow(in nsIAppWindow aParent, nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent,
in nsIURI aUrl, in nsIURI aUrl,
in uint32_t aChromeMask, in uint32_t aChromeMask,
in long aInitialWidth, in long aInitialWidth,
@ -79,7 +79,7 @@ interface nsIAppShellService : nsISupports
* @param aResult the hidden window. Do not unhide hidden window. * @param aResult the hidden window. Do not unhide hidden window.
* Do not taunt hidden window. * Do not taunt hidden window.
*/ */
readonly attribute nsIAppWindow hiddenWindow; readonly attribute nsIXULWindow hiddenWindow;
/** /**
* Return the (singleton) application hidden window, automatically created * Return the (singleton) application hidden window, automatically created
@ -104,7 +104,7 @@ interface nsIAppShellService : nsISupports
* @note When this method is successful, it fires the global notification * @note When this method is successful, it fires the global notification
* "xul-window-registered" * "xul-window-registered"
*/ */
void registerTopLevelWindow(in nsIAppWindow aWindow); void registerTopLevelWindow(in nsIXULWindow aWindow);
/** /**
* Remove a window from the application's window registry. Note that * Remove a window from the application's window registry. Note that
@ -112,7 +112,7 @@ interface nsIAppShellService : nsISupports
* the last window is unregistered. For that, see Quit(). * the last window is unregistered. For that, see Quit().
* @param aWindow you see the pattern * @param aWindow you see the pattern
*/ */
void unregisterTopLevelWindow(in nsIAppWindow aWindow); void unregisterTopLevelWindow(in nsIXULWindow aWindow);
/** /**
* Whether the hidden window has been lazily created. * Whether the hidden window has been lazily created.

Просмотреть файл

@ -17,7 +17,7 @@
interface mozIDOMWindow; interface mozIDOMWindow;
interface mozIDOMWindowProxy; interface mozIDOMWindowProxy;
interface nsIAppWindow; interface nsIXULWindow;
interface nsIWidget; interface nsIWidget;
interface nsIWindowMediatorListener; interface nsIWindowMediatorListener;
@ -37,9 +37,9 @@ interface nsIWindowMediator: nsISupports
nsISimpleEnumerator getEnumerator(in wstring aWindowType); nsISimpleEnumerator getEnumerator(in wstring aWindowType);
/** Identical to getEnumerator except: /** Identical to getEnumerator except:
* @return an enumerator of nsIAppWindows * @return an enumerator of nsIXULWindows
*/ */
nsISimpleEnumerator getAppWindowEnumerator(in wstring aWindowType); nsISimpleEnumerator getXULWindowEnumerator(in wstring aWindowType);
/** Return an enumerator which iterates over all windows of type aWindowType /** Return an enumerator which iterates over all windows of type aWindowType
* in their z (front-to-back) order. Note this interface makes * in their z (front-to-back) order. Note this interface makes
@ -51,9 +51,9 @@ interface nsIWindowMediator: nsISupports
* If null, all windows will be enumerated. * If null, all windows will be enumerated.
* @param aFrontToBack if true, the enumerator enumerates windows in order * @param aFrontToBack if true, the enumerator enumerates windows in order
* from front to back. back to front if false. * from front to back. back to front if false.
* @return an enumerator of nsIAppWindows * @return an enumerator of nsIXULWindows
*/ */
nsISimpleEnumerator getZOrderAppWindowEnumerator(in wstring aWindowType, nsISimpleEnumerator getZOrderXULWindowEnumerator(in wstring aWindowType,
in boolean aFrontToBack); in boolean aFrontToBack);
/** This is a shortcut for simply fetching the first window in /** This is a shortcut for simply fetching the first window in
@ -95,20 +95,20 @@ interface nsIWindowMediator: nsISupports
* addListener) will be notified through their onOpenWindow method. * addListener) will be notified through their onOpenWindow method.
* @param aWindow the window to add * @param aWindow the window to add
*/ */
[noscript] void registerWindow(in nsIAppWindow aWindow); [noscript] void registerWindow(in nsIXULWindow aWindow);
/** Remove the window from the list of known windows. Listeners (see /** Remove the window from the list of known windows. Listeners (see
* addListener) will be be notified through their onCloseWindow method. * addListener) will be be notified through their onCloseWindow method.
* @param aWindow the window to remove * @param aWindow the window to remove
*/ */
[noscript] void unregisterWindow(in nsIAppWindow aWindow); [noscript] void unregisterWindow(in nsIXULWindow aWindow);
/** Call this method when a window gains focus. It's a primitive means of /** Call this method when a window gains focus. It's a primitive means of
* determining the most recent window. It's no longer necessary and it * determining the most recent window. It's no longer necessary and it
* really should be removed. * really should be removed.
* @param aWindow the window which has gained focus * @param aWindow the window which has gained focus
*/ */
[noscript] void updateWindowTimeStamp(in nsIAppWindow aWindow); [noscript] void updateWindowTimeStamp(in nsIXULWindow aWindow);
/* z-ordering: */ /* z-ordering: */
@ -120,8 +120,8 @@ interface nsIWindowMediator: nsISupports
* it should be constrained. Note this method is advisory only: * it should be constrained. Note this method is advisory only:
* it changes nothing either in WindowMediator's internal state * it changes nothing either in WindowMediator's internal state
* or with the window. * or with the window.
* Note it compares the nsIAppWindow to nsIWidgets. A pure interface * Note it compares the nsIXULWindow to nsIWidgets. A pure interface
* would use all nsIAppWindows. But we expect this to be called from * would use all nsIXULWindows. But we expect this to be called from
* callbacks originating in native window code. They are expected to * callbacks originating in native window code. They are expected to
* hand us comparison values which are pulled from general storage * hand us comparison values which are pulled from general storage
* in the native widget, and may not correspond to an nsIWidget at all. * in the native widget, and may not correspond to an nsIWidget at all.
@ -146,7 +146,7 @@ interface nsIWindowMediator: nsISupports
* the position given. * the position given.
*/ */
[noscript] boolean calculateZPosition(in nsIAppWindow inWindow, [noscript] boolean calculateZPosition(in nsIXULWindow inWindow,
in unsigned long inPosition, in unsigned long inPosition,
in nsIWidget inBelow, in nsIWidget inBelow,
out unsigned long outPosition, out unsigned long outPosition,
@ -161,24 +161,24 @@ interface nsIWindowMediator: nsISupports
* for other values of inPosition.) * for other values of inPosition.)
* @param inBelow the window inWindow is behind, if zLevelBelow * @param inBelow the window inWindow is behind, if zLevelBelow
*/ */
[noscript] void setZPosition(in nsIAppWindow inWindow, [noscript] void setZPosition(in nsIXULWindow inWindow,
in unsigned long inPosition, in unsigned long inPosition,
in nsIAppWindow inBelow); in nsIXULWindow inBelow);
/** Return the window's Z level (as defined in nsIAppWindow). /** Return the window's Z level (as defined in nsIXULWindow).
* @param aWindow the window in question * @param aWindow the window in question
* @return aWindow's z level * @return aWindow's z level
*/ */
[noscript] uint32_t getZLevel(in nsIAppWindow aWindow); [noscript] uint32_t getZLevel(in nsIXULWindow aWindow);
/** Set the window's Z level (as defined in nsIAppWindow). The implementation /** Set the window's Z level (as defined in nsIXULWindow). The implementation
* will reposition the window as necessary to match its new Z level. * will reposition the window as necessary to match its new Z level.
* The implementation will assume a window's Z level to be * The implementation will assume a window's Z level to be
* nsIAppWindow::normalZ until it has been informed of a different level. * nsIXULWindow::normalZ until it has been informed of a different level.
* @param aWindow the window in question * @param aWindow the window in question
* @param aZLevel the window's new Z level * @param aZLevel the window's new Z level
*/ */
[noscript] void setZLevel(in nsIAppWindow aWindow, in uint32_t aZLevel); [noscript] void setZLevel(in nsIXULWindow aWindow, in uint32_t aZLevel);
/** Register a listener for window status changes. /** Register a listener for window status changes.
* keeps strong ref? (to be decided) * keeps strong ref? (to be decided)

Просмотреть файл

@ -5,12 +5,12 @@
#include "nsISupports.idl" #include "nsISupports.idl"
interface nsIAppWindow; interface nsIXULWindow;
[scriptable, uuid(2F276982-0D60-4377-A595-D350BA516395)] [scriptable, uuid(2F276982-0D60-4377-A595-D350BA516395)]
interface nsIWindowMediatorListener : nsISupports interface nsIWindowMediatorListener : nsISupports
{ {
void onOpenWindow(in nsIAppWindow window); void onOpenWindow(in nsIXULWindow window);
void onCloseWindow(in nsIAppWindow window); void onCloseWindow(in nsIXULWindow window);
}; };

Просмотреть файл

@ -7,7 +7,7 @@
#include "nsISupports.idl" #include "nsISupports.idl"
/** /**
* The nsIAppWindow * The nsIXULWindow
* *
* When the window is destroyed, it will fire a "xul-window-destroyed" * When the window is destroyed, it will fire a "xul-window-destroyed"
* notification through the global observer service. * notification through the global observer service.
@ -27,7 +27,7 @@ interface mozIDOMWindowProxy;
native LiveResizeListenerArray(nsTArray<RefPtr<mozilla::LiveResizeListener>>); native LiveResizeListenerArray(nsTArray<RefPtr<mozilla::LiveResizeListener>>);
[builtinclass, scriptable, uuid(d6d7a014-e28d-4c9d-8727-1cf6d870619b)] [builtinclass, scriptable, uuid(d6d7a014-e28d-4c9d-8727-1cf6d870619b)]
interface nsIAppWindow : nsISupports interface nsIXULWindow : nsISupports
{ {
/** /**
* The docshell owning the XUL for this window. * The docshell owning the XUL for this window.
@ -64,7 +64,7 @@ interface nsIAppWindow : nsISupports
* Tell this window that it has picked up a child XUL window * Tell this window that it has picked up a child XUL window
* @param aChild the child window being added * @param aChild the child window being added
*/ */
void addChildWindow(in nsIAppWindow aChild); void addChildWindow(in nsIXULWindow aChild);
/** /**
* Returns the difference between the inner window size (client size) and the * Returns the difference between the inner window size (client size) and the
@ -77,7 +77,7 @@ interface nsIAppWindow : nsISupports
* Tell this window that it has lost a child XUL window * Tell this window that it has lost a child XUL window
* @param aChild the child window being removed * @param aChild the child window being removed
*/ */
void removeChildWindow(in nsIAppWindow aChild); void removeChildWindow(in nsIXULWindow aChild);
/** /**
* Move the window to a centered position. * Move the window to a centered position.
@ -93,7 +93,7 @@ interface nsIAppWindow : nsISupports
* @param aAlert PR_TRUE to move the window to an alert position, * @param aAlert PR_TRUE to move the window to an alert position,
* generally centered horizontally and 1/3 down from the top. * generally centered horizontally and 1/3 down from the top.
*/ */
void center(in nsIAppWindow aRelative, in boolean aScreen, in boolean aAlert); void center(in nsIXULWindow aRelative, in boolean aScreen, in boolean aAlert);
/** /**
* Shows the window as a modal window. That is, ensures that it is visible * Shows the window as a modal window. That is, ensures that it is visible
@ -133,7 +133,7 @@ interface nsIAppWindow : nsISupports
* 0 means there is no next remote tab actor to use. * 0 means there is no next remote tab actor to use.
* @return the newly minted window * @return the newly minted window
*/ */
nsIAppWindow createNewWindow(in int32_t aChromeFlags, nsIXULWindow createNewWindow(in int32_t aChromeFlags,
in nsIRemoteTab aOpeningTab, in nsIRemoteTab aOpeningTab,
in mozIDOMWindowProxy aOpener, in mozIDOMWindowProxy aOpener,
in unsigned long long aNextRemoteTabId); in unsigned long long aNextRemoteTabId);

Просмотреть файл

@ -0,0 +1,818 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsWebShellWindow.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsContentList.h"
#include "nsIWeakReference.h"
#include "nsIContentViewer.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsNetCID.h"
#include "nsIStringBundle.h"
#include "nsReadableUtils.h"
#include "nsContentUtils.h"
#include "nsEscape.h"
#include "nsPIDOMWindow.h"
#include "nsIWebNavigation.h"
#include "nsIWindowWatcher.h"
#include "nsWidgetInitData.h"
#include "nsWidgetsCID.h"
#include "nsIWidget.h"
#include "nsIWidgetListener.h"
#include "nsINodeList.h"
#include "nsITimer.h"
#include "nsXULPopupManager.h"
#include "nsFocusManager.h"
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "mozilla/dom/Document.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIObserverService.h"
#include "nsIScreenManager.h"
#include "nsIScreen.h"
#include "nsIContent.h" // for menus
#include "nsIScriptSecurityManager.h"
// For calculating size
#include "nsPresContext.h"
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeItem.h"
#include "nsDocShell.h"
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/LoadURIOptionsBinding.h"
#include "nsPIWindowRoot.h"
#include "gfxPlatform.h"
#ifdef XP_MACOSX
# include "nsINativeMenuService.h"
# define USE_NATIVE_MENUS
#endif
using namespace mozilla;
using namespace mozilla::dom;
#define SIZE_PERSISTENCE_TIMEOUT 500 // msec
nsWebShellWindow::nsWebShellWindow(uint32_t aChromeFlags)
: nsXULWindow(aChromeFlags),
mSPTimerLock("nsWebShellWindow.mSPTimerLock"),
mWidgetListenerDelegate(this) {}
nsWebShellWindow::~nsWebShellWindow() {
MutexAutoLock lock(mSPTimerLock);
if (mSPTimer) mSPTimer->Cancel();
}
NS_IMPL_ADDREF_INHERITED(nsWebShellWindow, nsXULWindow)
NS_IMPL_RELEASE_INHERITED(nsWebShellWindow, nsXULWindow)
NS_INTERFACE_MAP_BEGIN(nsWebShellWindow)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_END_INHERITING(nsXULWindow)
nsresult nsWebShellWindow::Initialize(
nsIXULWindow* aParent, nsIXULWindow* aOpener, nsIURI* aUrl,
int32_t aInitialWidth, int32_t aInitialHeight, bool aIsHiddenWindow,
nsIRemoteTab* aOpeningTab, mozIDOMWindowProxy* aOpenerWindow,
nsWidgetInitData& widgetInitData) {
nsresult rv;
nsCOMPtr<nsIWidget> parentWidget;
mIsHiddenWindow = aIsHiddenWindow;
int32_t initialX = 0, initialY = 0;
nsCOMPtr<nsIBaseWindow> base(do_QueryInterface(aOpener));
if (base) {
int32_t x, y, width, height;
rv = base->GetPositionAndSize(&x, &y, &width, &height);
if (NS_FAILED(rv)) {
mOpenerScreenRect.SetEmpty();
} else {
double scale;
if (NS_SUCCEEDED(base->GetUnscaledDevicePixelsPerCSSPixel(&scale))) {
mOpenerScreenRect.SetRect(
NSToIntRound(x / scale), NSToIntRound(y / scale),
NSToIntRound(width / scale), NSToIntRound(height / scale));
} else {
mOpenerScreenRect.SetRect(x, y, width, height);
}
initialX = mOpenerScreenRect.X();
initialY = mOpenerScreenRect.Y();
ConstrainToOpenerScreen(&initialX, &initialY);
}
}
// XXX: need to get the default window size from prefs...
// Doesn't come from prefs... will come from CSS/XUL/RDF
DesktopIntRect deskRect(initialX, initialY, aInitialWidth, aInitialHeight);
// Create top level window
if (gfxPlatform::IsHeadless()) {
mWindow = nsIWidget::CreateHeadlessWidget();
} else {
mWindow = nsIWidget::CreateTopLevelWindow();
}
if (!mWindow) {
return NS_ERROR_FAILURE;
}
/* This next bit is troublesome. We carry two different versions of a pointer
to our parent window. One is the parent window's widget, which is passed
to our own widget. The other is a weak reference we keep here to our
parent WebShellWindow. The former is useful to the widget, and we can't
trust its treatment of the parent reference because they're platform-
specific. The latter is useful to this class.
A better implementation would be one in which the parent keeps strong
references to its children and closes them before it allows itself
to be closed. This would mimic the behaviour of OSes that support
top-level child windows in OSes that do not. Later.
*/
nsCOMPtr<nsIBaseWindow> parentAsWin(do_QueryInterface(aParent));
if (parentAsWin) {
parentAsWin->GetMainWidget(getter_AddRefs(parentWidget));
mParentWindow = do_GetWeakReference(aParent);
}
mWindow->SetWidgetListener(&mWidgetListenerDelegate);
rv = mWindow->Create((nsIWidget*)parentWidget, // Parent nsIWidget
nullptr, // Native parent widget
deskRect, // Widget dimensions
&widgetInitData); // Widget initialization data
NS_ENSURE_SUCCESS(rv, rv);
LayoutDeviceIntRect r = mWindow->GetClientBounds();
// Match the default background color of content. Important on windows
// since we no longer use content child widgets.
mWindow->SetBackgroundColor(NS_RGB(255, 255, 255));
// Create web shell
RefPtr<BrowsingContext> openerContext =
aOpenerWindow
? nsPIDOMWindowOuter::From(aOpenerWindow)->GetBrowsingContext()
: nullptr;
RefPtr<BrowsingContext> browsingContext =
BrowsingContext::Create(/* aParent */ nullptr, openerContext,
EmptyString(), BrowsingContext::Type::Chrome);
mDocShell = nsDocShell::Create(browsingContext);
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
// XXX(nika): This is used to handle propagating opener across remote tab
// creation. We should come up with a better system for doing this (probably
// based on BrowsingContext).
mDocShell->SetOpener(aOpeningTab);
// Make sure to set the item type on the docshell _before_ calling
// Create() so it knows what type it is.
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(mDocShell);
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(EnsureChromeTreeOwner(), NS_ERROR_FAILURE);
docShellAsItem->SetTreeOwner(mChromeTreeOwner);
r.MoveTo(0, 0);
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
NS_ENSURE_SUCCESS(docShellAsWin->InitWindow(nullptr, mWindow, r.X(), r.Y(),
r.Width(), r.Height()),
NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(docShellAsWin->Create(), NS_ERROR_FAILURE);
// Attach a WebProgress listener.during initialization...
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mDocShell, &rv));
if (webProgress) {
webProgress->AddProgressListener(this,
nsIWebProgress::NOTIFY_STATE_NETWORK);
}
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
if (aOpenerWindow) {
BrowsingContext* bc = mDocShell->GetBrowsingContext();
BrowsingContext* openerBC =
nsPIDOMWindowOuter::From(aOpenerWindow)->GetBrowsingContext();
MOZ_DIAGNOSTIC_ASSERT(bc->GetOpenerId() == openerBC->Id());
MOZ_DIAGNOSTIC_ASSERT(bc->HadOriginalOpener());
}
#endif
// Eagerly create an about:blank content viewer with the right principal here,
// rather than letting it happening in the upcoming call to
// SetInitialPrincipalToSubject. This avoids creating the about:blank document
// and then blowing it away with a second one, which can cause problems for
// the top-level chrome window case. See bug 789773. Note that we don't accept
// expanded principals here, similar to SetInitialPrincipalToSubject.
if (nsContentUtils::IsInitialized()) { // Sometimes this happens really early
// See bug 793370.
MOZ_ASSERT(mDocShell->ItemType() == nsIDocShellTreeItem::typeChrome);
nsCOMPtr<nsIPrincipal> principal =
nsContentUtils::SubjectPrincipalOrSystemIfNativeCaller();
if (nsContentUtils::IsExpandedPrincipal(principal)) {
principal = nullptr;
}
// Use the subject (or system) principal as the storage principal too until
// the new window finishes navigating and gets a real storage principal.
rv = mDocShell->CreateAboutBlankContentViewer(principal, principal,
/* aCsp = */ nullptr);
NS_ENSURE_SUCCESS(rv, rv);
RefPtr<Document> doc = mDocShell->GetDocument();
NS_ENSURE_TRUE(!!doc, NS_ERROR_FAILURE);
doc->SetIsInitialDocument(true);
}
if (nullptr != aUrl) {
nsCString tmpStr;
rv = aUrl->GetSpec(tmpStr);
if (NS_FAILED(rv)) return rv;
NS_ConvertUTF8toUTF16 urlString(tmpStr);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
LoadURIOptions loadURIOptions;
loadURIOptions.mTriggeringPrincipal = nsContentUtils::GetSystemPrincipal();
rv = webNav->LoadURI(urlString, loadURIOptions);
NS_ENSURE_SUCCESS(rv, rv);
}
return rv;
}
PresShell* nsWebShellWindow::GetPresShell() {
if (!mDocShell) {
return nullptr;
}
return mDocShell->GetPresShell();
}
bool nsWebShellWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) {
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm) {
nsCOMPtr<nsPIDOMWindowOuter> window =
mDocShell ? mDocShell->GetWindow() : nullptr;
pm->AdjustPopupsOnWindowChange(window);
}
// Notify all tabs that the widget moved.
if (mDocShell && mDocShell->GetWindow()) {
nsCOMPtr<EventTarget> eventTarget =
mDocShell->GetWindow()->GetTopWindowRoot();
nsContentUtils::DispatchChromeEvent(mDocShell->GetDocument(), eventTarget,
NS_LITERAL_STRING("MozUpdateWindowPos"),
CanBubble::eNo, Cancelable::eNo,
nullptr);
}
// Persist position, but not immediately, in case this OS is firing
// repeated move events as the user drags the window
SetPersistenceTimer(PAD_POSITION);
return false;
}
bool nsWebShellWindow::WindowResized(nsIWidget* aWidget, int32_t aWidth,
int32_t aHeight) {
nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(mDocShell));
if (shellAsWin) {
shellAsWin->SetPositionAndSize(0, 0, aWidth, aHeight, 0);
}
// Persist size, but not immediately, in case this OS is firing
// repeated size events as the user drags the sizing handle
if (!IsLocked()) SetPersistenceTimer(PAD_POSITION | PAD_SIZE | PAD_MISC);
return true;
}
bool nsWebShellWindow::RequestWindowClose(nsIWidget* aWidget) {
// Maintain a reference to this as it is about to get destroyed.
nsCOMPtr<nsIXULWindow> xulWindow(this);
nsCOMPtr<nsPIDOMWindowOuter> window(mDocShell ? mDocShell->GetWindow()
: nullptr);
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(window);
RefPtr<PresShell> presShell = mDocShell->GetPresShell();
if (!presShell) {
mozilla::DebugOnly<bool> dying;
MOZ_ASSERT(NS_SUCCEEDED(mDocShell->IsBeingDestroyed(&dying)) && dying,
"No presShell, but window is not being destroyed");
} else if (eventTarget) {
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
nsEventStatus status = nsEventStatus_eIgnore;
WidgetMouseEvent event(true, eClose, nullptr, WidgetMouseEvent::eReal);
if (NS_SUCCEEDED(EventDispatcher::Dispatch(eventTarget, presContext, &event,
nullptr, &status)) &&
status == nsEventStatus_eConsumeNoDefault)
return false;
}
Destroy();
return false;
}
void nsWebShellWindow::SizeModeChanged(nsSizeMode sizeMode) {
// An alwaysRaised (or higher) window will hide any newly opened normal
// browser windows, so here we just drop a raised window to the normal
// zlevel if it's maximized. We make no provision for automatically
// re-raising it when restored.
if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen) {
uint32_t zLevel;
GetZLevel(&zLevel);
if (zLevel > nsIXULWindow::normalZ) SetZLevel(nsIXULWindow::normalZ);
}
mWindow->SetSizeMode(sizeMode);
// Persist mode, but not immediately, because in many (all?)
// cases this will merge with the similar call in NS_SIZE and
// write the attribute values only once.
SetPersistenceTimer(PAD_MISC);
nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
mDocShell ? mDocShell->GetWindow() : nullptr;
if (ourWindow) {
// Ensure that the fullscreen state is synchronized between
// the widget and the outer window object.
if (sizeMode == nsSizeMode_Fullscreen) {
ourWindow->SetFullScreen(true);
} else if (sizeMode != nsSizeMode_Minimized) {
if (ourWindow->GetFullScreen()) {
// The first SetFullscreenInternal call below ensures that we do
// not trigger any fullscreen transition even if the window was
// put in fullscreen only for the Fullscreen API. The second
// SetFullScreen call ensures that the window really exit from
// fullscreen even if it entered fullscreen for both Fullscreen
// Mode and Fullscreen API.
ourWindow->SetFullscreenInternal(
FullscreenReason::ForForceExitFullscreen, false);
ourWindow->SetFullScreen(false);
}
}
// And always fire a user-defined sizemodechange event on the window
ourWindow->DispatchCustomEvent(NS_LITERAL_STRING("sizemodechange"));
}
if (PresShell* presShell = GetPresShell()) {
presShell->GetPresContext()->SizeModeChanged(sizeMode);
}
// Note the current implementation of SetSizeMode just stores
// the new state; it doesn't actually resize. So here we store
// the state and pass the event on to the OS. The day is coming
// when we'll handle the event here, and the return result will
// then need to be different.
}
void nsWebShellWindow::UIResolutionChanged() {
nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
mDocShell ? mDocShell->GetWindow() : nullptr;
if (ourWindow) {
ourWindow->DispatchCustomEvent(NS_LITERAL_STRING("resolutionchange"));
}
}
void nsWebShellWindow::FullscreenWillChange(bool aInFullscreen) {
if (mDocShell) {
if (nsCOMPtr<nsPIDOMWindowOuter> ourWindow = mDocShell->GetWindow()) {
ourWindow->FullscreenWillChange(aInFullscreen);
}
}
}
void nsWebShellWindow::FullscreenChanged(bool aInFullscreen) {
if (mDocShell) {
if (nsCOMPtr<nsPIDOMWindowOuter> ourWindow = mDocShell->GetWindow()) {
ourWindow->FinishFullscreenChange(aInFullscreen);
}
}
}
void nsWebShellWindow::OcclusionStateChanged(bool aIsFullyOccluded) {
nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
mDocShell ? mDocShell->GetWindow() : nullptr;
if (ourWindow) {
// And always fire a user-defined occlusionstatechange event on the window
ourWindow->DispatchCustomEvent(NS_LITERAL_STRING("occlusionstatechange"));
}
}
void nsWebShellWindow::OSToolbarButtonPressed() {
// Keep a reference as setting the chrome flags can fire events.
nsCOMPtr<nsIXULWindow> xulWindow(this);
// rjc: don't use "nsIWebBrowserChrome::CHROME_EXTRA"
// due to components with multiple sidebar components
// (such as Mail/News, Addressbook, etc)... and frankly,
// Mac IE, OmniWeb, and other Mac OS X apps all work this way
uint32_t chromeMask = (nsIWebBrowserChrome::CHROME_TOOLBAR |
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR);
nsCOMPtr<nsIWebBrowserChrome> wbc(do_GetInterface(xulWindow));
if (!wbc) return;
uint32_t chromeFlags, newChromeFlags = 0;
wbc->GetChromeFlags(&chromeFlags);
newChromeFlags = chromeFlags & chromeMask;
if (!newChromeFlags)
chromeFlags |= chromeMask;
else
chromeFlags &= (~newChromeFlags);
wbc->SetChromeFlags(chromeFlags);
}
bool nsWebShellWindow::ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
nsIWidget* aRequestBelow,
nsIWidget** aActualBelow) {
if (aActualBelow) *aActualBelow = nullptr;
return ConstrainToZLevel(aImmediate, aPlacement, aRequestBelow, aActualBelow);
}
void nsWebShellWindow::WindowActivated() {
nsCOMPtr<nsIXULWindow> xulWindow(this);
// focusing the window could cause it to close, so keep a reference to it
nsCOMPtr<nsPIDOMWindowOuter> window =
mDocShell ? mDocShell->GetWindow() : nullptr;
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && window) fm->WindowRaised(window);
if (mChromeLoaded) {
PersistentAttributesDirty(PAD_POSITION | PAD_SIZE | PAD_MISC);
SavePersistentAttributes();
}
}
void nsWebShellWindow::WindowDeactivated() {
nsCOMPtr<nsIXULWindow> xulWindow(this);
nsCOMPtr<nsPIDOMWindowOuter> window =
mDocShell ? mDocShell->GetWindow() : nullptr;
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && window && !fm->IsTestMode()) fm->WindowLowered(window);
}
#ifdef USE_NATIVE_MENUS
static void LoadNativeMenus(Document* aDoc, nsIWidget* aParentWindow) {
if (gfxPlatform::IsHeadless()) {
return;
}
nsCOMPtr<nsINativeMenuService> nms =
do_GetService("@mozilla.org/widget/nativemenuservice;1");
if (!nms) {
return;
}
// Find the menubar tag (if there is more than one, we ignore all but
// the first).
nsCOMPtr<nsINodeList> menubarElements = aDoc->GetElementsByTagNameNS(
NS_LITERAL_STRING(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"),
NS_LITERAL_STRING("menubar"));
nsCOMPtr<nsINode> menubarNode;
if (menubarElements) {
menubarNode = menubarElements->Item(0);
}
if (menubarNode) {
nsCOMPtr<Element> menubarContent(do_QueryInterface(menubarNode));
nms->CreateNativeMenuBar(aParentWindow, menubarContent);
} else {
nms->CreateNativeMenuBar(aParentWindow, nullptr);
}
}
#endif
namespace mozilla {
class WebShellWindowTimerCallback final : public nsITimerCallback,
public nsINamed {
public:
explicit WebShellWindowTimerCallback(nsWebShellWindow* aWindow)
: mWindow(aWindow) {}
NS_DECL_THREADSAFE_ISUPPORTS
NS_IMETHOD Notify(nsITimer* aTimer) override {
// Although this object participates in a refcount cycle (this -> mWindow
// -> mSPTimer -> this), mSPTimer is a one-shot timer and releases this
// after it fires. So we don't need to release mWindow here.
mWindow->FirePersistenceTimer();
return NS_OK;
}
NS_IMETHOD GetName(nsACString& aName) override {
aName.AssignLiteral("WebShellWindowTimerCallback");
return NS_OK;
}
private:
~WebShellWindowTimerCallback() {}
RefPtr<nsWebShellWindow> mWindow;
};
NS_IMPL_ISUPPORTS(WebShellWindowTimerCallback, nsITimerCallback, nsINamed)
} // namespace mozilla
void nsWebShellWindow::SetPersistenceTimer(uint32_t aDirtyFlags) {
MutexAutoLock lock(mSPTimerLock);
if (!mSPTimer) {
mSPTimer = NS_NewTimer();
if (!mSPTimer) {
NS_WARNING("Couldn't create @mozilla.org/timer;1 instance?");
return;
}
}
RefPtr<WebShellWindowTimerCallback> callback =
new WebShellWindowTimerCallback(this);
mSPTimer->InitWithCallback(callback, SIZE_PERSISTENCE_TIMEOUT,
nsITimer::TYPE_ONE_SHOT);
PersistentAttributesDirty(aDirtyFlags);
}
void nsWebShellWindow::FirePersistenceTimer() {
MutexAutoLock lock(mSPTimerLock);
SavePersistentAttributes();
}
//----------------------------------------
// nsIWebProgessListener implementation
//----------------------------------------
NS_IMETHODIMP
nsWebShellWindow::OnProgressChange(nsIWebProgress* aProgress,
nsIRequest* aRequest,
int32_t aCurSelfProgress,
int32_t aMaxSelfProgress,
int32_t aCurTotalProgress,
int32_t aMaxTotalProgress) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
NS_IMETHODIMP
nsWebShellWindow::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
uint32_t aStateFlags, nsresult aStatus) {
// If the notification is not about a document finishing, then just
// ignore it...
if (!(aStateFlags & nsIWebProgressListener::STATE_STOP) ||
!(aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK)) {
return NS_OK;
}
if (mChromeLoaded) return NS_OK;
// If this document notification is for a frame then ignore it...
nsCOMPtr<mozIDOMWindowProxy> eventWin;
aProgress->GetDOMWindow(getter_AddRefs(eventWin));
auto* eventPWin = nsPIDOMWindowOuter::From(eventWin);
if (eventPWin) {
nsPIDOMWindowOuter* rootPWin = eventPWin->GetPrivateRoot();
if (eventPWin != rootPWin) return NS_OK;
}
mChromeLoaded = true;
mLockedUntilChromeLoad = false;
#ifdef USE_NATIVE_MENUS
///////////////////////////////
// Find the Menubar DOM and Load the menus, hooking them up to the loaded
// commands
///////////////////////////////
nsCOMPtr<nsIContentViewer> cv;
mDocShell->GetContentViewer(getter_AddRefs(cv));
if (cv) {
RefPtr<Document> menubarDoc = cv->GetDocument();
if (menubarDoc) LoadNativeMenus(menubarDoc, mWindow);
}
#endif // USE_NATIVE_MENUS
OnChromeLoaded();
return NS_OK;
}
NS_IMETHODIMP
nsWebShellWindow::OnLocationChange(nsIWebProgress* aProgress,
nsIRequest* aRequest, nsIURI* aURI,
uint32_t aFlags) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
NS_IMETHODIMP
nsWebShellWindow::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsresult aStatus,
const char16_t* aMessage) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
NS_IMETHODIMP
nsWebShellWindow::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aState) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
NS_IMETHODIMP
nsWebShellWindow::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
uint32_t aEvent) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
/**
* ExecuteCloseHandler - Run the close handler, if any.
* @return true iff we found a close handler to run.
*/
bool nsWebShellWindow::ExecuteCloseHandler() {
/* If the event handler closes this window -- a likely scenario --
things get deleted out of order without this death grip.
(The problem may be the death grip in nsWindow::windowProc,
which forces this window's widget to remain alive longer
than it otherwise would.) */
nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
nsCOMPtr<EventTarget> eventTarget;
if (mDocShell) {
eventTarget = do_QueryInterface(mDocShell->GetWindow());
}
if (eventTarget) {
nsCOMPtr<nsIContentViewer> contentViewer;
mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
if (contentViewer) {
RefPtr<nsPresContext> presContext = contentViewer->GetPresContext();
nsEventStatus status = nsEventStatus_eIgnore;
WidgetMouseEvent event(true, eClose, nullptr, WidgetMouseEvent::eReal);
nsresult rv = EventDispatcher::Dispatch(eventTarget, presContext, &event,
nullptr, &status);
if (NS_SUCCEEDED(rv) && status == nsEventStatus_eConsumeNoDefault)
return true;
// else fall through and return false
}
}
return false;
} // ExecuteCloseHandler
void nsWebShellWindow::ConstrainToOpenerScreen(int32_t* aX, int32_t* aY) {
if (mOpenerScreenRect.IsEmpty()) {
*aX = *aY = 0;
return;
}
int32_t left, top, width, height;
// Constrain initial positions to the same screen as opener
nsCOMPtr<nsIScreenManager> screenmgr =
do_GetService("@mozilla.org/gfx/screenmanager;1");
if (screenmgr) {
nsCOMPtr<nsIScreen> screen;
screenmgr->ScreenForRect(
mOpenerScreenRect.X(), mOpenerScreenRect.Y(), mOpenerScreenRect.Width(),
mOpenerScreenRect.Height(), getter_AddRefs(screen));
if (screen) {
screen->GetAvailRectDisplayPix(&left, &top, &width, &height);
if (*aX < left || *aX > left + width) {
*aX = left;
}
if (*aY < top || *aY > top + height) {
*aY = top;
}
}
}
}
// nsIBaseWindow
NS_IMETHODIMP nsWebShellWindow::Destroy() {
nsresult rv;
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mDocShell, &rv));
if (webProgress) {
webProgress->RemoveProgressListener(this);
}
nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
{
MutexAutoLock lock(mSPTimerLock);
if (mSPTimer) {
mSPTimer->Cancel();
SavePersistentAttributes();
mSPTimer = nullptr;
}
}
return nsXULWindow::Destroy();
}
nsIXULWindow* nsWebShellWindow::WidgetListenerDelegate::GetXULWindow() {
return mWebShellWindow->GetXULWindow();
}
PresShell* nsWebShellWindow::WidgetListenerDelegate::GetPresShell() {
return mWebShellWindow->GetPresShell();
}
bool nsWebShellWindow::WidgetListenerDelegate::WindowMoved(nsIWidget* aWidget,
int32_t aX,
int32_t aY) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->WindowMoved(aWidget, aX, aY);
}
bool nsWebShellWindow::WidgetListenerDelegate::WindowResized(nsIWidget* aWidget,
int32_t aWidth,
int32_t aHeight) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->WindowResized(aWidget, aWidth, aHeight);
}
bool nsWebShellWindow::WidgetListenerDelegate::RequestWindowClose(
nsIWidget* aWidget) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->RequestWindowClose(aWidget);
}
void nsWebShellWindow::WidgetListenerDelegate::SizeModeChanged(
nsSizeMode aSizeMode) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->SizeModeChanged(aSizeMode);
}
void nsWebShellWindow::WidgetListenerDelegate::UIResolutionChanged() {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->UIResolutionChanged();
}
void nsWebShellWindow::WidgetListenerDelegate::FullscreenWillChange(
bool aInFullscreen) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->FullscreenWillChange(aInFullscreen);
}
void nsWebShellWindow::WidgetListenerDelegate::FullscreenChanged(
bool aInFullscreen) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->FullscreenChanged(aInFullscreen);
}
void nsWebShellWindow::WidgetListenerDelegate::OcclusionStateChanged(
bool aIsFullyOccluded) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->OcclusionStateChanged(aIsFullyOccluded);
}
void nsWebShellWindow::WidgetListenerDelegate::OSToolbarButtonPressed() {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->OSToolbarButtonPressed();
}
bool nsWebShellWindow::WidgetListenerDelegate::ZLevelChanged(
bool aImmediate, nsWindowZ* aPlacement, nsIWidget* aRequestBelow,
nsIWidget** aActualBelow) {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->ZLevelChanged(aImmediate, aPlacement, aRequestBelow,
aActualBelow);
}
void nsWebShellWindow::WidgetListenerDelegate::WindowActivated() {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->WindowActivated();
}
void nsWebShellWindow::WidgetListenerDelegate::WindowDeactivated() {
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->WindowDeactivated();
}

Просмотреть файл

@ -0,0 +1,133 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsWebShellWindow_h__
#define nsWebShellWindow_h__
#include "mozilla/Mutex.h"
#include "nsIWebProgressListener.h"
#include "nsITimer.h"
#include "nsCOMPtr.h"
#include "nsXULWindow.h"
#include "nsIWidgetListener.h"
#include "nsIRemoteTab.h"
/* Forward declarations.... */
class nsIURI;
struct nsWidgetInitData;
namespace mozilla {
class PresShell;
class WebShellWindowTimerCallback;
} // namespace mozilla
class nsWebShellWindow final : public nsXULWindow,
public nsIWebProgressListener {
public:
// The implementation of non-refcounted nsIWidgetListener, which would hold a
// strong reference on stack before calling nsWebShellWindow's
// MOZ_CAN_RUN_SCRIPT methods.
class WidgetListenerDelegate : public nsIWidgetListener {
public:
explicit WidgetListenerDelegate(nsWebShellWindow* aWebShellWindow)
: mWebShellWindow(aWebShellWindow) {}
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual nsIXULWindow* GetXULWindow() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual mozilla::PresShell* GetPresShell() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth,
int32_t aHeight) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool RequestWindowClose(nsIWidget* aWidget) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void SizeModeChanged(nsSizeMode sizeMode) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void UIResolutionChanged() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void FullscreenWillChange(bool aInFullscreen) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void FullscreenChanged(bool aInFullscreen) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void OcclusionStateChanged(bool aIsFullyOccluded) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void OSToolbarButtonPressed() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
nsIWidget* aRequestBelow,
nsIWidget** aActualBelow) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void WindowActivated() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void WindowDeactivated() override;
private:
// The lifetime of WidgetListenerDelegate is bound to nsWebShellWindow so
// we just use a raw pointer here.
nsWebShellWindow* mWebShellWindow;
};
explicit nsWebShellWindow(uint32_t aChromeFlags);
// nsISupports interface...
NS_DECL_ISUPPORTS_INHERITED
// nsWebShellWindow methods...
nsresult Initialize(nsIXULWindow* aParent, nsIXULWindow* aOpener,
nsIURI* aUrl, int32_t aInitialWidth,
int32_t aInitialHeight, bool aIsHiddenWindow,
nsIRemoteTab* aOpeningTab,
mozIDOMWindowProxy* aOpenerWIndow,
nsWidgetInitData& widgetInitData);
nsresult Toolbar();
// nsIWebProgressListener
NS_DECL_NSIWEBPROGRESSLISTENER
// nsIBaseWindow
NS_IMETHOD Destroy() override;
// nsIWidgetListener methods for WidgetListenerDelegate.
nsIXULWindow* GetXULWindow() { return this; }
mozilla::PresShell* GetPresShell();
MOZ_CAN_RUN_SCRIPT
bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
MOZ_CAN_RUN_SCRIPT
bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight);
MOZ_CAN_RUN_SCRIPT bool RequestWindowClose(nsIWidget* aWidget);
MOZ_CAN_RUN_SCRIPT void SizeModeChanged(nsSizeMode aSizeMode);
MOZ_CAN_RUN_SCRIPT void UIResolutionChanged();
MOZ_CAN_RUN_SCRIPT void FullscreenWillChange(bool aInFullscreen);
MOZ_CAN_RUN_SCRIPT void FullscreenChanged(bool aInFullscreen);
MOZ_CAN_RUN_SCRIPT void OcclusionStateChanged(bool aIsFullyOccluded);
MOZ_CAN_RUN_SCRIPT void OSToolbarButtonPressed();
MOZ_CAN_RUN_SCRIPT
bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
nsIWidget* aRequestBelow, nsIWidget** aActualBelow);
MOZ_CAN_RUN_SCRIPT void WindowActivated();
MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
protected:
friend class mozilla::WebShellWindowTimerCallback;
virtual ~nsWebShellWindow();
bool ExecuteCloseHandler();
void ConstrainToOpenerScreen(int32_t* aX, int32_t* aY);
nsCOMPtr<nsITimer> mSPTimer;
mozilla::Mutex mSPTimerLock;
WidgetListenerDelegate mWidgetListenerDelegate;
void SetPersistenceTimer(uint32_t aDirtyFlags);
void FirePersistenceTimer();
};
#endif /* nsWebShellWindow_h__ */

Просмотреть файл

@ -21,12 +21,12 @@
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
using namespace mozilla; using namespace mozilla;
nsresult nsWindowMediator::GetDOMWindow( nsresult nsWindowMediator::GetDOMWindow(
nsIAppWindow* inWindow, nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow) { nsIXULWindow* inWindow, nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow) {
nsCOMPtr<nsIDocShell> docShell; nsCOMPtr<nsIDocShell> docShell;
outDOMWindow = nullptr; outDOMWindow = nullptr;
@ -61,7 +61,7 @@ nsresult nsWindowMediator::Init() {
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsWindowMediator::RegisterWindow(nsIAppWindow* inWindow) { NS_IMETHODIMP nsWindowMediator::RegisterWindow(nsIXULWindow* inWindow) {
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_STATE(mReady); NS_ENSURE_STATE(mReady);
@ -89,7 +89,7 @@ NS_IMETHODIMP nsWindowMediator::RegisterWindow(nsIAppWindow* inWindow) {
} }
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::UnregisterWindow(nsIAppWindow* inWindow) { nsWindowMediator::UnregisterWindow(nsIXULWindow* inWindow) {
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_STATE(mReady); NS_ENSURE_STATE(mReady);
nsWindowInfo* info = GetInfoFor(inWindow); nsWindowInfo* info = GetInfoFor(inWindow);
@ -105,7 +105,7 @@ nsresult nsWindowMediator::UnregisterWindow(nsWindowInfo* inInfo) {
index++; index++;
} }
nsIAppWindow* window = inInfo->mWindow.get(); nsIXULWindow* window = inInfo->mWindow.get();
ListenerArray::ForwardIterator iter(mListeners); ListenerArray::ForwardIterator iter(mListeners);
while (iter.HasMore()) { while (iter.HasMore()) {
iter.GetNext()->OnCloseWindow(window); iter.GetNext()->OnCloseWindow(window);
@ -122,7 +122,7 @@ nsresult nsWindowMediator::UnregisterWindow(nsWindowInfo* inInfo) {
return NS_OK; return NS_OK;
} }
nsWindowInfo* nsWindowMediator::GetInfoFor(nsIAppWindow* aWindow) { nsWindowInfo* nsWindowMediator::GetInfoFor(nsIXULWindow* aWindow) {
nsWindowInfo *info, *listEnd; nsWindowInfo *info, *listEnd;
if (!aWindow) return nullptr; if (!aWindow) return nullptr;
@ -170,20 +170,20 @@ nsWindowMediator::GetEnumerator(const char16_t* inType,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::GetAppWindowEnumerator(const char16_t* inType, nsWindowMediator::GetXULWindowEnumerator(const char16_t* inType,
nsISimpleEnumerator** outEnumerator) { nsISimpleEnumerator** outEnumerator) {
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_ARG_POINTER(outEnumerator); NS_ENSURE_ARG_POINTER(outEnumerator);
NS_ENSURE_STATE(mReady); NS_ENSURE_STATE(mReady);
RefPtr<nsAppShellWindowEnumerator> enumerator = RefPtr<nsAppShellWindowEnumerator> enumerator =
new nsASAppWindowEarlyToLateEnumerator(inType, *this); new nsASXULWindowEarlyToLateEnumerator(inType, *this);
enumerator.forget(outEnumerator); enumerator.forget(outEnumerator);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::GetZOrderAppWindowEnumerator(const char16_t* aWindowType, nsWindowMediator::GetZOrderXULWindowEnumerator(const char16_t* aWindowType,
bool aFrontToBack, bool aFrontToBack,
nsISimpleEnumerator** _retval) { nsISimpleEnumerator** _retval) {
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
@ -192,9 +192,9 @@ nsWindowMediator::GetZOrderAppWindowEnumerator(const char16_t* aWindowType,
RefPtr<nsAppShellWindowEnumerator> enumerator; RefPtr<nsAppShellWindowEnumerator> enumerator;
if (aFrontToBack) if (aFrontToBack)
enumerator = new nsASAppWindowFrontToBackEnumerator(aWindowType, *this); enumerator = new nsASXULWindowFrontToBackEnumerator(aWindowType, *this);
else else
enumerator = new nsASAppWindowBackToFrontEnumerator(aWindowType, *this); enumerator = new nsASXULWindowBackToFrontEnumerator(aWindowType, *this);
enumerator.forget(_retval); enumerator.forget(_retval);
return NS_OK; return NS_OK;
@ -344,7 +344,7 @@ nsWindowMediator::GetCurrentInnerWindowWithId(uint64_t aWindowID,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::UpdateWindowTimeStamp(nsIAppWindow* inWindow) { nsWindowMediator::UpdateWindowTimeStamp(nsIXULWindow* inWindow) {
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_STATE(mReady); NS_ENSURE_STATE(mReady);
nsWindowInfo* info = GetInfoFor(inWindow); nsWindowInfo* info = GetInfoFor(inWindow);
@ -363,7 +363,7 @@ nsWindowMediator::UpdateWindowTimeStamp(nsIAppWindow* inWindow) {
calculate a change as seldom as possible. calculate a change as seldom as possible.
*/ */
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::CalculateZPosition(nsIAppWindow* inWindow, nsWindowMediator::CalculateZPosition(nsIXULWindow* inWindow,
uint32_t inPosition, nsIWidget* inBelow, uint32_t inPosition, nsIWidget* inBelow,
uint32_t* outPosition, uint32_t* outPosition,
nsIWidget** outBelow, bool* outAltered) { nsIWidget** outBelow, bool* outAltered) {
@ -381,7 +381,7 @@ nsWindowMediator::CalculateZPosition(nsIAppWindow* inWindow,
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
nsWindowInfo* info = mTopmostWindow; nsWindowInfo* info = mTopmostWindow;
nsIAppWindow* belowWindow = nullptr; nsIXULWindow* belowWindow = nullptr;
bool found = false; bool found = false;
nsresult result = NS_OK; nsresult result = NS_OK;
@ -486,8 +486,8 @@ nsWindowMediator::CalculateZPosition(nsIAppWindow* inWindow,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::SetZPosition(nsIAppWindow* inWindow, uint32_t inPosition, nsWindowMediator::SetZPosition(nsIXULWindow* inWindow, uint32_t inPosition,
nsIAppWindow* inBelow) { nsIXULWindow* inBelow) {
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsWindowInfo *inInfo, *belowInfo; nsWindowInfo *inInfo, *belowInfo;
@ -539,9 +539,9 @@ nsWindowMediator::SetZPosition(nsIAppWindow* inWindow, uint32_t inPosition,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::GetZLevel(nsIAppWindow* aWindow, uint32_t* _retval) { nsWindowMediator::GetZLevel(nsIXULWindow* aWindow, uint32_t* _retval) {
NS_ENSURE_ARG_POINTER(_retval); NS_ENSURE_ARG_POINTER(_retval);
*_retval = nsIAppWindow::normalZ; *_retval = nsIXULWindow::normalZ;
// This can fail during window destruction. // This can fail during window destruction.
nsWindowInfo* info = GetInfoFor(aWindow); nsWindowInfo* info = GetInfoFor(aWindow);
if (info) { if (info) {
@ -551,7 +551,7 @@ nsWindowMediator::GetZLevel(nsIAppWindow* aWindow, uint32_t* _retval) {
} }
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMediator::SetZLevel(nsIAppWindow* aWindow, uint32_t aZLevel) { nsWindowMediator::SetZLevel(nsIXULWindow* aWindow, uint32_t aZLevel) {
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_STATE(mReady); NS_ENSURE_STATE(mReady);

Просмотреть файл

@ -15,10 +15,10 @@
#include "nsTObserverArray.h" #include "nsTObserverArray.h"
class nsAppShellWindowEnumerator; class nsAppShellWindowEnumerator;
class nsASAppWindowEarlyToLateEnumerator; class nsASXULWindowEarlyToLateEnumerator;
class nsASDOMWindowEarlyToLateEnumerator; class nsASDOMWindowEarlyToLateEnumerator;
class nsASAppWindowFrontToBackEnumerator; class nsASXULWindowFrontToBackEnumerator;
class nsASAppWindowBackToFrontEnumerator; class nsASXULWindowBackToFrontEnumerator;
class nsIWindowMediatorListener; class nsIWindowMediatorListener;
struct nsWindowInfo; struct nsWindowInfo;
@ -26,10 +26,10 @@ class nsWindowMediator : public nsIWindowMediator,
public nsIObserver, public nsIObserver,
public nsSupportsWeakReference { public nsSupportsWeakReference {
friend class nsAppShellWindowEnumerator; friend class nsAppShellWindowEnumerator;
friend class nsASAppWindowEarlyToLateEnumerator; friend class nsASXULWindowEarlyToLateEnumerator;
friend class nsASDOMWindowEarlyToLateEnumerator; friend class nsASDOMWindowEarlyToLateEnumerator;
friend class nsASAppWindowFrontToBackEnumerator; friend class nsASXULWindowFrontToBackEnumerator;
friend class nsASAppWindowBackToFrontEnumerator; friend class nsASXULWindowBackToFrontEnumerator;
protected: protected:
virtual ~nsWindowMediator(); virtual ~nsWindowMediator();
@ -43,7 +43,7 @@ class nsWindowMediator : public nsIWindowMediator,
NS_DECL_NSIWINDOWMEDIATOR NS_DECL_NSIWINDOWMEDIATOR
NS_DECL_NSIOBSERVER NS_DECL_NSIOBSERVER
static nsresult GetDOMWindow(nsIAppWindow* inWindow, static nsresult GetDOMWindow(nsIXULWindow* inWindow,
nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow); nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow);
private: private:
@ -53,7 +53,7 @@ class nsWindowMediator : public nsIWindowMediator,
bool aSkipPrivateBrowsingOrClosed = false); bool aSkipPrivateBrowsingOrClosed = false);
nsresult UnregisterWindow(nsWindowInfo* inInfo); nsresult UnregisterWindow(nsWindowInfo* inInfo);
nsWindowInfo* GetInfoFor(nsIAppWindow* aWindow); nsWindowInfo* GetInfoFor(nsIXULWindow* aWindow);
nsWindowInfo* GetInfoFor(nsIWidget* aWindow); nsWindowInfo* GetInfoFor(nsIWidget* aWindow);
void SortZOrderFrontToBack(); void SortZOrderFrontToBack();
void SortZOrderBackToFront(); void SortZOrderBackToFront();

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -4,8 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_AppWindow_h__ #ifndef nsXULWindow_h__
#define mozilla_AppWindow_h__ #define nsXULWindow_h__
// Local Includes // Local Includes
#include "nsChromeTreeOwner.h" #include "nsChromeTreeOwner.h"
@ -19,7 +19,6 @@
#include "nsCOMArray.h" #include "nsCOMArray.h"
#include "nsRect.h" #include "nsRect.h"
#include "Units.h" #include "Units.h"
#include "mozilla/Mutex.h"
// Interfaces needed // Interfaces needed
#include "nsIBaseWindow.h" #include "nsIBaseWindow.h"
@ -27,14 +26,12 @@
#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeItem.h"
#include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIAppWindow.h" #include "nsIXULWindow.h"
#include "nsIPrompt.h" #include "nsIPrompt.h"
#include "nsIAuthPrompt.h" #include "nsIAuthPrompt.h"
#include "nsIXULBrowserWindow.h" #include "nsIXULBrowserWindow.h"
#include "nsIWidgetListener.h" #include "nsIWidgetListener.h"
#include "nsIRemoteTab.h" #include "nsIRemoteTab.h"
#include "nsIWebProgressListener.h"
#include "nsITimer.h"
#ifndef MOZ_NEW_XULSTORE #ifndef MOZ_NEW_XULSTORE
# include "nsIXULStore.h" # include "nsIXULStore.h"
@ -48,16 +45,10 @@ class Element;
class nsAtom; class nsAtom;
class nsXULTooltipListener; class nsXULTooltipListener;
struct nsWidgetInitData;
namespace mozilla { // nsXULWindow
class PresShell;
class AppWindowTimerCallback;
} // namespace mozilla
// AppWindow #define NS_XULWINDOW_IMPL_CID \
#define NS_APPWINDOW_IMPL_CID \
{ /* 8eaec2f3-ed02-4be2-8e0f-342798477298 */ \ { /* 8eaec2f3-ed02-4be2-8e0f-342798477298 */ \
0x8eaec2f3, 0xed02, 0x4be2, { \ 0x8eaec2f3, 0xed02, 0x4be2, { \
0x8e, 0x0f, 0x34, 0x27, 0x98, 0x47, 0x72, 0x98 \ 0x8e, 0x0f, 0x34, 0x27, 0x98, 0x47, 0x72, 0x98 \
@ -66,111 +57,27 @@ class AppWindowTimerCallback;
class nsContentShellInfo; class nsContentShellInfo;
namespace mozilla { class nsXULWindow : public nsIBaseWindow,
public nsIInterfaceRequestor,
class AppWindow final : public nsIBaseWindow, public nsIXULWindow,
public nsIInterfaceRequestor, public nsSupportsWeakReference {
public nsIAppWindow, friend class nsChromeTreeOwner;
public nsSupportsWeakReference, friend class nsContentTreeOwner;
public nsIWebProgressListener {
friend class ::nsChromeTreeOwner;
friend class ::nsContentTreeOwner;
public: public:
// The implementation of non-refcounted nsIWidgetListener, which would hold a
// strong reference on stack before calling AppWindow's
// MOZ_CAN_RUN_SCRIPT methods.
class WidgetListenerDelegate : public nsIWidgetListener {
public:
explicit WidgetListenerDelegate(AppWindow* aAppWindow)
: mAppWindow(aAppWindow) {}
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual nsIAppWindow* GetAppWindow() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual mozilla::PresShell* GetPresShell() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth,
int32_t aHeight) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool RequestWindowClose(nsIWidget* aWidget) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void SizeModeChanged(nsSizeMode sizeMode) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void UIResolutionChanged() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void FullscreenWillChange(bool aInFullscreen) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void FullscreenChanged(bool aInFullscreen) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void OcclusionStateChanged(bool aIsFullyOccluded) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void OSToolbarButtonPressed() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
nsIWidget* aRequestBelow,
nsIWidget** aActualBelow) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void WindowActivated() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void WindowDeactivated() override;
private:
// The lifetime of WidgetListenerDelegate is bound to AppWindow so
// we just use a raw pointer here.
AppWindow* mAppWindow;
};
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIAPPWINDOW NS_DECL_NSIXULWINDOW
NS_DECL_NSIBASEWINDOW NS_DECL_NSIBASEWINDOW
NS_DECLARE_STATIC_IID_ACCESSOR(NS_APPWINDOW_IMPL_CID) NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULWINDOW_IMPL_CID)
void LockUntilChromeLoad() { mLockedUntilChromeLoad = true; } void LockUntilChromeLoad() { mLockedUntilChromeLoad = true; }
bool IsLocked() const { return mLockedUntilChromeLoad; } bool IsLocked() const { return mLockedUntilChromeLoad; }
void IgnoreXULSizeMode(bool aEnable) { mIgnoreXULSizeMode = aEnable; } void IgnoreXULSizeMode(bool aEnable) { mIgnoreXULSizeMode = aEnable; }
void WasRegistered() { mRegistered = true; } void WasRegistered() { mRegistered = true; }
// AppWindow methods...
nsresult Initialize(nsIAppWindow* aParent, nsIAppWindow* aOpener,
nsIURI* aUrl, int32_t aInitialWidth,
int32_t aInitialHeight, bool aIsHiddenWindow,
nsIRemoteTab* aOpeningTab,
mozIDOMWindowProxy* aOpenerWIndow,
nsWidgetInitData& widgetInitData);
nsresult Toolbar();
// nsIWebProgressListener
NS_DECL_NSIWEBPROGRESSLISTENER
// nsIWidgetListener methods for WidgetListenerDelegate.
nsIAppWindow* GetAppWindow() { return this; }
mozilla::PresShell* GetPresShell();
MOZ_CAN_RUN_SCRIPT
bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
MOZ_CAN_RUN_SCRIPT
bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight);
MOZ_CAN_RUN_SCRIPT bool RequestWindowClose(nsIWidget* aWidget);
MOZ_CAN_RUN_SCRIPT void SizeModeChanged(nsSizeMode aSizeMode);
MOZ_CAN_RUN_SCRIPT void UIResolutionChanged();
MOZ_CAN_RUN_SCRIPT void FullscreenWillChange(bool aInFullscreen);
MOZ_CAN_RUN_SCRIPT void FullscreenChanged(bool aInFullscreen);
MOZ_CAN_RUN_SCRIPT void OcclusionStateChanged(bool aIsFullyOccluded);
MOZ_CAN_RUN_SCRIPT void OSToolbarButtonPressed();
MOZ_CAN_RUN_SCRIPT
bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
nsIWidget* aRequestBelow, nsIWidget** aActualBelow);
MOZ_CAN_RUN_SCRIPT void WindowActivated();
MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
explicit AppWindow(uint32_t aChromeFlags);
protected: protected:
enum persistentAttributes { enum persistentAttributes {
PAD_MISC = 0x1, PAD_MISC = 0x1,
@ -178,15 +85,8 @@ class AppWindow final : public nsIBaseWindow,
PAD_SIZE = 0x4 PAD_SIZE = 0x4
}; };
virtual ~AppWindow(); explicit nsXULWindow(uint32_t aChromeFlags);
virtual ~nsXULWindow();
friend class mozilla::AppWindowTimerCallback;
bool ExecuteCloseHandler();
void ConstrainToOpenerScreen(int32_t* aX, int32_t* aY);
void SetPersistenceTimer(uint32_t aDirtyFlags);
void FirePersistenceTimer();
NS_IMETHOD EnsureChromeTreeOwner(); NS_IMETHOD EnsureChromeTreeOwner();
NS_IMETHOD EnsureContentTreeOwner(); NS_IMETHOD EnsureContentTreeOwner();
@ -229,19 +129,19 @@ class AppWindow final : public nsIBaseWindow,
NS_IMETHOD CreateNewChromeWindow(int32_t aChromeFlags, NS_IMETHOD CreateNewChromeWindow(int32_t aChromeFlags,
nsIRemoteTab* aOpeningTab, nsIRemoteTab* aOpeningTab,
mozIDOMWindowProxy* aOpenerWindow, mozIDOMWindowProxy* aOpenerWindow,
nsIAppWindow** _retval); nsIXULWindow** _retval);
NS_IMETHOD CreateNewContentWindow(int32_t aChromeFlags, NS_IMETHOD CreateNewContentWindow(int32_t aChromeFlags,
nsIRemoteTab* aOpeningTab, nsIRemoteTab* aOpeningTab,
mozIDOMWindowProxy* aOpenerWindow, mozIDOMWindowProxy* aOpenerWindow,
uint64_t aNextRemoteTabId, uint64_t aNextRemoteTabId,
nsIAppWindow** _retval); nsIXULWindow** _retval);
NS_IMETHOD GetHasPrimaryContent(bool* aResult); NS_IMETHOD GetHasPrimaryContent(bool* aResult);
void EnableParent(bool aEnable); void EnableParent(bool aEnable);
bool ConstrainToZLevel(bool aImmediate, nsWindowZ* aPlacement, bool ConstrainToZLevel(bool aImmediate, nsWindowZ* aPlacement,
nsIWidget* aReqBelow, nsIWidget** aActualBelow); nsIWidget* aReqBelow, nsIWidget** aActualBelow);
void PlaceWindowLayersBehind(uint32_t aLowLevel, uint32_t aHighLevel, void PlaceWindowLayersBehind(uint32_t aLowLevel, uint32_t aHighLevel,
nsIAppWindow* aBehind); nsIXULWindow* aBehind);
void SetContentScrollbarVisibility(bool aVisible); void SetContentScrollbarVisibility(bool aVisible);
bool GetContentScrollbarVisibility(); bool GetContentScrollbarVisibility();
void PersistentAttributesDirty(uint32_t aDirtyFlags); void PersistentAttributesDirty(uint32_t aDirtyFlags);
@ -289,10 +189,6 @@ class AppWindow final : public nsIBaseWindow,
nsCOMPtr<nsIRemoteTab> mPrimaryBrowserParent; nsCOMPtr<nsIRemoteTab> mPrimaryBrowserParent;
nsCOMPtr<nsITimer> mSPTimer;
mozilla::Mutex mSPTimerLock;
WidgetListenerDelegate mWidgetListenerDelegate;
private: private:
// GetPrimaryBrowserParentSize is called from xpidl methods and we don't have // GetPrimaryBrowserParentSize is called from xpidl methods and we don't have
// a good way to annotate those with MOZ_CAN_RUN_SCRIPT yet. It takes no // a good way to annotate those with MOZ_CAN_RUN_SCRIPT yet. It takes no
@ -306,8 +202,5 @@ class AppWindow final : public nsIBaseWindow,
#endif #endif
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(AppWindow, NS_APPWINDOW_IMPL_CID) NS_DEFINE_STATIC_IID_ACCESSOR(nsXULWindow, NS_XULWINDOW_IMPL_CID)
#endif /* nsXULWindow_h__ */
} // namespace mozilla
#endif /* mozilla_AppWindow_h__ */