Bug 1555850 - Get rid of nsIWindowCreator2, r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D33232
This commit is contained in:
@@ -224,8 +224,8 @@ nsresult nsAppStartup::Init() {
|
||||
// nsAppStartup->nsISupports
|
||||
//
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAppStartup, nsIAppStartup, nsIWindowCreator,
|
||||
nsIWindowCreator2, nsIObserver, nsISupportsWeakReference)
|
||||
NS_IMPL_ISUPPORTS(nsAppStartup, nsIAppStartup, nsIWindowCreator, nsIObserver,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
//
|
||||
// nsAppStartup->nsIAppStartup
|
||||
@@ -585,34 +585,10 @@ nsAppStartup::GetInterrupted(bool* aInterrupted) {
|
||||
NS_IMETHODIMP
|
||||
nsAppStartup::CreateChromeWindow(nsIWebBrowserChrome* aParent,
|
||||
uint32_t aChromeFlags,
|
||||
nsIRemoteTab* aOpeningTab,
|
||||
mozIDOMWindowProxy* aOpener,
|
||||
uint64_t aNextRemoteTabId, bool* aCancel,
|
||||
nsIWebBrowserChrome** _retval) {
|
||||
bool cancel;
|
||||
return CreateChromeWindow2(aParent, aChromeFlags, nullptr, nullptr, 0,
|
||||
&cancel, _retval);
|
||||
}
|
||||
|
||||
//
|
||||
// nsAppStartup->nsIWindowCreator2
|
||||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppStartup::SetScreenId(uint32_t aScreenId) {
|
||||
nsCOMPtr<nsIAppShellService> appShell(
|
||||
do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
|
||||
if (!appShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return appShell->SetScreenId(aScreenId);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppStartup::CreateChromeWindow2(nsIWebBrowserChrome* aParent,
|
||||
uint32_t aChromeFlags,
|
||||
nsIRemoteTab* aOpeningTab,
|
||||
mozIDOMWindowProxy* aOpener,
|
||||
uint64_t aNextRemoteTabId, bool* aCancel,
|
||||
nsIWebBrowserChrome** _retval) {
|
||||
NS_ENSURE_ARG_POINTER(aCancel);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*aCancel = false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define nsAppStartup_h__
|
||||
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIWindowCreator2.h"
|
||||
#include "nsIWindowCreator.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
@@ -30,14 +30,13 @@
|
||||
}
|
||||
|
||||
class nsAppStartup final : public nsIAppStartup,
|
||||
public nsIWindowCreator2,
|
||||
public nsIWindowCreator,
|
||||
public nsIObserver,
|
||||
public nsSupportsWeakReference {
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIAPPSTARTUP
|
||||
NS_DECL_NSIWINDOWCREATOR
|
||||
NS_DECL_NSIWINDOWCREATOR2
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
nsAppStartup();
|
||||
|
||||
@@ -14,7 +14,6 @@ if CONFIG['ENABLE_TESTS']:
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIWindowCreator.idl',
|
||||
'nsIWindowCreator2.idl',
|
||||
'nsIWindowProvider.idl',
|
||||
]
|
||||
|
||||
|
||||
@@ -9,27 +9,45 @@
|
||||
* new browser windows. The application, either Mozilla or an embedding app,
|
||||
* must provide an implementation of the Window Watcher component and
|
||||
* notify the WindowWatcher during application initialization.
|
||||
*
|
||||
* @see nsIWindowWatcher
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIRemoteTab;
|
||||
interface nsIURI;
|
||||
interface nsIWebBrowserChrome;
|
||||
interface mozIDOMWindowProxy;
|
||||
|
||||
[scriptable, uuid(30465632-A777-44cc-90F9-8145475EF999)]
|
||||
interface nsIWindowCreator : nsISupports {
|
||||
|
||||
/** Create a new window. Gecko will/may call this method, if made
|
||||
available to it, to create new windows.
|
||||
@param parent parent window, if any. null if not. the newly created
|
||||
@param parent Parent window, if any. Null if not. The newly created
|
||||
window should be made a child/dependent window of
|
||||
the parent, if any (and if the concept applies
|
||||
to the underlying OS).
|
||||
@param chromeFlags chrome features from nsIWebBrowserChrome
|
||||
@return the new window
|
||||
@param chromeFlags Chrome features from nsIWebBrowserChrome
|
||||
@param aOpeningTab The RemoteTab that is trying to open this new chrome
|
||||
window. Can be nullptr.
|
||||
@param aOpener The window which is trying to open this new chrome window.
|
||||
Can be nullptr
|
||||
@param aNextRemoteTabId The integer ID of the next remote tab actor to use.
|
||||
0 means there is no next remote tab ID to use.
|
||||
@param cancel Return |true| to reject window creation. If true the
|
||||
implementation has determined the window should not
|
||||
be created at all. The caller should not default
|
||||
to any possible backup scheme for creating the window.
|
||||
@return the new window. Will be null if canceled or an error occurred.
|
||||
*/
|
||||
nsIWebBrowserChrome createChromeWindow(in nsIWebBrowserChrome parent,
|
||||
in uint32_t chromeFlags);
|
||||
in uint32_t chromeFlags,
|
||||
in nsIRemoteTab aOpeningTab,
|
||||
in mozIDOMWindowProxy aOpener,
|
||||
in unsigned long long aNextRemoteTabId,
|
||||
out boolean cancel);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
/**
|
||||
* nsIWindowCreator2 is an extension of nsIWindowCreator which allows
|
||||
* additional information about the context of the window creation to
|
||||
* be passed.
|
||||
*
|
||||
* @see nsIWindowCreator
|
||||
* @see nsIWindowWatcher
|
||||
*
|
||||
* @status
|
||||
*/
|
||||
|
||||
#include "nsIWindowCreator.idl"
|
||||
|
||||
interface nsIRemoteTab;
|
||||
interface nsIURI;
|
||||
interface nsIWebBrowserChrome;
|
||||
interface mozIDOMWindowProxy;
|
||||
|
||||
[scriptable, uuid(b6c44689-f97e-4f32-a723-29eeddfbdc53)]
|
||||
interface nsIWindowCreator2 : nsIWindowCreator {
|
||||
|
||||
/** Create a new window. Gecko will/may call this method, if made
|
||||
available to it, to create new windows.
|
||||
@param parent Parent window, if any. Null if not. The newly created
|
||||
window should be made a child/dependent window of
|
||||
the parent, if any (and if the concept applies
|
||||
to the underlying OS).
|
||||
@param chromeFlags Chrome features from nsIWebBrowserChrome
|
||||
@param aOpeningTab The RemoteTab that is trying to open this new chrome
|
||||
window. Can be nullptr.
|
||||
@param aOpener The window which is trying to open this new chrome window.
|
||||
Can be nullptr
|
||||
@param aNextRemoteTabId The integer ID of the next remote tab actor to use.
|
||||
0 means there is no next remote tab ID to use.
|
||||
@param cancel Return |true| to reject window creation. If true the
|
||||
implementation has determined the window should not
|
||||
be created at all. The caller should not default
|
||||
to any possible backup scheme for creating the window.
|
||||
@return the new window. Will be null if canceled or an error occurred.
|
||||
*/
|
||||
nsIWebBrowserChrome createChromeWindow2(in nsIWebBrowserChrome parent,
|
||||
in uint32_t chromeFlags,
|
||||
in nsIRemoteTab aOpeningTab,
|
||||
in mozIDOMWindowProxy aOpener,
|
||||
in unsigned long long aNextRemoteTabId,
|
||||
out boolean cancel);
|
||||
|
||||
/**
|
||||
* B2G multi-screen support. When open another top-level window on b2g,
|
||||
* a screen ID is needed for identifying which screen this window is
|
||||
* opened to.
|
||||
* @param aScreenId Differentiate screens of windows. It is platform-
|
||||
* specific due to the hardware limitation for now.
|
||||
*/
|
||||
[noscript]
|
||||
void setScreenId(in uint32_t aScreenId);
|
||||
};
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIWindowCreator.h"
|
||||
#include "nsIWindowCreator2.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@@ -404,14 +403,13 @@ nsresult nsWindowWatcher::CreateChromeWindow(
|
||||
uint32_t aChromeFlags, nsIRemoteTab* aOpeningBrowserParent,
|
||||
mozIDOMWindowProxy* aOpener, uint64_t aNextRemoteTabId,
|
||||
nsIWebBrowserChrome** aResult) {
|
||||
nsCOMPtr<nsIWindowCreator2> windowCreator2(do_QueryInterface(mWindowCreator));
|
||||
if (NS_WARN_IF(!windowCreator2)) {
|
||||
if (NS_WARN_IF(!mWindowCreator)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
bool cancel = false;
|
||||
nsCOMPtr<nsIWebBrowserChrome> newWindowChrome;
|
||||
nsresult rv = windowCreator2->CreateChromeWindow2(
|
||||
nsresult rv = mWindowCreator->CreateChromeWindow(
|
||||
aParentChrome, aChromeFlags, aOpeningBrowserParent, aOpener,
|
||||
aNextRemoteTabId, &cancel, getter_AddRefs(newWindowChrome));
|
||||
|
||||
@@ -508,8 +506,7 @@ nsWindowWatcher::OpenWindowWithRemoteTab(
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWindowCreator2> windowCreator2(do_QueryInterface(mWindowCreator));
|
||||
if (NS_WARN_IF(!windowCreator2)) {
|
||||
if (NS_WARN_IF(!mWindowCreator)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
@@ -865,24 +862,15 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
||||
parentTopInnerWindow->Suspend();
|
||||
}
|
||||
|
||||
/* If the window creator is an nsIWindowCreator2, we can give it
|
||||
some hints. The only hint at this time is whether the opening window
|
||||
is in a situation that's likely to mean this is an unrequested
|
||||
popup window we're creating. However we're not completely honest:
|
||||
we clear that indicator if the opener is chrome, so that the
|
||||
downstream consumer can treat the indicator to mean simply
|
||||
/* We can give the window creator some hints. The only hint at this time
|
||||
is whether the opening window is in a situation that's likely to mean
|
||||
this is an unrequested popup window we're creating. However we're not
|
||||
completely honest: we clear that indicator if the opener is chrome, so
|
||||
that the downstream consumer can treat the indicator to mean simply
|
||||
that the new window is subject to popup control. */
|
||||
nsCOMPtr<nsIWindowCreator2> windowCreator2(
|
||||
do_QueryInterface(mWindowCreator));
|
||||
if (windowCreator2) {
|
||||
mozIDOMWindowProxy* openerWindow = aForceNoOpener ? nullptr : aParent;
|
||||
rv = CreateChromeWindow(features, parentChrome, chromeFlags, nullptr,
|
||||
openerWindow, 0, getter_AddRefs(newChrome));
|
||||
|
||||
} else {
|
||||
rv = mWindowCreator->CreateChromeWindow(parentChrome, chromeFlags,
|
||||
getter_AddRefs(newChrome));
|
||||
}
|
||||
mozIDOMWindowProxy* openerWindow = aForceNoOpener ? nullptr : aParent;
|
||||
rv = CreateChromeWindow(features, parentChrome, chromeFlags, nullptr,
|
||||
openerWindow, 0, getter_AddRefs(newChrome));
|
||||
|
||||
if (parentTopInnerWindow) {
|
||||
parentTopInnerWindow->Resume();
|
||||
|
||||
Reference in New Issue
Block a user