From 5a91e6e10aa69cc94616c4b1ed1324c0ccb987ab Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Wed, 7 Oct 1998 23:19:39 +0000 Subject: [PATCH] Removed the nsINetContainerApplication interface. The methods that were part of this interface are now implemented by nsINetService. Changed mozilla\network\module\makefiles so they no longer export nsINetContainerApplication.h. M dom/src/base/nsGlobalWindow.cpp Changed javascript so it retreives the user-agent tokens via nsINetService. M network/module/nsINetService.h Added the application user-agent token methods to the nsINetService interface. M network/module/nsNetFactory.cpp The netservice constructor no longer takes a pointer to a nsINetContainerApplication. M network/module/nsNetService.cpp M network/module/nsNetService.h Added the implementation of the application user-agent token methods. M webshell/tests/viewer/nsViewerApp.cpp M webshell/tests/viewer/nsViewerApp.h Removed old containerapplication implementation M xpfe/xpviewer/src/nsViewerApp.cpp M xpfe/xpviewer/src/nsViewerApp.h Removed old containerapplication implementation git-svn-id: svn://10.0.0.236/trunk@12240 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/src/base/nsGlobalWindow.cpp | 64 +----- mozilla/network/module/MANIFEST | 1 - mozilla/network/module/Makefile | 1 - mozilla/network/module/Makefile.in | 1 - mozilla/network/module/makefile.win | 1 - .../module/nsINetContainerApplication.h | 78 -------- mozilla/network/module/nsINetService.h | 67 +++++-- mozilla/network/module/nsNetFactory.cpp | 2 +- mozilla/network/module/nsNetService.cpp | 185 ++++++++---------- mozilla/network/module/nsNetService.h | 14 +- mozilla/webshell/tests/viewer/nsViewerApp.cpp | 51 +---- mozilla/webshell/tests/viewer/nsViewerApp.h | 11 +- mozilla/xpfe/xpviewer/src/nsViewerApp.cpp | 51 +---- mozilla/xpfe/xpviewer/src/nsViewerApp.h | 11 +- 14 files changed, 165 insertions(+), 373 deletions(-) delete mode 100644 mozilla/network/module/nsINetContainerApplication.h diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index d92af624e28..507703f7fbf 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -29,7 +29,6 @@ #include "nsIDOMDocument.h" #include "nsINetService.h" #include "nsIServiceManager.h" -#include "nsINetContainerApplication.h" #include "nsITimer.h" #include "nsEventListenerManager.h" #include "nsIEventStateManager.h" @@ -1880,20 +1879,12 @@ NavigatorImpl::GetUserAgent(nsString& aUserAgent) (nsISupports **)&service); if ((NS_OK == res) && (nsnull != service)) { - - nsINetContainerApplication *container; - res = service->GetContainerApplication(&container); - if ((NS_OK == res) && (nsnull != container)) { - - if (NS_OK == (res = container->GetAppCodeName(aUserAgent)) ) { - - nsAutoString appVersion; - if (NS_OK == (res = container->GetAppVersion(appVersion)) ) { - aUserAgent.Append('/'); - aUserAgent.Append(appVersion); - } + if (NS_OK == (res = service->GetAppCodeName(aUserAgent)) ) { + nsAutoString appVersion; + if (NS_OK == (res = service->GetAppVersion(appVersion)) ) { + aUserAgent.Append('/'); + aUserAgent.Append(appVersion); } - NS_RELEASE(container); } NS_RELEASE(service); } @@ -1909,14 +1900,7 @@ NavigatorImpl::GetAppCodeName(nsString& aAppCodeName) (nsISupports **)&service); if ((NS_OK == res) && (nsnull != service)) { - - nsINetContainerApplication *container; - res = service->GetContainerApplication(&container); - if ((NS_OK == res) && (nsnull != container)) { - - res = container->GetAppCodeName(aAppCodeName); - NS_RELEASE(container); - } + res = service->GetAppCodeName(aAppCodeName); NS_RELEASE(service); } @@ -1932,14 +1916,7 @@ NavigatorImpl::GetAppVersion(nsString& aAppVersion) (nsISupports **)&service); if ((NS_OK == res) && (nsnull != service)) { - - nsINetContainerApplication *container; - res = service->GetContainerApplication(&container); - if ((NS_OK == res) && (nsnull != container)) { - - res = container->GetAppVersion(aAppVersion); - NS_RELEASE(container); - } + res = service->GetAppVersion(aAppVersion); NS_RELEASE(service); } @@ -1955,14 +1932,7 @@ NavigatorImpl::GetAppName(nsString& aAppName) (nsISupports **)&service); if ((NS_OK == res) && (nsnull != service)) { - - nsINetContainerApplication *container; - res = service->GetContainerApplication(&container); - if ((NS_OK == res) && (nsnull != container)) { - - res = container->GetAppName(aAppName); - NS_RELEASE(container); - } + res = service->GetAppName(aAppName); NS_RELEASE(service); } @@ -1978,14 +1948,7 @@ NavigatorImpl::GetLanguage(nsString& aLanguage) (nsISupports **)&service); if ((NS_OK == res) && (nsnull != service)) { - - nsINetContainerApplication *container; - res = service->GetContainerApplication(&container); - if ((NS_OK == res) && (nsnull != container)) { - - res = container->GetLanguage(aLanguage); - NS_RELEASE(container); - } + res = service->GetLanguage(aLanguage); NS_RELEASE(service); } @@ -2001,14 +1964,7 @@ NavigatorImpl::GetPlatform(nsString& aPlatform) (nsISupports **)&service); if ((NS_OK == res) && (nsnull != service)) { - - nsINetContainerApplication *container; - res = service->GetContainerApplication(&container); - if ((NS_OK == res) && (nsnull != container)) { - - res = container->GetPlatform(aPlatform); - NS_RELEASE(container); - } + res = service->GetPlatform(aPlatform); NS_RELEASE(service); } diff --git a/mozilla/network/module/MANIFEST b/mozilla/network/module/MANIFEST index b9869b7e578..5277288c187 100644 --- a/mozilla/network/module/MANIFEST +++ b/mozilla/network/module/MANIFEST @@ -9,7 +9,6 @@ nsIRelatedLinks.h nsIURL.h nsIPostToServer.h nsIHttpUrl.h -nsINetContainerApplication.h nsIRefreshUrl.h nsIConnectionInfo.h nsILoadAttribs.h diff --git a/mozilla/network/module/Makefile b/mozilla/network/module/Makefile index e6f7b8f32f0..09dc054eafd 100644 --- a/mozilla/network/module/Makefile +++ b/mozilla/network/module/Makefile @@ -45,7 +45,6 @@ EXPORTS = nsIStreamListener.h \ nsIRelatedLinks.h \ nsIPostToServer.h \ nsIHttpUrl.h \ - nsINetContainerApplication.h \ nsIRefreshUrl.h \ nsIConnectionInfo.h \ nsILoadAttribs.h \ diff --git a/mozilla/network/module/Makefile.in b/mozilla/network/module/Makefile.in index f431fcd0b00..1f42029fd0e 100644 --- a/mozilla/network/module/Makefile.in +++ b/mozilla/network/module/Makefile.in @@ -50,7 +50,6 @@ EXPORTS = nsIStreamListener.h \ nsIRelatedLinks.h \ nsIPostToServer.h \ nsIHttpUrl.h \ - nsINetContainerApplication.h \ nsIRefreshUrl.h \ nsIConnectionInfo.h \ nsILoadAttribs.h \ diff --git a/mozilla/network/module/makefile.win b/mozilla/network/module/makefile.win index 6022da1e112..6fc0fe2dade 100644 --- a/mozilla/network/module/makefile.win +++ b/mozilla/network/module/makefile.win @@ -29,7 +29,6 @@ EXPORTS = nsIStreamListener.h \ nsIPostToServer.h \ nsIHttpUrl.h \ nsIRelatedLinks.h \ - nsINetContainerApplication.h \ nsIRefreshUrl.h \ nsIConnectionInfo.h \ nsINetFile.h \ diff --git a/mozilla/network/module/nsINetContainerApplication.h b/mozilla/network/module/nsINetContainerApplication.h deleted file mode 100644 index 6588ec4d781..00000000000 --- a/mozilla/network/module/nsINetContainerApplication.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsINetContainerApplication_h__ -#define nsINetContainerApplication_h__ - -#include "nsISupports.h" -#include "nsString.h" - -#define NS_INETCONTAINERAPPLICATION_IID \ -{ 0xca2610f0, 0x1054, 0x11d2, \ - { 0xb3, 0x26, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59 } } - -class nsINetContainerApplication : public nsISupports { -public: - - /** - * Get the application name string that will be used as part - * of a HTTP request. - * - * @param aAppCodeName The application name string. - * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. - */ - NS_IMETHOD GetAppCodeName(nsString& aAppCodeName)=0; - - /** - * Get the application version string that will be used as part - * of a HTTP request. - * - * @param aAppVersion The application version string. - * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. - */ - NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0; - - /** - * Get the application name. - * - * @param aAppName The application name. - * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. - */ - NS_IMETHOD GetAppName(nsString& aAppName)=0; - - /** - * Get the translation of the application. The value for language - * is usually a 2-letter code such as "en" and occasionally a - * five-character code to indicate a language subtype, such as "zh_CN". - * - * @param aLanguage The application language. - * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. - */ - NS_IMETHOD GetLanguage(nsString& aLanguage)=0; - - /** - * Get the current platform (machine type). - * - * @param aPlatform The current platform. - * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. - */ - NS_IMETHOD GetPlatform(nsString& aPlatform)=0; - -}; - -#endif // nsINetContainerApplication_h__ diff --git a/mozilla/network/module/nsINetService.h b/mozilla/network/module/nsINetService.h index 637f1b2412c..40f81377a29 100644 --- a/mozilla/network/module/nsINetService.h +++ b/mozilla/network/module/nsINetService.h @@ -40,8 +40,6 @@ {0x9e, 0x7e, 0x00, 0x60, 0x08, 0xbf, 0x09, 0x2e} } -class nsINetContainerApplication; - /** * The nsINetService interface provides an API to the networking service. * This is a preliminary interface which will change over time! @@ -75,15 +73,6 @@ struct nsINetService : public nsISupports nsIStreamListener *aConsumer, nsIInputStream **aNewStream) = 0; - /** - * Get the container application for the net service. - * - * @param aContainer An output parameter to receive the container - * application. - * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. - */ - NS_IMETHOD GetContainerApplication(nsINetContainerApplication **aContainer)=0; - /** * Get the complete cookie string associated with the URL * @@ -137,6 +126,60 @@ struct nsINetService : public nsISupports * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. */ NS_IMETHOD SetHTTPOneOne(PRBool aSendOneOne)=0; + + /** + * Get the application name string that will be used as part + * of a HTTP request. + * + * @param aAppCodeName The application name string. + * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. + */ + NS_IMETHOD GetAppCodeName(nsString& aAppCodeName)=0; + + /** + * Get the application version string that will be used as part + * of a HTTP request. + * + * @param aAppVersion The application version string. + * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. + */ + NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0; + + /** + * Get the application name. + * + * @param aAppName The application name. + * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. + */ + NS_IMETHOD GetAppName(nsString& aAppName)=0; + + /** + * Get the translation of the application. The value for language + * is usually a 2-letter code such as "en" and occasionally a + * five-character code to indicate a language subtype, such as "zh_CN". + * + * @param aLanguage The application language. + * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. + */ + NS_IMETHOD GetLanguage(nsString& aLanguage)=0; + + /** + * Get the current platform (machine type). + * + * @param aPlatform The current platform. + * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. + */ + NS_IMETHOD GetPlatform(nsString& aPlatform)=0; + + /** + * Add a string to the user agent AppVersion. + * + * @param aCustom The string to be inserted into the AppVersion portion + * of the user agent string. A user-agent of the form: + * Mozilla/x.x [en] (OS; I) becomes Mozilla/x.x [en]C-aCustom (OS; I) + * @return Returns NS_OK if successful, or NS_FALSE if an error occurred. + */ + NS_IMETHOD SetCustomUserAgent(nsString aCustom)=0; }; @@ -147,7 +190,7 @@ struct nsINetService : public nsISupports extern "C" NS_NET nsresult NS_NewINetService(nsINetService** aInstancePtrResult, nsISupports* aOuter); -extern "C" NS_NET nsresult NS_InitINetService(nsINetContainerApplication *aContainer); +extern "C" NS_NET nsresult NS_InitINetService(); extern "C" NS_NET nsresult NS_ShutdownINetService(); diff --git a/mozilla/network/module/nsNetFactory.cpp b/mozilla/network/module/nsNetFactory.cpp index 12ee54f24cd..6b63603f4e3 100644 --- a/mozilla/network/module/nsNetFactory.cpp +++ b/mozilla/network/module/nsNetFactory.cpp @@ -125,7 +125,7 @@ nsresult nsNetFactory::CreateInstance(nsISupports *aOuter, if (mClassID.Equals(kNetServiceCID)) { // No need create a new one if we've already got one. if (!gNetlibService) { - res = NS_InitINetService(nsnull); + res = NS_InitINetService(); if (res != NS_OK) return NS_ERROR_FAILURE; } diff --git a/mozilla/network/module/nsNetService.cpp b/mozilla/network/module/nsNetService.cpp index 79e42d36161..87089b0b423 100644 --- a/mozilla/network/module/nsNetService.cpp +++ b/mozilla/network/module/nsNetService.cpp @@ -39,7 +39,6 @@ extern "C" { #include "nsString.h" #include "nsIProtocolConnection.h" -#include "nsINetContainerApplication.h" #ifdef XP_PC #include @@ -99,7 +98,7 @@ extern const char *XP_AppPlatform; static NS_DEFINE_IID(kIProtocolConnectionIID, NS_IPROTOCOLCONNECTION_IID); -nsNetlibService::nsNetlibService(nsINetContainerApplication *aContainerApp) +nsNetlibService::nsNetlibService() { NS_INIT_REFCNT(); @@ -107,7 +106,6 @@ nsNetlibService::nsNetlibService(nsINetContainerApplication *aContainerApp) m_stubContext = new_stub_context(); */ mPollingTimer = nsnull; - mContainer = nsnull; mNetlibThread = new nsNetlibThread(); if (nsnull != mNetlibThread) { @@ -136,35 +134,33 @@ nsNetlibService::nsNetlibService(nsINetContainerApplication *aContainerApp) PREF_SetDefaultCharPref(pref_padPacURL, ""); PREF_SetDefaultCharPref(pref_scriptName, ""); - if (NULL != aContainerApp) { - XP_AppCodeName = NULL; - XP_AppVersion = NULL; - XP_AppName = NULL; - XP_AppLanguage = NULL; - XP_AppPlatform = NULL; + // XXX: Where should the defaults really come from + XP_AppCodeName = PL_strdup("Mozilla"); + XP_AppName = PL_strdup("Netscape"); - SetContainerApplication(aContainerApp); - } - else { - // XXX: Where should the defaults really come from - XP_AppCodeName = PL_strdup("Mozilla"); - XP_AppVersion = PL_strdup("5.0 Netscape/5.0 (Windows;I;x86;en)"); - XP_AppName = PL_strdup("Netscape"); - - /* - * XXX: Some of these should come from resources and/or - * platform-specific code. - */ - XP_AppLanguage = PL_strdup("en"); + /* + * XXX: Some of these should come from resources and/or + * platform-specific code. + */ + XP_AppLanguage = PL_strdup("en"); #ifdef XP_WIN - XP_AppPlatform = PL_strdup("Win32"); + XP_AppPlatform = PL_strdup("Win32s"); #elif defined(XP_MAC) - XP_AppPlatform = PL_strdup("MacPPC"); + XP_AppPlatform = PL_strdup("MacPPC"); #elif defined(XP_UNIX) - /* XXX: Need to differentiate between various Unisys */ - XP_AppPlatform = PL_strdup("Unix"); + /* XXX: Need to differentiate between various Unisys */ + XP_AppPlatform = PL_strdup("Unix"); #endif - } + + /* Build up the appversion. */ + char buf[64]; + sprintf(buf, "%s/4.05 [%s] (%s; I)", + XP_AppCodeName, + XP_AppLanguage, + XP_AppPlatform); + if (XP_AppVersion) + PR_Free(XP_AppVersion); + XP_AppVersion = PL_strdup(buf); } @@ -184,7 +180,6 @@ nsNetlibService::~nsNetlibService() */ NS_IF_RELEASE(mPollingTimer); - NS_IF_RELEASE(mContainer); if (nsnull != mNetlibThread) { mNetlibThread->Stop(); @@ -490,62 +485,6 @@ loser: return NS_FALSE; } -NS_IMETHODIMP -nsNetlibService::GetContainerApplication(nsINetContainerApplication **aContainer) -{ - NS_LOCK_INSTANCE(); - *aContainer = mContainer; - NS_IF_ADDREF(*aContainer); - NS_UNLOCK_INSTANCE(); - - return NS_OK; -} - -nsresult -nsNetlibService::SetContainerApplication(nsINetContainerApplication *aContainer) -{ - NS_LOCK_INSTANCE(); - - NS_IF_RELEASE(mContainer); - - mContainer = aContainer; - NS_IF_ADDREF(mContainer); - NS_VERIFY_THREADSAFE_INTERFACE(mContainer); - - if (mContainer) { - nsAutoString str; - - if (XP_AppCodeName) { - PR_Free((void *)XP_AppCodeName); - } - mContainer->GetAppCodeName(str); - XP_AppCodeName = str.ToNewCString(); - if (XP_AppVersion) { - PR_Free((void *)XP_AppVersion); - } - mContainer->GetAppVersion(str); - XP_AppVersion = str.ToNewCString(); - if (XP_AppName) { - PR_Free((void *)XP_AppName); - } - mContainer->GetAppName(str); - XP_AppName = str.ToNewCString(); - if (XP_AppPlatform) { - PR_Free((void *)XP_AppPlatform); - } - mContainer->GetPlatform(str); - XP_AppPlatform = str.ToNewCString(); - if (XP_AppLanguage) { - PR_Free((void *)XP_AppLanguage); - } - mContainer->GetLanguage(str); - XP_AppLanguage = str.ToNewCString(); - } - - NS_UNLOCK_INSTANCE(); - return NS_OK; -} - NS_IMETHODIMP nsNetlibService::GetCookieString(nsIURL *aURL, nsString& aCookie) { @@ -669,6 +608,65 @@ nsNetlibService::SetHTTPOneOne(PRBool aSendOneOne) { return NS_OK; } +NS_IMETHODIMP +nsNetlibService::GetAppCodeName(nsString& aAppCodeName) +{ + aAppCodeName.SetString("Mozilla"); + return NS_OK; +} + +NS_IMETHODIMP +nsNetlibService::GetAppVersion(nsString& aAppVersion) +{ + //This seems kinda wrong in x-platform code + aAppVersion.SetString("4.05 [en] (WinNT;I)"); + return NS_OK; +} + +NS_IMETHODIMP +nsNetlibService::GetAppName(nsString& aAppName) +{ + aAppName.SetString("Netscape"); + return NS_OK; +} + +NS_IMETHODIMP +nsNetlibService::GetLanguage(nsString& aLanguage) +{ + aLanguage.SetString("en"); + return NS_OK; +} + +NS_IMETHODIMP +nsNetlibService::GetPlatform(nsString& aPlatform) +{ + //This seems kinda wrong in x-platform code + aPlatform.SetString("Win32"); + return NS_OK; +} + +NS_IMETHODIMP +nsNetlibService::SetCustomUserAgent(nsString aCustom) +{ + PRInt32 inIdx; + PRUnichar inChar = ']'; + + if (!XP_AppVersion || (0 >= aCustom.Length()) ) + return NS_FALSE; + + nsString newAppVersion = XP_AppVersion; + + inIdx = newAppVersion.Find(inChar); + if (0 > inIdx) { + newAppVersion.Insert(aCustom, inIdx + 1); + } + + PR_Free(XP_AppVersion); + XP_AppVersion = newAppVersion.ToNewCString(); + return NS_OK; + +} + void nsNetlibService::SchedulePollingTimer() { #if !defined(NETLIB_THREAD) @@ -773,7 +771,7 @@ struct nsNetlibInit { * since a runtime library lock is being held by the mozilla thread * which results in a deadlock when the netlib thread is started... */ - (void) NS_InitINetService(nsnull); + (void) NS_InitINetService(); #endif /* !NETLIB_THREAD */ } @@ -811,39 +809,30 @@ NS_NET nsresult NS_NewINetService(nsINetService** aInstancePtrResult, // The Netlib Service is created by the nsNetlibInit class... if (nsnull == gNetlibService) { - (void) NS_InitINetService(nsnull); + (void) NS_InitINetService(); /// return NS_ERROR_OUT_OF_MEMORY; } return gNetlibService->QueryInterface(kINetServiceIID, (void**)aInstancePtrResult); } -NS_NET nsresult NS_InitINetService(nsINetContainerApplication *aContainer) +NS_NET nsresult NS_InitINetService() { /* XXX: For now only allow a single instance of the Netlib Service */ if (nsnull == gNetlibService) { - gNetlibService = new nsNetlibService(aContainer); + gNetlibService = new nsNetlibService(); if (nsnull == gNetlibService) { return NS_ERROR_OUT_OF_MEMORY; } } - else { - gNetlibService->SetContainerApplication(aContainer); - } NS_ADDREF(gNetlibService); return NS_OK; } + NS_NET nsresult NS_ShutdownINetService() { - nsNetlibService *service = gNetlibService; - - // Release the container... - if (nsnull != service) { - gNetlibService->SetContainerApplication(nsnull); - NS_RELEASE(service); - } return NS_OK; } diff --git a/mozilla/network/module/nsNetService.h b/mozilla/network/module/nsNetService.h index 2b9799b8e6f..359b28facf4 100644 --- a/mozilla/network/module/nsNetService.h +++ b/mozilla/network/module/nsNetService.h @@ -27,7 +27,6 @@ #include "nsNetThread.h" #include "net.h" -class nsINetContainerApplication; class nsITimer; class nsNetlibService : public nsINetService { @@ -35,7 +34,7 @@ class nsNetlibService : public nsINetService { public: NS_DECL_ISUPPORTS - nsNetlibService(nsINetContainerApplication *aContainer); + nsNetlibService(); /* Implementation of the nsINetService interface */ NS_IMETHOD OpenStream(nsIURL *aUrl, nsIStreamListener *aConsumer); @@ -43,9 +42,6 @@ public: nsIStreamListener *aConsumer, nsIInputStream **aNewStream); - NS_IMETHOD GetContainerApplication(nsINetContainerApplication **aContainer); - nsresult SetContainerApplication(nsINetContainerApplication *aContainer); - NS_IMETHOD GetCookieString(nsIURL *aURL, nsString& aCookie); NS_IMETHOD SetCookieString(nsIURL *aURL, const nsString& aCookie); @@ -54,6 +50,13 @@ public: NS_IMETHOD GetHTTPOneOne(PRBool& aOneOne); NS_IMETHOD SetHTTPOneOne(PRBool aSendOneOne); + 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); + NS_IMETHOD SetCustomUserAgent(nsString aCustom); + protected: virtual ~nsNetlibService(); @@ -72,7 +75,6 @@ private: void SetupURLStruct(nsIURL *aURL, URL_Struct *aURL_s); /* XXX: This is temporary until bamwrap.cpp is removed... */ void *m_stubContext; - nsINetContainerApplication *mContainer; nsIPref *mPref; nsITimer* mPollingTimer; diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp index c6e0823e9ac..04c4fe08df9 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp +++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp @@ -66,8 +66,6 @@ static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID); static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID); static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID); -static NS_DEFINE_IID(kINetContainerApplicationIID, - NS_INETCONTAINERAPPLICATION_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -103,11 +101,6 @@ nsViewerApp::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - if (aIID.Equals(kINetContainerApplicationIID)) { - *aInstancePtrResult = (void*) ((nsIBrowserWindow*)this); - NS_ADDREF_THIS(); - return NS_OK; - } if (aIID.Equals(kISupportsIID)) { *aInstancePtrResult = (void*) ((nsISupports*)((nsIBrowserWindow*)this)); NS_ADDREF_THIS(); @@ -183,7 +176,7 @@ nsViewerApp::Initialize(int argc, char** argv) mPrefs->Startup("prefs.js"); // Setup networking library - rv = NS_InitINetService((nsINetContainerApplication*) this); + rv = NS_InitINetService(); if (NS_OK != rv) { return rv; } @@ -505,48 +498,6 @@ nsViewerApp::OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow) //---------------------------------------- -// nsINetContainerApplication implementation -// XXX: These methods are called by the netlib thread... - -NS_IMETHODIMP -nsViewerApp::GetAppCodeName(nsString& aAppCodeName) -{ - aAppCodeName.SetString("Mozilla"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetAppVersion(nsString& aAppVersion) -{ - //This seems kinda wrong in x-platform code - aAppVersion.SetString("4.05 [en] (WinNT;I)"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetAppName(nsString& aAppName) -{ - aAppName.SetString("Netscape"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetLanguage(nsString& aLanguage) -{ - aLanguage.SetString("en"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetPlatform(nsString& aPlatform) -{ - //This seems kinda wrong in x-platform code - aPlatform.SetString("Win32"); - return NS_OK; -} - -//---------------------------------------- - // nsDispatchListener implementation void diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.h b/mozilla/webshell/tests/viewer/nsViewerApp.h index 6f20d866f8a..42da2d7e3f5 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.h +++ b/mozilla/webshell/tests/viewer/nsViewerApp.h @@ -19,7 +19,6 @@ #ifndef nsViewerApp_h___ #define nsViewerApp_h___ -#include "nsINetContainerApplication.h" #include "nsIAppShell.h" #include "nsString.h" #include "nsCRT.h" @@ -30,8 +29,7 @@ class nsWebCrawler; class nsBrowserWindow; class nsIBrowserWindow; -class nsViewerApp : public nsINetContainerApplication, - public nsDispatchListener +class nsViewerApp : public nsDispatchListener { public: void* operator new(size_t sz) { @@ -45,13 +43,6 @@ public: // nsISupports NS_DECL_ISUPPORTS - // nsINetContainerApplication - 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); - // nsDispatchListener virtual void AfterDispatch(); diff --git a/mozilla/xpfe/xpviewer/src/nsViewerApp.cpp b/mozilla/xpfe/xpviewer/src/nsViewerApp.cpp index 4c8c72b96ad..f75cf27f587 100644 --- a/mozilla/xpfe/xpviewer/src/nsViewerApp.cpp +++ b/mozilla/xpfe/xpviewer/src/nsViewerApp.cpp @@ -66,8 +66,6 @@ static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID); static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID); static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID); -static NS_DEFINE_IID(kINetContainerApplicationIID, - NS_INETCONTAINERAPPLICATION_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -103,11 +101,6 @@ nsViewerApp::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - if (aIID.Equals(kINetContainerApplicationIID)) { - *aInstancePtrResult = (void*) ((nsIBrowserWindow*)this); - NS_ADDREF_THIS(); - return NS_OK; - } if (aIID.Equals(kISupportsIID)) { *aInstancePtrResult = (void*) ((nsISupports*)((nsIBrowserWindow*)this)); NS_ADDREF_THIS(); @@ -183,7 +176,7 @@ nsViewerApp::Initialize(int argc, char** argv) mPrefs->Startup("prefs.js"); // Setup networking library - rv = NS_InitINetService((nsINetContainerApplication*) this); + rv = NS_InitINetService(); if (NS_OK != rv) { return rv; } @@ -498,48 +491,6 @@ nsViewerApp::OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow) //---------------------------------------- -// nsINetContainerApplication implementation -// XXX: These methods are called by the netlib thread... - -NS_IMETHODIMP -nsViewerApp::GetAppCodeName(nsString& aAppCodeName) -{ - aAppCodeName.SetString("Mozilla"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetAppVersion(nsString& aAppVersion) -{ - //This seems kinda wrong in x-platform code - aAppVersion.SetString("4.05 [en] (WinNT;I)"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetAppName(nsString& aAppName) -{ - aAppName.SetString("Netscape"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetLanguage(nsString& aLanguage) -{ - aLanguage.SetString("en"); - return NS_OK; -} - -NS_IMETHODIMP -nsViewerApp::GetPlatform(nsString& aPlatform) -{ - //This seems kinda wrong in x-platform code - aPlatform.SetString("Win32"); - return NS_OK; -} - -//---------------------------------------- - // nsDispatchListener implementation void diff --git a/mozilla/xpfe/xpviewer/src/nsViewerApp.h b/mozilla/xpfe/xpviewer/src/nsViewerApp.h index f2383aac195..0a7e1563290 100644 --- a/mozilla/xpfe/xpviewer/src/nsViewerApp.h +++ b/mozilla/xpfe/xpviewer/src/nsViewerApp.h @@ -19,7 +19,6 @@ #ifndef nsViewerApp_h___ #define nsViewerApp_h___ -#include "nsINetContainerApplication.h" #include "nsIAppShell.h" #include "nsString.h" #include "nsCRT.h" @@ -30,8 +29,7 @@ class nsIPref; class nsBrowserWindow; class nsIBrowserWindow; -class nsViewerApp : public nsINetContainerApplication, - public nsDispatchListener +class nsViewerApp : public nsDispatchListener { public: void* operator new(size_t sz) { @@ -46,13 +44,6 @@ public: // nsISupports NS_DECL_ISUPPORTS - // nsINetContainerApplication - 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); - // nsDispatchListener virtual void AfterDispatch();