Bug #47636 --> add methods to convert back and forth between a nsIDocShellLoadTypeInfo

and a docshell load tye. Unify nsIURILoadCommand and nsIDocShellLoadType enums so they
can be treated as the same type.
r=radha, sr=rpotts
This commit is contained in:
mscott%netscape.com 2000-10-11 23:17:02 +00:00
Родитель 07637ef394
Коммит 8a9bc0d1c9
3 изменённых файлов: 81 добавлений и 9 удалений

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

@ -91,15 +91,12 @@ NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
nsLoadFlags loadAttribs = 0;
aOpenedChannel->GetLoadAttributes(&loadAttribs);
PRUint32 loadType = mDocShell->ConvertDocShellLoadInfoToLoadType((nsDocShellInfoLoadType) aCommand);
mDocShell->SetLoadType(loadType);
if(loadAttribs & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
{
mDocShell->StopLoad();
// ack...we don't want to reuse the previous documents load type,
// try to reset it to loadNormal...
LoadType loadType = LOAD_NORMAL;
if (aCommand == nsIURILoader::viewUserClick)
loadType = LOAD_LINK;
mDocShell->SetLoadType(loadType);
}
nsresult rv = mDocShell->CreateContentViewer(aContentType,

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

@ -260,6 +260,81 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
return NS_OK;
}
PRUint32 nsDocShell::ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType)
{
PRUint32 loadType = LOAD_NORMAL;
switch (aDocShellLoadType)
{
case nsIDocShellLoadInfo::loadNormal:
loadType = LOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadNormalReplace:
loadType = LOAD_NORMAL_REPLACE;
break;
case nsIDocShellLoadInfo::loadHistory:
loadType = LOAD_HISTORY;
break;
case nsIDocShellLoadInfo::loadReloadNormal:
loadType = LOAD_RELOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadReloadBypassCache:
loadType = LOAD_RELOAD_BYPASS_CACHE;
break;
case nsIDocShellLoadInfo::loadReloadBypassProxy:
loadType = LOAD_RELOAD_BYPASS_PROXY;
break;
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
loadType = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
break;
case nsIDocShellLoadInfo::loadLink:
loadType = LOAD_LINK;
break;
case nsIDocShellLoadInfo::loadRefresh:
loadType = LOAD_REFRESH;
break;
}
return loadType;
}
nsDocShellInfoLoadType nsDocShell::ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType)
{
nsDocShellInfoLoadType docShellLoadType = nsIDocShellLoadInfo::loadNormal;
switch (aLoadType)
{
case LOAD_NORMAL:
docShellLoadType = nsIDocShellLoadInfo::loadNormal;
break;
case LOAD_NORMAL_REPLACE:
docShellLoadType = nsIDocShellLoadInfo::loadNormalReplace;
break;
case LOAD_HISTORY:
docShellLoadType = nsIDocShellLoadInfo::loadHistory;
break;
case LOAD_RELOAD_NORMAL:
docShellLoadType = nsIDocShellLoadInfo::loadReloadNormal;
break;
case LOAD_RELOAD_BYPASS_CACHE:
docShellLoadType = nsIDocShellLoadInfo::loadReloadBypassCache;
break;
case LOAD_RELOAD_BYPASS_PROXY:
docShellLoadType = nsIDocShellLoadInfo::loadReloadBypassProxy;
break;
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
docShellLoadType = nsIDocShellLoadInfo::loadReloadBypassProxyAndCache;
break;
case LOAD_LINK:
docShellLoadType = nsIDocShellLoadInfo::loadLink;
break;
case LOAD_REFRESH:
docShellLoadType = nsIDocShellLoadInfo::loadRefresh;
break;
}
return docShellLoadType;
}
//*****************************************************************************
// nsDocShell::nsIDocShell
//*****************************************************************************
@ -2905,9 +2980,7 @@ NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer,
LSHE = aSHEntry;
#endif
nsURILoadCommand loadCmd = nsIURILoader::viewNormal;
if(LOAD_LINK == aLoadType)
loadCmd = nsIURILoader::viewUserClick;
nsDocShellInfoLoadType loadCmd = ConvertLoadTypeToDocShellLoadInfo(mLoadType);
NS_ENSURE_SUCCESS(DoURILoad(aURI, aReferrer, aOwner, aInheritOwner,
loadCmd, aWindowTarget,
aPostData, aHeadersData), NS_ERROR_FAILURE);

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

@ -177,6 +177,8 @@ public:
// used when the docshell gets content that's being redirected (so we don't go through
// our own InternalLoad method) to reset the load type...
nsresult SetLoadType(PRUint32 aLoadType);
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType);
PRUint32 ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType);
protected:
// Object Management