/* -*- 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/. */
// Remove from the lists and free up if (inInfo == mOldestWindow) mOldestWindow = inInfo->mYounger; if (inInfo == mTopmostWindow) mTopmostWindow = inInfo->mLower;
inInfo->Unlink(true, true); if (inInfo == mOldestWindow) mOldestWindow = nullptr; if (inInfo == mTopmostWindow) mTopmostWindow = nullptr; delete inInfo;
nsCOMPtr<nsIWidget> scanWidget; while (info != listEnd) {
nsCOMPtr<nsIBaseWindow> base(do_QueryInterface(info->mWindow)); if (base) base->GetMainWidget(getter_AddRefs(scanWidget)); if (aWindow == scanWidget.get()) return info;
info = info->mYounger;
listEnd = mOldestWindow;
} return nullptr;
}
NS_IMETHODIMP
nsWindowMediator::GetEnumerator(const char16_t* inType,
nsISimpleEnumerator** outEnumerator) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_ARG_POINTER(outEnumerator); if (!mReady) { // If we get here with mReady false, we most likely did observe // xpcom-shutdown. We will return an empty enumerator such that // we make happy Javascripts calling late without throwing. return NS_NewEmptyEnumerator(outEnumerator);
}
RefPtr<nsAppShellWindowEnumerator> enumerator = new nsASDOMWindowEarlyToLateEnumerator(inType, *this);
enumerator.forget(outEnumerator); return NS_OK;
}
NS_IMETHODIMP
nsWindowMediator::GetAppWindowEnumerator(const char16_t* inType,
nsISimpleEnumerator** outEnumerator) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_ARG_POINTER(outEnumerator); if (!mReady) { // If we get here with mReady false, we most likely did observe // xpcom-shutdown. We will return an empty enumerator such that // we make happy Javascripts calling late without throwing. return NS_NewEmptyEnumerator(outEnumerator);
}
RefPtr<nsAppShellWindowEnumerator> enumerator = new nsASAppWindowEarlyToLateEnumerator(inType, *this);
enumerator.forget(outEnumerator); return NS_OK;
}
NS_IMETHODIMP
nsWindowMediator::GetZOrderAppWindowEnumerator(const char16_t* aWindowType, bool aFrontToBack,
nsISimpleEnumerator** _retval) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_ARG_POINTER(_retval); if (!mReady) { // If we get here with mReady false, we most likely did observe // xpcom-shutdown. We will return an empty enumerator such that // we make happy Javascripts calling late without throwing. return NS_NewEmptyEnumerator(_retval);
}
RefPtr<nsAppShellWindowEnumerator> enumerator; if (aFrontToBack)
enumerator = new nsASAppWindowFrontToBackEnumerator(aWindowType, *this); else
enumerator = new nsASAppWindowBackToFrontEnumerator(aWindowType, *this);
// Returns the window of type inType ( if null return any window type ) which // has the most recent time stamp
NS_IMETHODIMP
nsWindowMediator::GetMostRecentWindow(const char16_t* inType,
mozIDOMWindowProxy** outWindow) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_ARG_POINTER(outWindow);
*outWindow = nullptr; if (!mReady) return NS_OK;
// Find the most window with the highest time stamp that matches // the requested type
nsWindowInfo* info = MostRecentWindowInfo(inType, false); if (info && info->mWindow) {
nsCOMPtr<nsPIDOMWindowOuter> DOMWindow; if (NS_SUCCEEDED(GetDOMWindow(info->mWindow, DOMWindow))) {
DOMWindow.forget(outWindow); return NS_OK;
} return NS_ERROR_FAILURE;
}
// Find the most recent window with the highest time stamp that matches // the requested type and has the correct browsing mode.
nsWindowInfo* searchInfo = mOldestWindow;
nsWindowInfo* listEnd = nullptr;
nsWindowInfo* foundInfo = nullptr; for (; searchInfo != listEnd; searchInfo = searchInfo->mYounger) {
listEnd = mOldestWindow;
if (!allWindows && !searchInfo->TypeEquals(typeString)) { continue;
} if (searchInfo->mTimeStamp < lastTimeStamp) { continue;
} if (!searchInfo->mWindow) { continue;
} if (aSkipPrivateBrowsingOrClosed) {
nsCOMPtr<nsIDocShell> docShell;
searchInfo->mWindow->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell); if (!loadContext || loadContext->UsePrivateBrowsing()) { continue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.