forked from mirrors/gecko-dev
Bug 1514360 - Add nsIWindowMediator.getMostRecentBrowserWindow() r=Ehsan
We currently don't use 'navigator:browser' for GeckoView windows because we need an easy way to disambiguate from Fennec windows. Instead, we use 'navigator:geckoview' for those windows. This adds a method that falls back to that automatically, useful in cases where you want it to work on both Desktop/Fennec and GeckoView. Differential Revision: https://phabricator.services.mozilla.com/D14613 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c03f25ec80
commit
6314eb8c80
2 changed files with 22 additions and 0 deletions
|
|
@ -66,6 +66,13 @@ interface nsIWindowMediator: nsISupports
|
||||||
*/
|
*/
|
||||||
mozIDOMWindowProxy getMostRecentWindow(in wstring aWindowType);
|
mozIDOMWindowProxy getMostRecentWindow(in wstring aWindowType);
|
||||||
|
|
||||||
|
/** This is a shortcut for getMostRecentWindow('navigator:browser'), but
|
||||||
|
* it also tries 'navigator:geckoview' if that fails.
|
||||||
|
*
|
||||||
|
* @return the topmost browser window
|
||||||
|
*/
|
||||||
|
mozIDOMWindowProxy getMostRecentBrowserWindow();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as getMostRecentWindow, but ignores private browsing
|
* Same as getMostRecentWindow, but ignores private browsing
|
||||||
* windows.
|
* windows.
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,21 @@ nsWindowMediator::GetMostRecentWindow(const char16_t* inType,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsWindowMediator::GetMostRecentBrowserWindow(mozIDOMWindowProxy** outWindow) {
|
||||||
|
nsresult rv = GetMostRecentWindow(u"navigator:browser", outWindow);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
|
if (!*outWindow) {
|
||||||
|
rv = GetMostRecentWindow(u"navigator:geckoview", outWindow);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWindowMediator::GetMostRecentNonPBWindow(const char16_t* aType,
|
nsWindowMediator::GetMostRecentNonPBWindow(const char16_t* aType,
|
||||||
mozIDOMWindowProxy** aWindow) {
|
mozIDOMWindowProxy** aWindow) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue