Bugs 70379, 70380 - Hide nsISingleSignon from embedding apps, split auth prompting methods out of nsIPrompt into a new interface. r=valeski, sr=rpotts.

git-svn-id: svn://10.0.0.236/trunk@91893 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ccarlen%netscape.com
2001-04-10 18:30:25 +00:00
parent 64e2e50b2b
commit d0cf8c7fff
75 changed files with 1111 additions and 741 deletions

View File

@@ -25,6 +25,7 @@
// Local Includes
#include "nsDocShellTreeOwner.h"
#include "nsWebBrowser.h"
#include "nsNonPersistAuthPrompt.h"
// Helper Classes
#include "nsIGenericFactory.h"
@@ -53,6 +54,8 @@
#include "nsIScriptGlobalObject.h"
#include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h"
#include "nsIPrompt.h"
#include "nsIWalletService.h"
static char *sWindowWatcherContractID = "@mozilla.org/embedcomp/window-watcher;1";
@@ -108,8 +111,31 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
if(NS_SUCCEEDED(QueryInterface(aIID, aSink)))
return NS_OK;
if(mOwnerRequestor)
if(mOwnerRequestor) {
if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
if (!mAuthPrompter) {
// Get the prompt UI from the owner
nsCOMPtr<nsIPrompt> prompt;
nsresult rv = mOwnerRequestor->GetInterface(NS_GET_IID(nsIPrompt), getter_AddRefs(prompt));
if (NS_FAILED(rv)) return rv;
// Attempt to create a single signon. If that fails, create a simple non-persistent nsIAuthPrompt.
mAuthPrompter = do_CreateInstance(NS_SINGLESIGNONPROMPT_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
mAuthPrompter = new nsNonPersistAuthPrompt;
NS_ENSURE_TRUE(mAuthPrompter, NS_ERROR_OUT_OF_MEMORY);
}
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISingleSignOnPrompt> siPrompt(do_QueryInterface(mAuthPrompter));
if (NS_FAILED(rv)) return rv;
siPrompt->SetPromptDialogs(prompt);
}
return mAuthPrompter->QueryInterface(aIID, aSink);
}
return mOwnerRequestor->GetInterface(aIID, aSink);
}
return NS_NOINTERFACE;
}