Added nsINetContainerApplication interface and a way for netlib to get the user agent, etc. from the containing application

This commit is contained in:
vidur 1998-07-01 23:56:46 +00:00
Родитель b091a85533
Коммит 4c7e68b811
2 изменённых файлов: 60 добавлений и 1 удалений

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

@ -61,6 +61,8 @@
#include "nsIViewManager.h"
#include "nsGfxCIID.h"
#include "nsIDeviceContext.h"
#include "nsINetService.h"
#include "nsINetContainerApplication.h"
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
static NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID);
@ -705,6 +707,10 @@ void nsViewer::ProcessArguments(int argc, char **argv)
// nsViewer Implementation
//----------------------------------------------------------------------
static NS_DEFINE_IID(kINetContainerApplicationIID, NS_INETCONTAINERAPPLICATION_IID);
NS_IMPL_ISUPPORTS(nsViewer, kINetContainerApplicationIID);
/*
* Purify methods
*/
@ -1147,6 +1153,8 @@ void nsViewer::CleanupViewer(nsDocLoader* aDl)
if (aDl != nsnull)
delete aDl;
ReleaseMemory();
NS_ShutdownINetService();
}
@ -1156,6 +1164,8 @@ nsDocLoader* nsViewer::SetupViewer(nsIWidget **aMainWindow, int argc, char **arg
PL_InitializeEventsLib("");
#endif
NS_InitINetService(this);
gWindows = new nsVoidArray();
NSRepository::RegisterFactory(kCWindowIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
@ -1337,3 +1347,42 @@ void SetViewer(nsViewer* aViewer)
gTheViewer = aViewer;
}
NS_IMETHODIMP
nsViewer::GetAppCodeName(nsString& aAppCodeName)
{
aAppCodeName.SetString("Mozilla");
return NS_OK;
}
NS_IMETHODIMP
nsViewer::GetAppVersion(nsString& aAppVersion)
{
aAppVersion.SetString("5.0 [en] (Windows;I)");
return NS_OK;
}
NS_IMETHODIMP
nsViewer::GetAppName(nsString& aAppName)
{
aAppName.SetString("Netscape");
return NS_OK;
}
NS_IMETHODIMP
nsViewer::GetLanguage(nsString& aLanguage)
{
aLanguage.SetString("en");
return NS_OK;
}
NS_IMETHODIMP
nsViewer::GetPlatform(nsString& aPlatform)
{
aPlatform.SetString("Win32");
return NS_OK;
}

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

@ -26,6 +26,7 @@
#include "nsDocLoader.h"
#include "nsIAppShell.h"
#include "nsString.h"
#include "nsINetContainerApplication.h"
#ifdef XP_PC
#define WIDGET_DLL "raptorwidget.dll"
@ -134,8 +135,11 @@ struct WindowData {
void ShowStyleSize();
};
class nsViewer : public nsDispatchListener {
class nsViewer : public nsINetContainerApplication, public nsDispatchListener {
public:
// nsISupports
NS_DECL_ISUPPORTS
virtual char* GetBaseURL();
virtual char* GetDefaultStartURL();
virtual void AddMenu(nsIWidget* aMainWindow, PRBool aForPrintPreview);
@ -167,6 +171,12 @@ class nsViewer : public nsDispatchListener {
virtual void OpenHTMLFile(WindowData* wd);
virtual void SelectAll(WindowData* wd);
virtual void ProcessArguments(int argc, char **argv);
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName);
NS_IMETHOD GetAppVersion(nsString& aAppVersion);
NS_IMETHOD GetAppName(nsString& aAppName);
NS_IMETHOD GetLanguage(nsString& aLanguage);
NS_IMETHOD GetPlatform(nsString& aPlatform);
};
// Set the single viewer.