Support (in a shaky way) some various and sundry mime types for plugins

This commit is contained in:
kipp%netscape.com 1998-09-09 23:51:43 +00:00
Родитель 3fa1dd6425
Коммит 406fcd2c21
2 изменённых файлов: 120 добавлений и 18 удалений

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

@ -178,6 +178,13 @@ public:
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
nsresult CreatePluginDocument(nsIURL* aURL,
const char* aCommand,
const char* aContentType,
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
};
static nsIStyleSheet* gUAStyleSheet;
@ -196,6 +203,24 @@ static char* gValidTypes[] = {"text/html","text/xml","application/rtf",0};
static char* gImageTypes[] = {"image/gif", "image/jpeg", 0 };
static char* gPluginTypes[] = {
"video/quicktime",
"video/msvideo",
"video/x-msvideo",
"application/vnd.netfpx",
"image/vnd.fpx",
"model/vrml",
"x-world/x-vrml",
"audio/midi",
"audio/x-midi",
"audio/wav",
"audio/x-wav",
"audio/aiff",
"audio/x-aiff",
"audio/basic",
0
};
NS_IMETHODIMP
nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
const char* aContentType,
@ -215,7 +240,7 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
}
}
// Try secondary types
// Try image types
typeIndex = 0;
while(gImageTypes[typeIndex]) {
if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) {
@ -225,6 +250,17 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
aDocViewer);
}
}
// Try plugin types
typeIndex = 0;
while(gPluginTypes[typeIndex]) {
if (0== PL_strcmp(gPluginTypes[typeIndex++], aContentType)) {
return CreatePluginDocument(aURL, aCommand, aContentType,
aContainer,
aDocListener,
aDocViewer);
}
}
goto done;
nextstep:
@ -329,6 +365,28 @@ done:
return rv;
}
extern nsresult
NS_NewPluginContentViewer(const char* aCommand,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
nsresult
nsDocFactoryImpl::CreatePluginDocument(nsIURL* aURL,
const char* aCommand,
const char* aContentType,
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
{
/*
* Create the plugin content viewer and stream listener...
*/
nsresult rv = NS_NewPluginContentViewer(aCommand,
aDocListener,
aDocViewer);
return rv;
}
#define UA_CSS_URL "resource:/res/ua.css"
nsresult nsDocFactoryImpl::InitUAStyleSheet()
@ -803,14 +861,7 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
* end nsIContentViewerContainer for refreshing urls.
*/
if (m_Container) {
nsISupports* container = nsnull;
rv = m_Container->QueryInterface(kISupportsIID, (void**)&container);
if (rv != NS_OK) {
return rv;
}
rv = NS_NewURL(&m_Url, aURLSpec, container);
NS_RELEASE(container);
container = nsnull;
rv = NS_NewURL(&m_Url, aURLSpec, m_Container);
if (NS_OK != rv) {
return rv;
}

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

@ -178,6 +178,13 @@ public:
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
nsresult CreatePluginDocument(nsIURL* aURL,
const char* aCommand,
const char* aContentType,
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
};
static nsIStyleSheet* gUAStyleSheet;
@ -196,6 +203,24 @@ static char* gValidTypes[] = {"text/html","text/xml","application/rtf",0};
static char* gImageTypes[] = {"image/gif", "image/jpeg", 0 };
static char* gPluginTypes[] = {
"video/quicktime",
"video/msvideo",
"video/x-msvideo",
"application/vnd.netfpx",
"image/vnd.fpx",
"model/vrml",
"x-world/x-vrml",
"audio/midi",
"audio/x-midi",
"audio/wav",
"audio/x-wav",
"audio/aiff",
"audio/x-aiff",
"audio/basic",
0
};
NS_IMETHODIMP
nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
const char* aContentType,
@ -215,7 +240,7 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
}
}
// Try secondary types
// Try image types
typeIndex = 0;
while(gImageTypes[typeIndex]) {
if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) {
@ -225,6 +250,17 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
aDocViewer);
}
}
// Try plugin types
typeIndex = 0;
while(gPluginTypes[typeIndex]) {
if (0== PL_strcmp(gPluginTypes[typeIndex++], aContentType)) {
return CreatePluginDocument(aURL, aCommand, aContentType,
aContainer,
aDocListener,
aDocViewer);
}
}
goto done;
nextstep:
@ -329,6 +365,28 @@ done:
return rv;
}
extern nsresult
NS_NewPluginContentViewer(const char* aCommand,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer);
nsresult
nsDocFactoryImpl::CreatePluginDocument(nsIURL* aURL,
const char* aCommand,
const char* aContentType,
nsIContentViewerContainer* aContainer,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
{
/*
* Create the plugin content viewer and stream listener...
*/
nsresult rv = NS_NewPluginContentViewer(aCommand,
aDocListener,
aDocViewer);
return rv;
}
#define UA_CSS_URL "resource:/res/ua.css"
nsresult nsDocFactoryImpl::InitUAStyleSheet()
@ -803,14 +861,7 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
* end nsIContentViewerContainer for refreshing urls.
*/
if (m_Container) {
nsISupports* container = nsnull;
rv = m_Container->QueryInterface(kISupportsIID, (void**)&container);
if (rv != NS_OK) {
return rv;
}
rv = NS_NewURL(&m_Url, aURLSpec, container);
NS_RELEASE(container);
container = nsnull;
rv = NS_NewURL(&m_Url, aURLSpec, m_Container);
if (NS_OK != rv) {
return rv;
}