зеркало из https://github.com/mozilla/gecko-dev.git
Part of docshell/webshell landing prep work. The doc loader is being re-factored into the uri loader.
api synch of changes to nsIURIContentListener r=travis
This commit is contained in:
Родитель
96ecbd01d2
Коммит
83287af82d
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "nsDocShell.h"
|
||||
#include "nsDSURIContentListener.h"
|
||||
#include "nsIChannel.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDSURIContentListener: Object Management
|
||||
|
@ -103,6 +104,39 @@ NS_IMETHODIMP nsDSURIContentListener::CanHandleContent(const char* aContentType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDSURIContentListener::GetParentContentListener(nsIURIContentListener**
|
||||
aParentListener)
|
||||
{
|
||||
*aParentListener = mParentContentListener;
|
||||
NS_IF_ADDREF(*aParentListener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDSURIContentListener::SetParentContentListener(nsIURIContentListener*
|
||||
aParentListener)
|
||||
{
|
||||
// Weak Reference, don't addref
|
||||
mParentContentListener = aParentListener;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDSURIContentListener::GetLoadCookie(nsISupports ** aLoadCookie)
|
||||
{
|
||||
*aLoadCookie = mLoadCookie;
|
||||
NS_IF_ADDREF(*aLoadCookie);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDSURIContentListener::SetLoadCookie(nsISupports * aLoadCookie)
|
||||
{
|
||||
mLoadCookie = aLoadCookie;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDSURIContentListener: Helpers
|
||||
//*****************************************************************************
|
||||
|
@ -135,20 +169,6 @@ nsDocShell* nsDSURIContentListener::DocShell()
|
|||
return mDocShell;
|
||||
}
|
||||
|
||||
void nsDSURIContentListener::GetParentContentListener(nsIURIContentListener**
|
||||
aParentListener)
|
||||
{
|
||||
*aParentListener = mParentContentListener;
|
||||
NS_IF_ADDREF(*aParentListener);
|
||||
}
|
||||
|
||||
void nsDSURIContentListener::SetParentContentListener(nsIURIContentListener*
|
||||
aParentListener)
|
||||
{
|
||||
// Weak Reference, don't addref
|
||||
mParentContentListener = aParentListener;
|
||||
}
|
||||
|
||||
void nsDSURIContentListener::GetPresContext(nsIPresContext** aPresContext)
|
||||
{
|
||||
*aPresContext = mPresContext;
|
||||
|
|
|
@ -43,8 +43,6 @@ protected:
|
|||
|
||||
void DocShell(nsDocShell* aDocShell);
|
||||
nsDocShell* DocShell();
|
||||
void GetParentContentListener(nsIURIContentListener** aParentListener);
|
||||
void SetParentContentListener(nsIURIContentListener* aParentListener);
|
||||
void GetPresContext(nsIPresContext** aPresContext);
|
||||
void SetPresContext(nsIPresContext* aPresContext);
|
||||
PRBool HandleInCurrentDocShell(const char* aContentType,
|
||||
|
@ -54,6 +52,7 @@ protected:
|
|||
protected:
|
||||
nsDocShell* mDocShell;
|
||||
nsCOMPtr<nsIPresContext> mPresContext;
|
||||
nsCOMPtr<nsISupports> mLoadCookie; // the load cookie associated with the window context.
|
||||
|
||||
nsIURIContentListener* mParentContentListener; // Weak Reference
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsLayoutCID.h"
|
||||
|
@ -147,13 +148,17 @@ NS_IMETHODIMP nsDocShell::LoadURIVia(nsIURI* aUri,
|
|||
// first, open a channel for the url
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsCOMPtr<nsIInterfaceRequestor> capabilities (do_QueryInterface(NS_STATIC_CAST(nsIDocShell *, this)));
|
||||
nsCOMPtr<nsILoadGroup> loadGroup(do_QueryInterface(mLoadCookie));
|
||||
|
||||
// we need to get the load group from our load cookie so we can pass it into open uri...
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
NS_ENSURE_SUCCESS(uriLoader->GetLoadGroupForContext(NS_STATIC_CAST(nsISupports *, (nsIDocShell *) this), getter_AddRefs(loadGroup)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(NS_OpenURI(getter_AddRefs(channel), aUri, loadGroup, capabilities), NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
NS_ENSURE_SUCCESS(uriLoader->OpenURIVia(channel, nsIURILoader::viewNormal, nsnull,
|
||||
NS_STATIC_CAST(nsIDocShell*, this), mLoadCookie,
|
||||
getter_AddRefs(mLoadCookie), aAdapterBinding), NS_ERROR_FAILURE);
|
||||
NS_STATIC_CAST(nsIDocShell*, this), aAdapterBinding), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -356,8 +361,7 @@ NS_IMETHODIMP nsDocShell::GetParentURIContentListener(nsIURIContentListener**
|
|||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
NS_ENSURE_SUCCESS(EnsureContentListener(), NS_ERROR_FAILURE);
|
||||
|
||||
mContentListener->GetParentContentListener(aParent);
|
||||
return NS_OK;
|
||||
return mContentListener->GetParentContentListener(aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::SetParentURIContentListener(nsIURIContentListener*
|
||||
|
@ -365,8 +369,7 @@ NS_IMETHODIMP nsDocShell::SetParentURIContentListener(nsIURIContentListener*
|
|||
{
|
||||
NS_ENSURE_SUCCESS(EnsureContentListener(), NS_ERROR_FAILURE);
|
||||
|
||||
mContentListener->SetParentContentListener(aParent);
|
||||
return NS_OK;
|
||||
return mContentListener->SetParentContentListener(aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetPrefs(nsIPref** aPrefs)
|
||||
|
|
Загрузка…
Ссылка в новой задаче