add url of window to be opened to nsIWindowCreator2::CreateChromeWindow2. bug 195992 r=adamlock,blizzard

This commit is contained in:
danm%netscape.com 2003-04-08 20:47:18 +00:00
Родитель f5841229f3
Коммит 4743b6ee88
5 изменённых файлов: 39 добавлений и 13 удалений

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

@ -32,6 +32,7 @@
#include "nsIWindowCreator.idl"
interface nsIURI;
interface nsIWebBrowserChrome;
// This interface is not generally scriptable: only the const(s)
@ -49,16 +50,27 @@ 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
@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 contextFlags flags about the context of the window being created.
@return the new window
@param chromeFlags Chrome features from nsIWebBrowserChrome
@param contextFlags Flags about the context of the window being created.
@param uri The URL for which this window is intended. It can be null
or zero-length. The implementation of this interface
may use the URL to help determine what sort of window
to open or whether to cancel window creation. It will not
load the URL.
@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.
*/
[noscript]
nsIWebBrowserChrome createChromeWindow2(in nsIWebBrowserChrome parent,
in PRUint32 chromeFlags,
in PRUint32 contextFlags);
in PRUint32 contextFlags,
in nsIURI uri,
out boolean cancel);
};

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

@ -42,6 +42,7 @@
#include "nsIServiceManagerUtils.h"
#include "nsIWebBrowserSetup.h"
#include "nsIPrefBranch.h"
#include "nsIURI.h"
#include "CBrowserShell.h"
#include "CBrowserWindow.h"
@ -85,8 +86,11 @@ NS_IMETHODIMP CWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent,
NS_IMETHODIMP CWindowCreator::CreateChromeWindow2(nsIWebBrowserChrome *parent,
PRUint32 chromeFlags, PRUint32 contextFlags,
nsIURI *aURI, PRBool *aCancel,
nsIWebBrowserChrome **_retval)
{
NS_ENSURE_ARG_POINTER(aCancel);
*aCancel = PR_FALSE;
if (contextFlags & nsIWindowCreator2::PARENT_IS_LOADING_OR_RUNNING_TIMEOUT) {
nsCOMPtr<nsIPrefBranch> prefs(do_GetService("@mozilla.org/preferences-service;1"));
if (prefs) {

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

@ -610,8 +610,14 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent,
if (popupConditions)
contextFlags |= nsIWindowCreator2::PARENT_IS_LOADING_OR_RUNNING_TIMEOUT;
PRBool cancel = PR_FALSE;
rv = windowCreator2->CreateChromeWindow2(parentChrome, chromeFlags,
contextFlags, getter_AddRefs(newChrome));
contextFlags, uriToLoad, &cancel,
getter_AddRefs(newChrome));
if (NS_SUCCEEDED(rv) && cancel) {
newChrome = 0; // just in case
rv = NS_ERROR_ABORT;
}
}
else
rv = mWindowCreator->CreateChromeWindow(parentChrome, chromeFlags,

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

@ -74,6 +74,7 @@
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIServiceManager.h"
#include "nsIURI.h"
#include "nsIXULWindow.h"
#include "nsIWebBrowserChrome.h"
@ -92,16 +93,21 @@ nsWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent,
PRUint32 aChromeFlags,
nsIWebBrowserChrome **_retval)
{
return CreateChromeWindow2(aParent, aChromeFlags, 0, _retval);
PRBool cancel;
return CreateChromeWindow2(aParent, aChromeFlags, 0, 0, &cancel, _retval);
}
NS_IMETHODIMP
nsWindowCreator::CreateChromeWindow2(nsIWebBrowserChrome *aParent,
PRUint32 aChromeFlags,
PRUint32 aContextFlags,
nsIWebBrowserChrome **_retval)
nsWindowCreator::CreateChromeWindow2( nsIWebBrowserChrome *aParent,
PRUint32 aChromeFlags,
PRUint32 aContextFlags,
nsIURI *aURI,
PRBool *aCancel,
nsIWebBrowserChrome **_retval)
{
NS_ENSURE_ARG_POINTER(aCancel);
NS_ENSURE_ARG_POINTER(_retval);
*aCancel = PR_FALSE;
*_retval = 0;
nsCOMPtr<nsIXULWindow> newWindow;

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

@ -40,8 +40,6 @@
#include "nsIWindowCreator2.h"
class nsIURI;
class nsWindowCreator :
public nsIWindowCreator2
{