Removed NewURI as it is no longer needed. Added new methods that are found in the interface for getting the currently loaded URI. Also made the changes to LoadURI* to match changes in the interface. Took advantage of the change to nsDSURIContentListener to set the presContext for the load. Made nsDSURIContentListener a friend class to avoid having to make some non-interface member functions public.

This commit is contained in:
tbogard%aol.net 1999-11-07 10:03:51 +00:00
Родитель 4977cd5b19
Коммит de7aa0b6fd
2 изменённых файлов: 28 добавлений и 19 удалений

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

@ -65,15 +65,15 @@ NS_IMPL_ISUPPORTS6(nsDocShellBase, nsIDocShell, nsIDocShellEdit,
// nsDocShellBase::nsIDocShell
//*****************************************************************************
NS_IMETHODIMP nsDocShellBase::LoadURI(const PRUnichar* uri,
NS_IMETHODIMP nsDocShellBase::LoadURI(nsIURI* aUri,
nsIPresContext* presContext)
{
//NS_ENSURE_ARG(uri); // Done in LoadURIVia for us.
//NS_ENSURE_ARG(aUri); // Done in LoadURIVia for us.
return LoadURIVia(uri, presContext, 0);
return LoadURIVia(aUri, presContext, 0);
}
NS_IMETHODIMP nsDocShellBase::LoadURIVia(const PRUnichar* aUri,
NS_IMETHODIMP nsDocShellBase::LoadURIVia(nsIURI* aUri,
nsIPresContext* aPresContext, PRUint32 aAdapterBinding)
{
NS_ENSURE_ARG(aUri);
@ -83,17 +83,13 @@ NS_IMETHODIMP nsDocShellBase::LoadURIVia(const PRUnichar* aUri,
nsnull, NS_GET_IID(nsIURILoader), getter_AddRefs(uriLoader)),
NS_ERROR_FAILURE);
nsCOMPtr<nsIURI> uri;
NS_ENSURE_SUCCESS(NewURI(aUri, getter_AddRefs(uri)), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(EnsureContentListener(), NS_ERROR_FAILURE);
mContentListener->SetPresContext(aPresContext);
/*
Call uriloader passing mContentListener as the nsIURIContentListener
uriLoader->OpenURI(uri, nsnull, nsnull,
*/
NS_ENSURE_SUCCESS(uriLoader->OpenURI(aUri, nsnull, nsnull, nsnull, nsnull,
nsnull, mContentListener, nsnull), NS_ERROR_FAILURE);
return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsDocShellBase::GetDocument(nsIDOMDocument** aDocument)
@ -114,6 +110,16 @@ NS_IMETHODIMP nsDocShellBase::GetDocument(nsIDOMDocument** aDocument)
return NS_OK;
}
NS_IMETHODIMP nsDocShellBase::GetCurrentURI(nsIURI** aURI)
{
NS_ENSURE_ARG_POINTER(aURI);
*aURI = mCurrentURI;
NS_IF_ADDREF(*aURI);
return NS_OK;
}
// SetDocument is only meaningful for doc shells that support DOM documents. Not all do.
NS_IMETHODIMP nsDocShellBase::SetDocument(nsIDOMDocument* aDocument,
nsIPresContext* presContext)
@ -1116,12 +1122,6 @@ nsresult nsDocShellBase::GetPresShell(nsIPresShell** aPresShell)
return NS_OK;
}
nsresult nsDocShellBase::NewURI(const PRUnichar* aUri, nsIURI** aURI)
{
//XXX Get new URI
return NS_ERROR_FAILURE;
}
nsresult nsDocShellBase::EnsureContentListener()
{
if(mContentListener)
@ -1136,3 +1136,8 @@ nsresult nsDocShellBase::EnsureContentListener()
return NS_OK;
}
void nsDocShellBase::SetCurrentURI(nsIURI* aUri)
{
mCurrentURI = aUri; //This assignment addrefs
}

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

@ -56,6 +56,8 @@ class nsDocShellBase : public nsIDocShell, public nsIDocShellEdit,
public nsIDocShellFile, public nsIGenericWindow, public nsIScrollable,
public nsITextScroll
{
friend class nsDSURIContentListener;
public:
NS_DECL_ISUPPORTS
@ -74,9 +76,10 @@ protected:
PRInt32* aOffset);
nsresult GetRootScrollableView(nsIScrollableView** aOutScrollView);
nsresult GetPresShell(nsIPresShell** aPresShell);
nsresult NewURI(const PRUnichar* aUri, nsIURI** aURI);
nsresult EnsureContentListener();
void SetCurrentURI(nsIURI* aUri);
protected:
PRBool mCreated;
nsString mName;
@ -85,6 +88,7 @@ protected:
nsCOMPtr<nsIContentViewer> mContentViewer;
nsCOMPtr<nsIWidget> mParentWidget;
nsCOMPtr<nsIPref> mPrefs;
nsCOMPtr<nsIURI> mCurrentURI;
/* Note this can not be nsCOMPtr as that that would cause an addref on the
parent thus a cycle. A weak reference would work, but not required as the