зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
c03f25ec80
Коммит
6314eb8c80
|
@ -66,6 +66,13 @@ interface nsIWindowMediator: nsISupports
|
|||
*/
|
||||
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
|
||||
* windows.
|
||||
|
|
|
@ -236,6 +236,21 @@ nsWindowMediator::GetMostRecentWindow(const char16_t* inType,
|
|||
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
|
||||
nsWindowMediator::GetMostRecentNonPBWindow(const char16_t* aType,
|
||||
mozIDOMWindowProxy** aWindow) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче