зеркало из https://github.com/mozilla/pjs.git
Changed nsIAppShellService and nsIWindowMediator to talk in terms of nsIXULWindow instead of nsIWebShellWindow. Also removed the function nsIAppShellService::RunModalDialog since windows should be created using the nsIDOMWindow::OpenDialog. r=danm a=jevering
This commit is contained in:
Родитель
3f29bd3a3d
Коммит
c4734766bd
|
@ -114,7 +114,7 @@ si_3ButtonConfirm(PRUnichar * szMessage) {
|
|||
// This will go away once select is passed a prompter interface
|
||||
#include "nsAppShellCIDs.h" // TODO remove later
|
||||
#include "nsIAppShellService.h" // TODO remove later
|
||||
#include "nsIWebShellWindow.h" // TODO remove later
|
||||
#include "nsIXULWindow.h" // TODO remove later
|
||||
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
|
||||
PRIVATE PRBool
|
||||
|
@ -130,9 +130,9 @@ si_SelectDialog(const PRUnichar* szMessage, PRUnichar** pList, PRInt32* pCount)
|
|||
if(NS_FAILED(rv)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsCOMPtr<nsIWebShellWindow> webshellwindow;
|
||||
appshellservice->GetHiddenWindow(getter_AddRefs(webshellwindow));
|
||||
nsCOMPtr<nsIPrompt> prompter(do_QueryInterface(webshellwindow));
|
||||
nsCOMPtr<nsIXULWindow> xulWindow;
|
||||
appshellservice->GetHiddenWindow(getter_AddRefs(xulWindow));
|
||||
nsCOMPtr<nsIPrompt> prompter(do_QueryInterface(xulWindow));
|
||||
PRInt32 selectedIndex;
|
||||
PRBool rtnValue;
|
||||
PRUnichar * title_string = Wallet_Localize("SelectUserTitleLine");
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "nsAppShellCIDs.h" // TODO remove later
|
||||
#include "nsIAppShellService.h" // TODO remove later
|
||||
#include "nsIWebShellWindow.h" // TODO remove later
|
||||
#include "nsIXULWindow.h" // TODO remove later
|
||||
#include "nsINetPrompt.h"
|
||||
|
||||
static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
|
||||
|
@ -804,12 +804,12 @@ nsFtpConnectionThread::S_user() {
|
|||
} else {
|
||||
if (!mUsername.Length()) {
|
||||
|
||||
NS_WITH_SERVICE(nsIAppShellService, appshellservice, kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIAppShellService> appShellService(do_GetService(kAppShellServiceCID));
|
||||
NS_ENSURE_TRUE(appShellService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> webshellwindow;
|
||||
appshellservice->GetHiddenWindow(getter_AddRefs( webshellwindow ) );
|
||||
nsCOMPtr<nsINetPrompt> prompter( do_QueryInterface( webshellwindow ) );
|
||||
nsCOMPtr<nsIXULWindow> xulWindow;
|
||||
appShellService->GetHiddenWindow(getter_AddRefs( xulWindow ) );
|
||||
nsCOMPtr<nsINetPrompt> prompter( do_QueryInterface( xulWindow ) );
|
||||
|
||||
NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager, kProxyObjectManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -883,12 +883,12 @@ nsFtpConnectionThread::S_pass() {
|
|||
} else {
|
||||
if (!mPassword.Length() || mRetryPass) {
|
||||
// ignore any password we have, it's not working
|
||||
NS_WITH_SERVICE(nsIAppShellService, appshellservice, kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIAppShellService> appShellService(do_GetService(kAppShellServiceCID));
|
||||
NS_ENSURE_TRUE(appShellService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> webshellwindow;
|
||||
appshellservice->GetHiddenWindow(getter_AddRefs( webshellwindow ) );
|
||||
nsCOMPtr<nsINetPrompt> prompter( do_QueryInterface( webshellwindow ) );
|
||||
nsCOMPtr<nsIXULWindow> xulWindow;
|
||||
appShellService->GetHiddenWindow(getter_AddRefs( xulWindow ) );
|
||||
nsCOMPtr<nsINetPrompt> prompter( do_QueryInterface( xulWindow ) );
|
||||
|
||||
NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager, kProxyObjectManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
// This will go away once the dialog box starts popping off the window that triggered the load.
|
||||
#include "nsAppShellCIDs.h" // TODO remove later
|
||||
#include "nsIAppShellService.h" // TODO remove later
|
||||
#include "nsIWebShellWindow.h" // TODO remove later
|
||||
#include "nsIXULWindow.h" // TODO remove later
|
||||
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
#include "nsINetPrompt.h"
|
||||
|
@ -1503,14 +1503,12 @@ nsHTTPChannel::Authenticate(const char *iChallenge, PRBool iProxyAuth)
|
|||
This is dependent on the completion of the new
|
||||
design of the webshell.
|
||||
*/
|
||||
NS_WITH_SERVICE(nsIAppShellService, appshellservice,
|
||||
kAppShellServiceCID, &rv);
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
nsCOMPtr<nsIWebShellWindow> webshellwindow;
|
||||
appshellservice->GetHiddenWindow(getter_AddRefs(webshellwindow));
|
||||
nsCOMPtr<nsINetPrompt> prompter(
|
||||
do_QueryInterface(webshellwindow));
|
||||
nsCOMPtr<nsIAppShellService> appShellService(do_GetService(kAppShellServiceCID));
|
||||
NS_ENSURE_TRUE(appShellService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIXULWindow> xulWindow;
|
||||
appShellService->GetHiddenWindow(getter_AddRefs( xulWindow ) );
|
||||
nsCOMPtr<nsINetPrompt> prompter( do_QueryInterface( xulWindow ) );
|
||||
|
||||
NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager,
|
||||
kProxyObjectManagerCID, &rv);
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
#include "nsIWebShellWindow.h"
|
||||
|
||||
#ifdef DEBUG_seth
|
||||
#define DEBUG_UTF8_CONVERSION 1
|
||||
#endif
|
||||
|
@ -387,9 +389,10 @@ extern "C" void ProfileMigrationController(void *data)
|
|||
NS_IMETHODIMP
|
||||
nsPrefMigration::WindowCloseCallback()
|
||||
{
|
||||
|
||||
if (mPMProgressWindow)
|
||||
mPMProgressWindow->Close();
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> progressWindow(do_QueryInterface(mPMProgressWindow));
|
||||
if(progressWindow)
|
||||
progressWindow->Close();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -33,12 +33,14 @@
|
|||
#include "nsICommonDialogs.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsPrefMigrationCIDs.h"
|
||||
#include "nsIPrefMigration.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
//Interfaces Needed
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#define IMAP_MAIL_FILTER_FILE_NAME_FORMAT_IN_4x "%s Rules"
|
||||
#endif
|
||||
|
@ -150,7 +152,7 @@ class nsPrefMigration: public nsIPrefMigration
|
|||
nsCOMPtr<nsIFileSpec> m_prefsFile;
|
||||
nsCOMPtr<nsIDOMWindow> m_parentWindow;
|
||||
nsIDOMWindow *m_progressWindow;
|
||||
nsCOMPtr<nsIWebShellWindow> mPMProgressWindow;
|
||||
nsCOMPtr<nsIXULWindow> mPMProgressWindow;
|
||||
};
|
||||
|
||||
#endif /* nsPrefMigration_h___ */
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nsIAppShellService.h"
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#include "nsIIOService.h"
|
||||
|
@ -62,8 +61,9 @@
|
|||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgAccount.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
// Interfaces Needed
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
#if defined (XP_UNIX)
|
||||
#elif defined (XP_MAC)
|
||||
|
@ -323,7 +323,7 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> profWindow;
|
||||
nsCOMPtr<nsIXULWindow> profWindow;
|
||||
rv = profAppShell->CreateTopLevelWindow(nsnull, profileURL,
|
||||
PR_TRUE, PR_TRUE, CHROME_STYLE,
|
||||
nsnull,
|
||||
|
@ -1739,15 +1739,12 @@ nsProfile::TriggerActivation(const char *profileName)
|
|||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> webWindow;
|
||||
rv = pregAppShell->CreateTopLevelWindow(nsnull, registrationURL,
|
||||
PR_TRUE, PR_TRUE, NS_CHROME_ALL_CHROME,
|
||||
nsnull,
|
||||
NS_SIZETOCONTENT, // width
|
||||
NS_SIZETOCONTENT, // height
|
||||
getter_AddRefs(webWindow));
|
||||
|
||||
mPregWindow = do_QueryInterface(webWindow);
|
||||
getter_AddRefs(mPregWindow));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsICmdLineService.h"
|
||||
#include "nsProfileAccess.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIURIContentListener.h"
|
||||
|
@ -51,7 +52,7 @@ private:
|
|||
nsCString & profileURLStr);
|
||||
nsresult LoadDefaultProfileDir(nsCString & profileURLStr);
|
||||
PRBool mAutomigrate;
|
||||
nsCOMPtr<nsIXULWindow> mPregWindow;
|
||||
nsCOMPtr<nsIXULWindow> mPregWindow;
|
||||
|
||||
public:
|
||||
nsProfile();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "nsISplashScreen.h"
|
||||
%}
|
||||
|
||||
interface nsIWebShellWindow;
|
||||
interface nsIXULWindow;
|
||||
interface nsIURI;
|
||||
interface nsIXULWindowCallbacks;
|
||||
interface nsICmdLineService;
|
||||
|
@ -97,43 +97,15 @@ interface nsIAppShellService : nsISupports
|
|||
* @param aInitialHeight like aInitialWidth, but subtly different.
|
||||
* @param aResult the newly created window is returned here.
|
||||
*/
|
||||
void CreateTopLevelWindow(in nsIWebShellWindow aParent,
|
||||
void CreateTopLevelWindow(in nsIXULWindow aParent,
|
||||
in nsIURI aUrl,
|
||||
in boolean aShowWindow,
|
||||
in boolean aLoadDefaultPage,
|
||||
in PRUint32 aChromeMask,
|
||||
in nsIXULWindowCallbacks aCallbacks,
|
||||
in long aInitialWidth, in long aInitialHeight,
|
||||
out nsIWebShellWindow aResult);
|
||||
out nsIXULWindow aResult);
|
||||
|
||||
/**
|
||||
* Run a window modally.
|
||||
* @param aWindow the window to run modally. If null or pointing to null,
|
||||
* a new window is created. If aWindow != null, the window
|
||||
* is returned from this method, but callers should use it
|
||||
* carefully: it's been closed, and is therefore partially
|
||||
* deconstructed. Note that all other parameters are ignored
|
||||
* if an already created window is passed in.
|
||||
* @param aParent the parent window. Can be null.
|
||||
* @param aUrl the contents of the window.
|
||||
* @param aChromeMask chrome flags affecting the kind of OS border
|
||||
* given to the window. see nsIBrowserWindow for
|
||||
* bit/flag definitions.
|
||||
* @param aCallbacks interface providing C++ hooks for window initialization
|
||||
* before the window is made visible. Deprecated.
|
||||
* @param aInitialWidth width, in pixels, of the window. Width of window
|
||||
* at creation. Can be overridden by the "width"
|
||||
* tag in the XUL. Set to NS_SIZETOCONTENT to force
|
||||
* the window to wrap to its contents.
|
||||
* @param aInitialHeight like aInitialWidth.
|
||||
*/
|
||||
void RunModalDialog( inout nsIWebShellWindow aWindow,
|
||||
in nsIWebShellWindow aParent,
|
||||
in nsIURI aUrl,
|
||||
in PRUint32 aChromeMask,
|
||||
in nsIXULWindowCallbacks aCallbacks,
|
||||
in long aInitialWidth, in long aInitialHeight);
|
||||
|
||||
// Apply Initialize function to each app shell component.
|
||||
void EnumerateAndInitializeComponents();
|
||||
|
||||
|
@ -141,7 +113,7 @@ interface nsIAppShellService : nsISupports
|
|||
* Close a window.
|
||||
* @param aWindow a window.
|
||||
*/
|
||||
void CloseTopLevelWindow(in nsIWebShellWindow aWindow);
|
||||
void CloseTopLevelWindow(in nsIXULWindow aWindow);
|
||||
|
||||
[noscript]
|
||||
void CreateHiddenWindow();
|
||||
|
@ -152,7 +124,7 @@ interface nsIAppShellService : nsISupports
|
|||
* @param aResult the hidden window. Do not unhide hidden window.
|
||||
* Do not taunt hidden window.
|
||||
*/
|
||||
void GetHiddenWindow(out nsIWebShellWindow aResult);
|
||||
void GetHiddenWindow(out nsIXULWindow aResult);
|
||||
|
||||
/**
|
||||
* Return the (singleton) application hidden window as an nsIDOMWindow,
|
||||
|
@ -171,13 +143,13 @@ interface nsIAppShellService : nsISupports
|
|||
* knows it can't quit until it's out of registered windows.
|
||||
* @param aWindow yes
|
||||
*/
|
||||
void RegisterTopLevelWindow(in nsIWebShellWindow aWindow);
|
||||
void RegisterTopLevelWindow(in nsIXULWindow aWindow);
|
||||
|
||||
/**
|
||||
* Remove a window from the application's window registry.
|
||||
* @param aWindow you see the pattern
|
||||
*/
|
||||
void UnregisterTopLevelWindow(in nsIWebShellWindow aWindow);
|
||||
void UnregisterTopLevelWindow(in nsIXULWindow aWindow);
|
||||
|
||||
/**
|
||||
* Remove the splash screen (if visible). This need be called
|
||||
|
|
|
@ -25,16 +25,13 @@
|
|||
#include "nsIRDFDataSource.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
[ptr] native nsIWebShellWindow(nsIWebShellWindow);
|
||||
%{C++
|
||||
#include "nsIWebShellWindow.h"
|
||||
%}
|
||||
|
||||
%{C++
|
||||
#define NS_WINDOWMEDIATOR_CID \
|
||||
{ 0x0659cb83, 0xfaad, 0x11d2, { 0x8e, 0x19, 0xb2, 0x06, 0x62, 0x0a, 0x65, 0x7c } }
|
||||
%}
|
||||
|
||||
interface nsIXULWindow;
|
||||
|
||||
|
||||
[scriptable, uuid(0659cb81-faad-11d2-8e19-b206620a657c)]
|
||||
interface nsIWindowMediator: nsIRDFDataSource
|
||||
|
@ -69,16 +66,16 @@ interface nsIWindowMediator: nsIRDFDataSource
|
|||
nsIDOMWindow convertISupportsToDOMWindow( in nsISupports inWindow );
|
||||
|
||||
/* Add the webshellwindow to the list */
|
||||
[noscript] void registerWindow( in nsIWebShellWindow inWindow);
|
||||
[noscript] void registerWindow( in nsIXULWindow inWindow);
|
||||
|
||||
/* remove the window from the list */
|
||||
[noscript] void unregisterWindow( in nsIWebShellWindow inWindow );
|
||||
[noscript] void unregisterWindow( in nsIXULWindow inWindow );
|
||||
|
||||
/* Call when the window gains focus. Used to determine the most recent window */
|
||||
[noscript] void updateWindowTimeStamp( in nsIWebShellWindow inWindow );
|
||||
[noscript] void updateWindowTimeStamp( in nsIXULWindow inWindow );
|
||||
|
||||
/* */
|
||||
[noscript] void updateWindowTitle(in nsIWebShellWindow inWindow, in wstring inTitle );
|
||||
[noscript] void updateWindowTitle(in nsIXULWindow inWindow, in wstring inTitle );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -73,5 +73,10 @@ interface nsIXULWindow : nsISupports
|
|||
*/
|
||||
void getPersistence(out boolean persistX, out boolean persistY,
|
||||
out boolean persistCX, out boolean persistCY);
|
||||
|
||||
/*
|
||||
Shows the window as a modal window
|
||||
*/
|
||||
void showModal();
|
||||
};
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#include "nsIWebShellWindow.h"
|
||||
#include "nsWebShellWindow.h"
|
||||
|
||||
#include "nsIWindowMediator.h"
|
||||
|
||||
#include "nsIAppShellComponent.h"
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsIEnumerator.h"
|
||||
|
@ -97,10 +95,14 @@ nsAppShellService::~nsAppShellService()
|
|||
NS_IF_RELEASE(mWindowList);
|
||||
NS_IF_RELEASE(mCmdLineService);
|
||||
NS_IF_RELEASE(mSplashScreen);
|
||||
if (mHiddenWindow)
|
||||
mHiddenWindow->Close(); // merely releasing the ref isn't enough!
|
||||
if (mWindowMediator)
|
||||
nsServiceManager::ReleaseService(kWindowMediatorCID, mWindowMediator);
|
||||
nsCOMPtr<nsIWebShellWindow> hiddenWin(do_QueryInterface(mHiddenWindow));
|
||||
if(hiddenWin)
|
||||
hiddenWin->Close();
|
||||
|
||||
hiddenWin = nsnull;
|
||||
mHiddenWindow = nsnull;
|
||||
|
||||
mWindowMediator = nsnull;
|
||||
/* Note we don't unregister with the observer service
|
||||
(RegisterObserver(PR_FALSE)) because, being refcounted, we can't have
|
||||
reached our own destructor until after the ObserverService has shut down
|
||||
|
@ -189,8 +191,7 @@ nsAppShellService::Initialize( nsICmdLineService *aCmdLineService,
|
|||
RegisterObserver(PR_TRUE);
|
||||
|
||||
// enable window mediation
|
||||
rv = nsServiceManager::GetService(kWindowMediatorCID, NS_GET_IID(nsIWindowMediator),
|
||||
(nsISupports**) &mWindowMediator);
|
||||
mWindowMediator = do_GetService(kWindowMediatorCID);
|
||||
|
||||
// CreateHiddenWindow(); // rjc: now require this to be explicitly called
|
||||
|
||||
|
@ -209,14 +210,14 @@ nsAppShellService::CreateHiddenWindow()
|
|||
#if XP_MAC
|
||||
rv = NS_NewURI(&url, "chrome://global/content/hiddenWindow.xul");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
nsCOMPtr<nsIXULWindow> newWindow;
|
||||
rv = JustCreateTopWindow(nsnull, url, PR_FALSE, PR_FALSE,
|
||||
0, nsnull, 0, 0,
|
||||
getter_AddRefs(newWindow));
|
||||
#else
|
||||
rv = NS_NewURI(&url, "about:blank");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
nsCOMPtr<nsIXULWindow> newWindow;
|
||||
rv = JustCreateTopWindow(nsnull, url, PR_FALSE, PR_FALSE,
|
||||
NS_CHROME_ALL_CHROME, nsnull, 100, 100,
|
||||
getter_AddRefs(newWindow));
|
||||
|
@ -412,10 +413,9 @@ nsAppShellService::Quit()
|
|||
mShuttingDown = PR_TRUE;
|
||||
|
||||
// Enumerate through each open window and close it
|
||||
NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (mWindowMediator) {
|
||||
nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
|
||||
rv = windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator));
|
||||
rv = mWindowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool more;
|
||||
|
@ -513,13 +513,13 @@ nsAppShellService::Shutdown(void)
|
|||
* Create a new top level window and display the given URL within it...
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::CreateTopLevelWindow(nsIWebShellWindow *aParent,
|
||||
nsAppShellService::CreateTopLevelWindow(nsIXULWindow *aParent,
|
||||
nsIURI *aUrl,
|
||||
PRBool aShowWindow, PRBool aLoadDefaultPage,
|
||||
PRUint32 aChromeMask,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
||||
nsIWebShellWindow **aResult)
|
||||
nsIXULWindow **aResult)
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
|
@ -541,13 +541,13 @@ nsAppShellService::CreateTopLevelWindow(nsIWebShellWindow *aParent,
|
|||
* Just do the window-making part of CreateTopLevelWindow
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::JustCreateTopWindow(nsIWebShellWindow *aParent,
|
||||
nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
||||
nsIURI *aUrl,
|
||||
PRBool aShowWindow, PRBool aLoadDefaultPage,
|
||||
PRUint32 aChromeMask,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
||||
nsIWebShellWindow **aResult)
|
||||
nsIXULWindow **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsWebShellWindow* window;
|
||||
|
@ -599,7 +599,7 @@ nsAppShellService::JustCreateTopWindow(nsIWebShellWindow *aParent,
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
// this does the AddRef of the return value
|
||||
rv = window->QueryInterface(NS_GET_IID(nsIWebShellWindow), (void **) aResult);
|
||||
rv = CallQueryInterface(NS_STATIC_CAST(nsIWebShellWindow*, window), aResult);
|
||||
#if 0
|
||||
// If intrinsically sized, don't show until we have the size figured out
|
||||
// (6 Dec 99: this is causing new windows opened from anchor links to
|
||||
|
@ -618,21 +618,21 @@ nsAppShellService::JustCreateTopWindow(nsIWebShellWindow *aParent,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::CloseTopLevelWindow(nsIWebShellWindow* aWindow)
|
||||
nsAppShellService::CloseTopLevelWindow(nsIXULWindow* aWindow)
|
||||
{
|
||||
return aWindow->Close();
|
||||
nsCOMPtr<nsIWebShellWindow> webShellWin(do_QueryInterface(aWindow));
|
||||
NS_ENSURE_TRUE(webShellWin, NS_ERROR_FAILURE);
|
||||
return webShellWin->Close();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::GetHiddenWindow(nsIWebShellWindow **aWindow)
|
||||
nsAppShellService::GetHiddenWindow(nsIXULWindow **aWindow)
|
||||
{
|
||||
nsIWebShellWindow *rv;
|
||||
NS_ENSURE_ARG_POINTER(aWindow);
|
||||
|
||||
NS_ASSERTION(aWindow, "null param to GetHiddenWindow");
|
||||
rv = mHiddenWindow;
|
||||
NS_IF_ADDREF(rv);
|
||||
*aWindow = rv;
|
||||
return rv ? NS_OK : NS_ERROR_FAILURE;
|
||||
*aWindow = mHiddenWindow;
|
||||
NS_IF_ADDREF(*aWindow);
|
||||
return *aWindow ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -647,16 +647,14 @@ nsAppShellService::GetHiddenWindowAndJSContext(nsIDOMWindow **aWindow,
|
|||
if ( mHiddenWindow ) {
|
||||
// Convert hidden window to nsIDOMWindow and extract its JSContext.
|
||||
do {
|
||||
// 1. Get webshell for hidden window.
|
||||
nsCOMPtr<nsIWebShell> webShell;
|
||||
rv = mHiddenWindow->GetWebShell( *getter_AddRefs( webShell ) );
|
||||
// 1. Get doc for hidden window.
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
rv = mHiddenWindow->GetDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
// 2. Convert that to an nsIDOMWindow.
|
||||
nsCOMPtr<nsIDOMWindow> hiddenDOMWindow;
|
||||
rv = mHiddenWindow->ConvertWebShellToDOMWindow( webShell,
|
||||
getter_AddRefs( hiddenDOMWindow ) );
|
||||
if (NS_FAILED(rv)) break;
|
||||
nsCOMPtr<nsIDOMWindow> hiddenDOMWindow(do_GetInterface(docShell));
|
||||
if(!hiddenDOMWindow) break;
|
||||
|
||||
// 3. Get script global object for the window.
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo;
|
||||
|
@ -686,107 +684,24 @@ nsAppShellService::GetHiddenWindowAndJSContext(nsIDOMWindow **aWindow,
|
|||
return rv;
|
||||
}
|
||||
|
||||
/* Create a Window, run it modally, and destroy it. To make initial control
|
||||
settings or get information out of the dialog before dismissal, use
|
||||
event handlers. This wrapper method is desirable because of the
|
||||
complications creeping in to the modal window story: there's a lot of setup.
|
||||
See the code..
|
||||
|
||||
If a window is passed in via the first parameter, that window will be
|
||||
the one displayed modally. If no window is passed in (if *aWindow is null)
|
||||
the window created will be returned in *aWindow. Note that by the time
|
||||
this function exits, that window has been partially destroyed. We return it
|
||||
anyway, in the hopes that it may be queried for results, somehow.
|
||||
This may be a mistake. It is returned addrefed (by the QueryInterface
|
||||
to nsIWebShellWindow in CreateTopLevelWindow).
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::RunModalDialog(
|
||||
nsIWebShellWindow **aWindow,
|
||||
nsIWebShellWindow *aParent,
|
||||
nsIURI *aUrl,
|
||||
PRUint32 aChromeMask,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIWebShellWindow *theWindow;
|
||||
nsIEventQueue *pushedQueue;
|
||||
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
pushedQueue = NULL;
|
||||
if (aWindow && *aWindow) {
|
||||
theWindow = *aWindow;
|
||||
NS_ADDREF(theWindow);
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
eventQService->PushThreadEventQueue(&pushedQueue);
|
||||
rv = CreateTopLevelWindow(aParent, aUrl, PR_TRUE, PR_TRUE, aChromeMask,
|
||||
aCallbacks, aInitialWidth, aInitialHeight, &theWindow);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||
nsresult gotParent;
|
||||
gotParent = aParent ? aParent->GetWidget(*getter_AddRefs(parentWindowWidgetThing)) :
|
||||
NS_ERROR_FAILURE;
|
||||
// Windows OS wants the parent disabled for modality
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||
theWindow->ShowModal();
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
|
||||
// return the used window if possible, or otherwise get rid of it
|
||||
if (aWindow)
|
||||
if (*aWindow)
|
||||
NS_RELEASE(theWindow); // we borrowed it, now let it go
|
||||
else
|
||||
*aWindow = theWindow; // and it's addrefed from Create...
|
||||
else
|
||||
NS_RELEASE(theWindow); // can't return it; let it go
|
||||
}
|
||||
|
||||
if (pushedQueue)
|
||||
eventQService->PopThreadEventQueue(pushedQueue);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Register a new top level window (created elsewhere)
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::RegisterTopLevelWindow(nsIWebShellWindow* aWindow)
|
||||
nsAppShellService::RegisterTopLevelWindow(nsIXULWindow* aWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
mWindowList->AppendElement(aWindow);
|
||||
|
||||
nsIWebShellContainer* wsc;
|
||||
rv = aWindow->QueryInterface(NS_GET_IID(nsIWebShellContainer), (void **) &wsc);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mWindowList->AppendElement(wsc);
|
||||
NS_RELEASE(wsc);
|
||||
|
||||
nsIWindowMediator* service;
|
||||
if (NS_SUCCEEDED(nsServiceManager::GetService(kWindowMediatorCID, NS_GET_IID(nsIWindowMediator), (nsISupports**) &service ) ) )
|
||||
{
|
||||
service->RegisterWindow( aWindow);
|
||||
nsServiceManager::ReleaseService(kWindowMediatorCID, service);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
if(mWindowMediator)
|
||||
mWindowMediator->RegisterWindow(aWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::UnregisterTopLevelWindow(nsIWebShellWindow* aWindow)
|
||||
nsAppShellService::UnregisterTopLevelWindow(nsIXULWindow* aWindow)
|
||||
{
|
||||
|
||||
|
||||
if (mDeleteCalled) {
|
||||
// return an error code in order to:
|
||||
// - avoid doing anything with other member variables while we are in the destructor
|
||||
|
@ -795,21 +710,13 @@ nsAppShellService::UnregisterTopLevelWindow(nsIWebShellWindow* aWindow)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIWindowMediator* service;
|
||||
if (NS_SUCCEEDED(nsServiceManager::GetService(kWindowMediatorCID, NS_GET_IID(nsIWindowMediator), (nsISupports**) &service ) ) )
|
||||
{
|
||||
service->UnregisterWindow( aWindow );
|
||||
nsServiceManager::ReleaseService(kWindowMediatorCID, service);
|
||||
}
|
||||
if(mWindowMediator)
|
||||
mWindowMediator->UnregisterWindow(aWindow);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsIWebShellContainer* wsc;
|
||||
rv = aWindow->QueryInterface(NS_GET_IID(nsIWebShellContainer), (void **) &wsc);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mWindowList->RemoveElement(wsc);
|
||||
NS_RELEASE(wsc);
|
||||
}
|
||||
mWindowList->RemoveElement(aWindow);
|
||||
|
||||
PRUint32 cnt;
|
||||
rv = mWindowList->Count(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
#include "nsIAppShell.h"
|
||||
#include "plevent.h"
|
||||
|
||||
//Interfaces Needed
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
|
||||
class nsAppShellService : public nsIAppShellService,
|
||||
public nsIObserver,
|
||||
public nsSupportsWeakReference
|
||||
|
@ -44,13 +48,13 @@ protected:
|
|||
virtual ~nsAppShellService();
|
||||
|
||||
void RegisterObserver(PRBool aRegister);
|
||||
NS_IMETHOD JustCreateTopWindow(nsIWebShellWindow *aParent,
|
||||
NS_IMETHOD JustCreateTopWindow(nsIXULWindow *aParent,
|
||||
nsIURI *aUrl,
|
||||
PRBool aShowWindow, PRBool aLoadDefaultPage,
|
||||
PRUint32 aChromeMask,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
||||
nsIWebShellWindow **aResult);
|
||||
nsIXULWindow **aResult);
|
||||
void InitializeComponent( const nsCID &aComponentCID );
|
||||
void ShutdownComponent( const nsCID &aComponentCID );
|
||||
typedef void (nsAppShellService::*EnumeratorMemberFunction)(const nsCID&);
|
||||
|
@ -59,8 +63,8 @@ protected:
|
|||
nsIAppShell* mAppShell;
|
||||
nsISupportsArray* mWindowList;
|
||||
nsICmdLineService* mCmdLineService;
|
||||
nsIWindowMediator* mWindowMediator;
|
||||
nsCOMPtr<nsIWebShellWindow> mHiddenWindow;
|
||||
nsCOMPtr<nsIWindowMediator> mWindowMediator;
|
||||
nsCOMPtr<nsIXULWindow> mHiddenWindow;
|
||||
PRBool mDeleteCalled;
|
||||
nsISplashScreen *mSplashScreen;
|
||||
|
||||
|
|
|
@ -20,32 +20,36 @@
|
|||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
// Local Includes
|
||||
#include "nsNetSupportDialog.h"
|
||||
|
||||
// Helper Classes
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
//Interfaces Needed
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsICommonDialogs.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
/* Define Class IDs */
|
||||
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
|
||||
PRBool GetNSIPrompt( nsCOMPtr<nsIPrompt> & outPrompt )
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIAppShellService, appshellservice, kAppShellServiceCID, &rv);
|
||||
if(NS_FAILED(rv)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsCOMPtr<nsIWebShellWindow> webshellwindow;
|
||||
appshellservice->GetHiddenWindow(getter_AddRefs(webshellwindow));
|
||||
outPrompt = do_QueryInterface(webshellwindow);
|
||||
if ( outPrompt.get() != NULL )
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
nsCOMPtr<nsIAppShellService> appShellService(do_GetService(kAppShellServiceCID));
|
||||
if(!appShellService)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIXULWindow> xulWindow;
|
||||
appShellService->GetHiddenWindow(getter_AddRefs(xulWindow));
|
||||
outPrompt = do_QueryInterface(xulWindow);
|
||||
if(outPrompt)
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsNetSupportDialog::nsNetSupportDialog()
|
||||
|
|
|
@ -266,7 +266,7 @@ NS_INTERFACE_MAP_BEGIN(nsWebShellWindow)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent,
|
||||
nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
|
||||
nsIAppShell* aShell, nsIURI* aUrl,
|
||||
PRBool aCreatedVisible,
|
||||
PRBool aLoadDefaultPage,
|
||||
|
@ -302,8 +302,9 @@ nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent,
|
|||
to be closed. This would mimic the behaviour of OSes that support
|
||||
top-level child windows in OSes that do not. Later.
|
||||
*/
|
||||
if (aParent) {
|
||||
aParent->GetWidget(*getter_AddRefs(parentWidget));
|
||||
nsCOMPtr<nsIBaseWindow> parentAsWin(do_QueryInterface(aParent));
|
||||
if (parentAsWin) {
|
||||
parentAsWin->GetMainWidget(getter_AddRefs(parentWidget));
|
||||
mParentWindow = getter_AddRefs(NS_GetWeakReference(aParent));
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
NS_IMETHOD GetDOMWindow(nsIDOMWindow** aDOMWindow);
|
||||
NS_IMETHOD ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindow** aDOMWindow);
|
||||
// nsWebShellWindow methods...
|
||||
nsresult Initialize(nsIWebShellWindow * aParent, nsIAppShell* aShell, nsIURI* aUrl,
|
||||
nsresult Initialize(nsIXULWindow * aParent, nsIAppShell* aShell, nsIURI* aUrl,
|
||||
PRBool aCreatedVisible, PRBool aLoadDefaultPage,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "nsIWindowMediator.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
@ -45,6 +44,11 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsWindowMediator.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
|
||||
|
@ -76,16 +80,17 @@ nsresult NS_NewRDFContainer(nsIRDFDataSource* aDataSource,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult GetDOMWindow( nsIWebShellWindow* inWindow, nsCOMPtr< nsIDOMWindow>& outDOMWindow )
|
||||
nsresult GetDOMWindow( nsIXULWindow* inWindow, nsCOMPtr< nsIDOMWindow>& outDOMWindow )
|
||||
{
|
||||
nsCOMPtr<nsIWebShell> webShell;
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
|
||||
inWindow->GetWebShell( *getter_AddRefs( webShell ) );
|
||||
return inWindow->ConvertWebShellToDOMWindow( webShell, getter_AddRefs( outDOMWindow ) );
|
||||
inWindow->GetDocShell(getter_AddRefs(docShell));
|
||||
outDOMWindow = do_GetInterface(docShell);
|
||||
return outDOMWindow ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> GetDOMNodeFromWebShell(nsIWebShell *aShell)
|
||||
nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocShell(nsIDocShell *aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
|
@ -111,13 +116,13 @@ nsCOMPtr<nsIDOMNode> GetDOMNodeFromWebShell(nsIWebShell *aShell)
|
|||
return node;
|
||||
}
|
||||
|
||||
void GetAttribute( nsIWebShellWindow* inWindow, const nsAutoString& inAttribute, nsAutoString& outValue )
|
||||
void GetAttribute( nsIXULWindow* inWindow, const nsAutoString& inAttribute, nsAutoString& outValue )
|
||||
{
|
||||
nsIWebShell* shell = NULL;
|
||||
nsCOMPtr<nsIDocShell> shell;
|
||||
if ( inWindow &&
|
||||
NS_SUCCEEDED(inWindow->GetWebShell( shell ) ) )
|
||||
NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell))))
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node( GetDOMNodeFromWebShell ( shell ) );
|
||||
nsCOMPtr<nsIDOMNode> node( GetDOMNodeFromDocShell ( shell ) );
|
||||
|
||||
if (node )
|
||||
{
|
||||
|
@ -125,11 +130,10 @@ void GetAttribute( nsIWebShellWindow* inWindow, const nsAutoString& inAttribute,
|
|||
if ( webshellElement.get() )
|
||||
webshellElement->GetAttribute(inAttribute.GetUnicode(), outValue );
|
||||
}
|
||||
NS_IF_RELEASE( shell );
|
||||
}
|
||||
}
|
||||
|
||||
void GetWindowType( nsIWebShellWindow* inWindow, nsAutoString& outType )
|
||||
void GetWindowType( nsIXULWindow* inWindow, nsAutoString& outType )
|
||||
{
|
||||
nsAutoString typeAttrib("windowtype");
|
||||
GetAttribute( inWindow, typeAttrib, outType );
|
||||
|
@ -139,7 +143,7 @@ class nsWindowMediator;
|
|||
|
||||
struct nsWindowInfo
|
||||
{
|
||||
nsWindowInfo( nsIWebShellWindow* inWindow, PRInt32 inTimeStamp ):
|
||||
nsWindowInfo( nsIXULWindow* inWindow, PRInt32 inTimeStamp ):
|
||||
mTimeStamp( inTimeStamp ), mWindow( inWindow )
|
||||
{
|
||||
}
|
||||
|
@ -150,7 +154,7 @@ struct nsWindowInfo
|
|||
|
||||
nsCOMPtr<nsIRDFResource> mRDFID;
|
||||
PRInt32 mTimeStamp;
|
||||
nsCOMPtr<nsIWebShellWindow> mWindow;
|
||||
nsCOMPtr<nsIXULWindow> mWindow;
|
||||
|
||||
nsAutoString GetType()
|
||||
{
|
||||
|
@ -234,7 +238,7 @@ nsWindowMediator::~nsWindowMediator()
|
|||
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWindowMediator::RegisterWindow( nsIWebShellWindow* inWindow )
|
||||
NS_IMETHODIMP nsWindowMediator::RegisterWindow( nsIXULWindow* inWindow )
|
||||
{
|
||||
if ( inWindow == NULL )
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
@ -263,7 +267,7 @@ NS_IMETHODIMP nsWindowMediator::RegisterWindow( nsIWebShellWindow* inWindow )
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindowMediator::UnregisterWindow( nsIWebShellWindow* inWindow )
|
||||
NS_IMETHODIMP nsWindowMediator::UnregisterWindow( nsIXULWindow* inWindow )
|
||||
{
|
||||
// Find Window info
|
||||
PRInt32 count = mWindowList.Count();
|
||||
|
@ -350,7 +354,7 @@ NS_IMETHODIMP nsWindowMediator::GetMostRecentWindow( const PRUnichar* inType, ns
|
|||
*outWindow = NULL;
|
||||
PRInt32 lastTimeStamp = -1;
|
||||
PRInt32 count = mWindowList.Count();
|
||||
nsIWebShellWindow* mostRecentWindow = NULL;
|
||||
nsIXULWindow* mostRecentWindow = NULL;
|
||||
nsAutoString typeString( inType );
|
||||
// Find the most window with the highest time stamp that matches the requested type
|
||||
for ( int32 i = 0; i< count; i++ )
|
||||
|
@ -383,7 +387,7 @@ NS_IMETHODIMP nsWindowMediator::GetMostRecentWindow( const PRUnichar* inType, ns
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWindowMediator::UpdateWindowTimeStamp( nsIWebShellWindow* inWindow )
|
||||
NS_IMETHODIMP nsWindowMediator::UpdateWindowTimeStamp( nsIXULWindow* inWindow )
|
||||
{
|
||||
PRInt32 count = mWindowList.Count();
|
||||
for ( int32 i = 0; i< count; i++ )
|
||||
|
@ -401,7 +405,7 @@ NS_IMETHODIMP nsWindowMediator::UpdateWindowTimeStamp( nsIWebShellWindow* inWind
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWindowMediator::UpdateWindowTitle( nsIWebShellWindow* inWindow, const PRUnichar* inTitle )
|
||||
NS_IMETHODIMP nsWindowMediator::UpdateWindowTitle( nsIXULWindow* inWindow, const PRUnichar* inTitle )
|
||||
{
|
||||
PRInt32 count = mWindowList.Count();
|
||||
nsresult rv;
|
||||
|
|
|
@ -269,6 +269,54 @@ NS_IMETHODIMP nsXULWindow::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::ShowModal()
|
||||
{
|
||||
nsCOMPtr<nsIAppShell> appShell(do_CreateInstance(kAppShellCID));
|
||||
NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);
|
||||
|
||||
appShell->Create(0, nsnull);
|
||||
appShell->Spinup();
|
||||
// Store locally so it doesn't die on us
|
||||
nsCOMPtr<nsIWidget> window = mWindow;
|
||||
nsCOMPtr<nsIXULWindow> tempRef = this;
|
||||
|
||||
|
||||
window->SetModal(PR_TRUE);
|
||||
mContinueModalLoop = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIJSContextStack> stack(do_GetService("nsThreadJSContextStack"));
|
||||
nsresult rv = NS_OK;
|
||||
if(stack && NS_SUCCEEDED(stack->Push(nsnull)))
|
||||
{
|
||||
while(NS_SUCCEEDED(rv) && mContinueModalLoop)
|
||||
{
|
||||
void* data;
|
||||
PRBool isRealEvent;
|
||||
PRBool processEvent;
|
||||
|
||||
rv = appShell->GetNativeEvent(isRealEvent, data);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
window->ModalEventFilter(isRealEvent, data, &processEvent);
|
||||
if(processEvent)
|
||||
appShell->DispatchNativeEvent(isRealEvent, data);
|
||||
}
|
||||
}
|
||||
JSContext* cx;
|
||||
stack->Pop(&cx);
|
||||
NS_ASSERTION(cx == nsnull, "JSContextStack mismatch");
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
mContinueModalLoop = PR_FALSE;
|
||||
|
||||
window->SetModal(PR_FALSE);
|
||||
appShell->Spindown();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsXULWindow::nsIBaseWindow
|
||||
//*****************************************************************************
|
||||
|
@ -310,11 +358,8 @@ NS_IMETHODIMP nsXULWindow::Destroy()
|
|||
#endif
|
||||
|
||||
nsCOMPtr<nsIAppShellService> appShell(do_GetService(kAppShellServiceCID));
|
||||
//XXXTAB remove this when we convert appshell to talk with nsIXULWindow
|
||||
nsCOMPtr<nsIWebShellWindow>
|
||||
webShellWindow(do_QueryInterface(NS_STATIC_CAST(nsIXULWindow*, this)));
|
||||
if(appShell)
|
||||
appShell->UnregisterTopLevelWindow(webShellWindow);
|
||||
appShell->UnregisterTopLevelWindow(NS_STATIC_CAST(nsIXULWindow*, this));
|
||||
|
||||
// let's make sure the window doesn't get deleted out from under us
|
||||
// while we are trying to close....this can happen if the docshell
|
||||
|
@ -493,11 +538,8 @@ NS_IMETHODIMP nsXULWindow::SetVisibility(PRBool aVisibility)
|
|||
mWindow->Show(aVisibility);
|
||||
|
||||
nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(kWindowMediatorCID));
|
||||
//XXXTAB Update windowMediator to take a nsIXULWindow instead
|
||||
nsCOMPtr<nsIWebShellWindow>
|
||||
thisWindow(do_QueryInterface(NS_STATIC_CAST(nsIXULWindow*, this)));
|
||||
if(windowMediator)
|
||||
windowMediator->UpdateWindowTimeStamp(thisWindow);
|
||||
windowMediator->UpdateWindowTimeStamp(NS_STATIC_CAST(nsIXULWindow*, this));
|
||||
|
||||
// Hide splash screen (if there is one).
|
||||
static PRBool splashScreenGone = PR_FALSE;
|
||||
|
@ -556,11 +598,7 @@ NS_IMETHODIMP nsXULWindow::SetTitle(const PRUnichar* aTitle)
|
|||
if(!windowMediator)
|
||||
return NS_OK;
|
||||
|
||||
// XXX Update windowMediator to take nsIXULWindow
|
||||
nsCOMPtr<nsIWebShellWindow>
|
||||
webShellWindow(do_QueryInterface(NS_STATIC_CAST(nsIXULWindow*, this)));
|
||||
NS_ENSURE_TRUE(webShellWindow, NS_ERROR_FAILURE);
|
||||
windowMediator->UpdateWindowTitle(webShellWindow, aTitle);
|
||||
windowMediator->UpdateWindowTitle(NS_STATIC_CAST(nsIXULWindow*, this), aTitle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -878,54 +916,6 @@ NS_IMETHODIMP nsXULWindow::SizeShellTo(nsIDocShellTreeItem* aShellItem,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::ShowModal()
|
||||
{
|
||||
nsCOMPtr<nsIAppShell> appShell(do_CreateInstance(kAppShellCID));
|
||||
NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);
|
||||
|
||||
appShell->Create(0, nsnull);
|
||||
appShell->Spinup();
|
||||
// Store locally so it doesn't die on us
|
||||
nsCOMPtr<nsIWidget> window = mWindow;
|
||||
nsCOMPtr<nsIXULWindow> tempRef = this;
|
||||
|
||||
window->SetModal(PR_TRUE);
|
||||
mContinueModalLoop = PR_TRUE;
|
||||
EnableParent(PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIJSContextStack> stack(do_GetService("nsThreadJSContextStack"));
|
||||
nsresult rv = NS_OK;
|
||||
if(stack && NS_SUCCEEDED(stack->Push(nsnull)))
|
||||
{
|
||||
while(NS_SUCCEEDED(rv) && mContinueModalLoop)
|
||||
{
|
||||
void* data;
|
||||
PRBool isRealEvent;
|
||||
PRBool processEvent;
|
||||
|
||||
rv = appShell->GetNativeEvent(isRealEvent, data);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
window->ModalEventFilter(isRealEvent, data, &processEvent);
|
||||
if(processEvent)
|
||||
appShell->DispatchNativeEvent(isRealEvent, data);
|
||||
}
|
||||
}
|
||||
JSContext* cx;
|
||||
stack->Pop(&cx);
|
||||
NS_ASSERTION(cx == nsnull, "JSContextStack mismatch");
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
mContinueModalLoop = PR_FALSE;
|
||||
|
||||
window->SetModal(PR_FALSE);
|
||||
appShell->Spindown();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::ExitModalLoop()
|
||||
{
|
||||
if (mContinueModalLoop) // was a modal window
|
||||
|
@ -955,17 +945,16 @@ NS_IMETHODIMP nsXULWindow::CreateNewChromeWindow(PRInt32 aChromeFlags,
|
|||
|
||||
// Just do a normal create of a window and return.
|
||||
//XXXTAB remove this when appshell talks in terms of nsIXULWindow
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
nsCOMPtr<nsIXULWindow> parent;
|
||||
if(aChromeFlags & nsIWebBrowserChrome::dependent)
|
||||
parent = do_QueryInterface(NS_STATIC_CAST(nsIXULWindow*, this));
|
||||
parent = this;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
nsCOMPtr<nsIXULWindow> newWindow;
|
||||
appShell->CreateTopLevelWindow(parent, nsnull, PR_FALSE, PR_FALSE,
|
||||
aChromeFlags, nsnull, NS_SIZETOCONTENT, NS_SIZETOCONTENT,
|
||||
getter_AddRefs(newWindow));
|
||||
|
||||
nsCOMPtr<nsIXULWindow> xulWindow(do_QueryInterface(newWindow));
|
||||
NS_ENSURE_TRUE(xulWindow, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);
|
||||
|
||||
// XXX Ick, this should be able to go away.....
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(newWindow));
|
||||
|
@ -973,7 +962,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewChromeWindow(PRInt32 aChromeFlags,
|
|||
browserChrome->SetChromeMask(aChromeFlags);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
xulWindow->GetDocShell(getter_AddRefs(docShell));
|
||||
newWindow->GetDocShell(getter_AddRefs(docShell));
|
||||
CallQueryInterface(docShell, aDocShellTreeItem);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1004,13 +993,14 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(PRInt32 aChromeFlags,
|
|||
service->NewURI(urlStr, nsnull, getter_AddRefs(uri));
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
nsCOMPtr<nsIXULWindow> newWindow;
|
||||
appShell->CreateTopLevelWindow(nsnull, uri, PR_FALSE, PR_FALSE,
|
||||
aChromeFlags, nsnull, 615, 480,
|
||||
getter_AddRefs(newWindow));
|
||||
|
||||
nsCOMPtr<nsIXULWindow> xulWindow(do_QueryInterface(newWindow));
|
||||
NS_ENSURE_TRUE(xulWindow, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> webShellWindow(do_QueryInterface(newWindow));
|
||||
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(newWindow));
|
||||
if(browserChrome)
|
||||
|
@ -1023,10 +1013,10 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(PRInt32 aChromeFlags,
|
|||
subShell->Spinup();
|
||||
|
||||
// Specify that we want the window to remain locked until the chrome has loaded.
|
||||
newWindow->LockUntilChromeLoad();
|
||||
webShellWindow->LockUntilChromeLoad();
|
||||
|
||||
PRBool locked = PR_FALSE;
|
||||
newWindow->GetLockedState(locked);
|
||||
webShellWindow->GetLockedState(locked);
|
||||
|
||||
// Push nsnull onto the JSContext stack before we dispatch a native event.
|
||||
nsCOMPtr<nsIJSContextStack> stack(do_GetService("nsThreadJSContextStack"));
|
||||
|
@ -1041,7 +1031,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(PRInt32 aChromeFlags,
|
|||
looprv = subShell->GetNativeEvent(isRealEvent, data);
|
||||
subShell->DispatchNativeEvent(isRealEvent, data);
|
||||
|
||||
newWindow->GetLockedState(locked);
|
||||
webShellWindow->GetLockedState(locked);
|
||||
}
|
||||
|
||||
JSContext *cx;
|
||||
|
@ -1055,7 +1045,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(PRInt32 aChromeFlags,
|
|||
// During the layout of the new window, all content shells were located and placed
|
||||
// into the new window's content shell array. Locate the "content area" content
|
||||
// shell.
|
||||
xulWindow->GetPrimaryContentShell(aDocShellTreeItem);
|
||||
newWindow->GetPrimaryContentShell(aDocShellTreeItem);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ protected:
|
|||
PRBool aPrimary, const PRUnichar* aID);
|
||||
NS_IMETHOD SizeShellTo(nsIDocShellTreeItem* aShellItem, PRInt32 aCX,
|
||||
PRInt32 aCY);
|
||||
NS_IMETHOD ShowModal();
|
||||
NS_IMETHOD ExitModalLoop();
|
||||
NS_IMETHOD GetNewWindow(PRInt32 aChromeFlags,
|
||||
nsIDocShellTreeItem** aDocShellTreeItem);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIPref.h"
|
||||
#include "plevent.h"
|
||||
#include "prmem.h"
|
||||
|
@ -61,6 +60,10 @@
|
|||
#include "nsIContentHandler.h"
|
||||
#include "nsIBrowserInstance.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
|
||||
#ifndef XP_MAC
|
||||
#include "nsTimeBomb.h"
|
||||
#endif
|
||||
|
@ -211,18 +214,20 @@ static nsresult OpenWindow( const char*urlstr, const PRUnichar *args ) {
|
|||
|
||||
static nsresult OpenChromURL( const char * urlstr, PRInt32 height = NS_SIZETOCONTENT, PRInt32 width = NS_SIZETOCONTENT )
|
||||
{
|
||||
nsIURI* url = nsnull;
|
||||
nsCOMPtr<nsIURI> url;
|
||||
nsresult rv;
|
||||
rv = NS_NewURI(&url, urlstr);
|
||||
rv = NS_NewURI(getter_AddRefs(url), urlstr);
|
||||
if ( NS_FAILED( rv ) )
|
||||
return rv;
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv);
|
||||
|
||||
nsCOMPtr<nsIAppShellService> appShell(do_GetService(kAppShellServiceCID));
|
||||
NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIXULWindow> newWindow;
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, url,
|
||||
PR_TRUE, PR_TRUE, NS_CHROME_ALL_CHROME,
|
||||
nsnull, width, height,
|
||||
getter_AddRefs(newWindow));
|
||||
NS_IF_RELEASE( url );
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
#include "nsIPrompt.h"
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIAppShell.h"
|
||||
|
@ -97,6 +96,10 @@
|
|||
#include "nsIPlatformCharset.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef XP_MAC
|
||||
#include <Timer.h>
|
||||
|
@ -2491,26 +2494,18 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// get a parent window for the new browser window
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
nsCOMPtr<nsIXULWindow> parent;
|
||||
appShell->GetHiddenWindow(getter_AddRefs(parent));
|
||||
|
||||
// convert it to a DOMWindow
|
||||
nsCOMPtr<nsIWebShell> webshell;
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
if (parent)
|
||||
{
|
||||
parent->GetWebShell(*getter_AddRefs(webshell));
|
||||
}
|
||||
nsCOMPtr<nsIDOMWindow> domParent;
|
||||
if (webshell)
|
||||
{
|
||||
parent->ConvertWebShellToDOMWindow(webshell, getter_AddRefs(domParent));
|
||||
}
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo;
|
||||
if (domParent)
|
||||
{
|
||||
// extract its JS context and create JS-flavor arguments
|
||||
sgo = do_QueryInterface(domParent);
|
||||
parent->GetDocShell(getter_AddRefs(docShell));
|
||||
}
|
||||
nsCOMPtr<nsIDOMWindow> domParent(do_GetInterface(docShell));
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(domParent));
|
||||
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
if (sgo)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "nspr.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsIBrowserWindow.h"
|
||||
|
@ -36,6 +35,9 @@
|
|||
#include "nsIIOService.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
//Interfaces Needed
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
|
||||
|
@ -52,7 +54,7 @@ static nsresult DisplayURI(const char *urlStr, PRBool block)
|
|||
NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> window;
|
||||
nsCOMPtr<nsIXULWindow> window;
|
||||
rv = appShell->CreateTopLevelWindow(nsnull,
|
||||
URL,
|
||||
PR_TRUE,
|
||||
|
|
Загрузка…
Ссылка в новой задаче