From 42c990a692cfd82aa0dbb51bdd2bb0a3b24d1f2f Mon Sep 17 00:00:00 2001 From: "morse@netscape.com" Date: Sat, 24 Jul 1999 01:39:58 +0000 Subject: [PATCH] Remove wallet from layout --- layout/forms/nsTextControlFrame.cpp | 10 - layout/html/forms/src/makefile.win | 1 - layout/html/forms/src/nsFormFrame.cpp | 183 ------------------ .../html/forms/src/nsGfxTextControlFrame.cpp | 74 +------ .../forms/src/nsNativeTextControlFrame.cpp | 67 +------ layout/html/forms/src/nsTextControlFrame.cpp | 10 - 6 files changed, 3 insertions(+), 342 deletions(-) diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index 34d3edec0c0e..92846d9e5c47 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -46,16 +46,6 @@ #include "nsILookAndFeel.h" #include "nsIComponentManager.h" -#ifdef SingleSignon -#include "nsIDocument.h" -#include "prmem.h" -#include "nsIURL.h" -#include "nsIWalletService.h" -#include "nsIServiceManager.h" -static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); -static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID); -#endif - static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID); static NS_DEFINE_IID(kTextAreaCID, NS_TEXTAREA_CID); diff --git a/layout/html/forms/src/makefile.win b/layout/html/forms/src/makefile.win index c5be928d9d4e..6e99f7bbbb82 100644 --- a/layout/html/forms/src/makefile.win +++ b/layout/html/forms/src/makefile.win @@ -73,7 +73,6 @@ LINCS= -I$(PUBLIC)\xpcom \ -I$(PUBLIC)\pref \ -I$(PUBLIC)\editor \ -I$(PUBLIC)\netlib \ - -I$(PUBLIC)\wallet \ -I$(PUBLIC)\uconv \ -I$(PUBLIC)\rdf \ -I..\..\base\src \ diff --git a/layout/html/forms/src/nsFormFrame.cpp b/layout/html/forms/src/nsFormFrame.cpp index fc294a1ce351..00b7aa8d6d42 100644 --- a/layout/html/forms/src/nsFormFrame.cpp +++ b/layout/html/forms/src/nsFormFrame.cpp @@ -87,10 +87,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #define SPECIFY_CHARSET_IN_CONTENT_TYPE #define FIX_NON_ASCII_MULTIPART -#if defined(ClientWallet) || defined(SingleSignon) || defined(CookieManagement) -#include "nsIServiceManager.h" -#endif - // GetParentHTMLFrameDocument static NS_DEFINE_IID(kIWebshellIID, NS_IWEB_SHELL_IID); static NS_DEFINE_IID(kIContentViewerContainerIID, NS_ICONTENT_VIEWER_CONTAINER_IID); @@ -98,30 +94,6 @@ static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); -#ifdef SingleSignon -#define FORM_TYPE_TEXT 1 -#define FORM_TYPE_PASSWORD 7 -#endif - -#if defined(ClientWallet) || defined(SingleSignon) -#include "nsIWalletService.h" -static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); -static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID); -#endif - -#if defined(CookieManagement) - -#ifndef NECKO -#include "nsINetService.h" -static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID); -static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID); -#else -#include "nsIURL.h" -#endif // NECKO - - -#endif - //---------------------------------------------------------------------- static NS_DEFINE_IID(kIFormManagerIID, NS_IFORMMANAGER_IID); @@ -708,34 +680,6 @@ NS_IMETHODIMP nsFormFrame::GetEncoder(nsIUnicodeEncoder** encoder) return NS_OK; } -#ifdef ClientWallet -void -GetVcardName(nsIFormControlFrame& aFormControlFrame, nsString& aVCardName) -{ - aVCardName = ""; - nsIFrame* frame = nsnull; - nsresult rv = aFormControlFrame.QueryInterface(kIFrameIID, (void**)&frame); - if (NS_SUCCEEDED(rv) && frame) { - nsIContent* content = nsnull; - rv = frame->GetContent(&content); - if (NS_SUCCEEDED(rv) && content) { - nsIHTMLContent* htmlContent = nsnull; - rv = content->QueryInterface(kIHTMLContentIID, (void**)&htmlContent); - if (NS_SUCCEEDED(rv) && htmlContent) { - nsHTMLValue value; - if (NS_CONTENT_ATTR_HAS_VALUE == htmlContent->GetHTMLAttribute(nsHTMLAtoms::vcard_name, value)) { - if (eHTMLUnit_String == value.GetUnit()) { - value.GetStringValue(aVCardName); - } - } - NS_RELEASE(htmlContent); - } - NS_RELEASE(content); - } - } -} -#endif - #define CRLF "\015\012" void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormControlFrame* aFrame) { @@ -743,75 +687,6 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon PRBool firstTime = PR_TRUE; PRUint32 numChildren = mFormControls.Count(); - -#if defined(ClientWallet) || defined(SingleSignon) - /* get url name as ascii string */ - char *URLName = nsnull; - nsIURI* docURL = nsnull; - nsIDocument* doc = nsnull; - mContent->GetDocument(doc); - -#ifdef NECKO - char* spec; -#else - const char* spec; -#endif - while (doc) { - docURL = doc->GetDocumentURL(); - if (nsnull != docURL) { - (void)docURL->GetSpec(&spec); - if (PL_strcmp(spec, "about:blank")) { - break; - } -#ifdef NECKO - nsCRT::free(spec); -#endif - } - doc = GetParentHTMLFrameDocument(doc); - } - if (nsnull != docURL) { - URLName = (char*)PR_Malloc(PL_strlen(spec)+1); - PL_strcpy(URLName, spec); - NS_IF_RELEASE(docURL); - } -#ifdef NECKO - nsCRT::free(spec); -#endif -#endif - -#ifdef SingleSignon -#define MAX_ARRAY_SIZE 500 - char* name_array[MAX_ARRAY_SIZE]; - char* value_array[MAX_ARRAY_SIZE]; - uint8 type_array[MAX_ARRAY_SIZE]; - PRInt32 value_cnt = 0; -#endif - -#ifdef ClientWallet - /* determine if form is significant enough to capture data for */ - PRBool OKToCapture = FALSE; - PRInt32 count = 0; - PRUint32 numChildren2 = mFormControls.Count(); - for (PRUint32 childX2 = 0; childX2 < numChildren2; childX2++) { - nsIFormControlFrame* child = (nsIFormControlFrame*) mFormControls.ElementAt(childX2); - if (child && child->IsSuccessful(aFrame)) { - PRInt32 type; - child->GetType(&type); - if (type == NS_FORM_INPUT_TEXT) { - count++; - } - } - } - nsIWalletService *service2; - nsresult res2 = nsServiceManager::GetService(kWalletServiceCID, - kIWalletServiceIID, - (nsISupports **)&service2); - if ((NS_OK == res2) && (nsnull != service2)) { - service2->WALLET_OKToCapture(&OKToCapture, count, URLName); - nsServiceManager::ReleaseService(kWalletServiceCID, service2); - } -#endif - nsIUnicodeEncoder *encoder = nsnull; if(NS_FAILED( GetEncoder(&encoder) ) ) encoder = nsnull; @@ -828,40 +703,6 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon nsString* names = new nsString[maxNumValues]; nsString* values = new nsString[maxNumValues]; if (PR_TRUE == child->GetNamesValues(maxNumValues, numValues, values, names)) { -#if defined(ClientWallet) || defined(SingleSignon) - PRInt32 type; - child->GetType(&type); -#endif -#ifdef ClientWallet - if (OKToCapture && (NS_FORM_INPUT_TEXT == type)) { - nsString vcard(""); - GetVcardName(*child, vcard); - nsIWalletService *service; - nsresult res = nsServiceManager::GetService(kWalletServiceCID, - kIWalletServiceIID, - (nsISupports **)&service); - if ((NS_OK == res) && (nsnull != service)) { - res = service->WALLET_Capture(doc, *names, *values, vcard); - nsServiceManager::ReleaseService(kWalletServiceCID, service); - } - } -#endif -#ifdef SingleSignon - if ((type == NS_FORM_INPUT_PASSWORD) || (type == NS_FORM_INPUT_TEXT)) { - if (value_cnt < MAX_ARRAY_SIZE) { - if (type == NS_FORM_INPUT_PASSWORD) { - type_array[value_cnt] = FORM_TYPE_PASSWORD; - } else { - type_array[value_cnt] = FORM_TYPE_TEXT; - } - value_array[value_cnt] = - values[0].ToNewCString(); - name_array[value_cnt] = - names[0].ToNewCString(); - value_cnt++; - } - } -#endif for (int valueX = 0; valueX < numValues; valueX++) { if (PR_TRUE == firstTime) { firstTime = PR_FALSE; @@ -883,30 +724,6 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon } NS_IF_RELEASE(encoder); -#ifdef SingleSignon - nsIWalletService *service; - nsresult res = nsServiceManager::GetService(kWalletServiceCID, - kIWalletServiceIID, - (nsISupports **)&service); - if ((NS_OK == res) && (nsnull != service)) { - res = service->SI_RememberSignonData - (URLName, (char**)name_array, (char**)value_array, (char**)type_array, value_cnt); - nsServiceManager::ReleaseService(kWalletServiceCID, service); - } - while (value_cnt--) { - PR_FREEIF(name_array[value_cnt]); - PR_FREEIF(value_array[value_cnt]); - } -#endif -#if defined(ClientWallet) || defined(SingleSignon) - if (nsnull != doc) { - NS_RELEASE(doc); - } - if (nsnull != URLName) { - PR_FREEIF(URLName); - } -#endif - aData.SetLength(0); if (isPost) { char size[16]; diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp index 3d6c74e92366..6b799a25956f 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -65,15 +65,7 @@ #include "nsIDocument.h" #include "nsIDOMDocument.h" #include "nsIDOMEventReceiver.h" - -#ifdef SingleSignon -#include "prmem.h" -#include "nsIURL.h" -#include "nsIWalletService.h" -#include "nsIServiceManager.h" -static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); -static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID); -#endif +#include "nsIPresShell.h" static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID); @@ -1111,69 +1103,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc // now that the style context is initialized, initialize the content nsAutoString value; - if (PR_TRUE == IsSingleLineTextControl()) - { -#ifdef SingleSignon - // get name of text - PRBool failed = PR_TRUE; - nsAutoString name; - GetName(&name); - - // get url name - char *URLName = nsnull; - nsIURI* docURL = nsnull; - nsIDocument* doc = nsnull; - mContent->GetDocument(doc); - if (nsnull != doc) { - docURL = doc->GetDocumentURL(); - NS_RELEASE(doc); - if (nsnull != docURL) { -#ifdef NECKO - char* spec; -#else - const char* spec; -#endif - (void)docURL->GetSpec(&spec); - if (nsnull != spec) { - URLName = (char*)PR_Malloc(PL_strlen(spec)+1); - PL_strcpy(URLName, spec); - } -#ifdef NECKO - nsCRT::free(spec); -#endif - NS_RELEASE(docURL); - } - } - - if (nsnull != URLName) { - // invoke single-signon to get previously-used value of text - nsIWalletService *service; - nsresult res = nsServiceManager::GetService(kWalletServiceCID, - kIWalletServiceIID, - (nsISupports **)&service); - if ((NS_OK == res) && (nsnull != service)) { - char* valueString = NULL; - char* nameString = name.ToNewCString(); - res = service->SI_RestoreSignonData(URLName, nameString, &valueString); - delete[] nameString; - nsServiceManager::ReleaseService(kWalletServiceCID, service); - PR_FREEIF(URLName); - if (valueString && *valueString) { - value = valueString; - failed = PR_FALSE; - } - } - } - if (failed) { - GetText(&value, PR_TRUE); - } -#else - GetText(&value, PR_TRUE); -#endif - } - else { - GetText(&value, PR_TRUE); - } + GetText(&value, PR_TRUE); mEditor->EnableUndo(PR_FALSE); PRInt32 maxLength; diff --git a/layout/html/forms/src/nsNativeTextControlFrame.cpp b/layout/html/forms/src/nsNativeTextControlFrame.cpp index 930afd3b0bdb..1fd2d303e5b6 100644 --- a/layout/html/forms/src/nsNativeTextControlFrame.cpp +++ b/layout/html/forms/src/nsNativeTextControlFrame.cpp @@ -46,16 +46,6 @@ #include "nsILookAndFeel.h" #include "nsIComponentManager.h" -#ifdef SingleSignon -#include "nsIDocument.h" -#include "prmem.h" -#include "nsIURL.h" -#include "nsIWalletService.h" -#include "nsIServiceManager.h" -static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); -static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID); -#endif - static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID); static NS_DEFINE_IID(kTextAreaCID, NS_TEXTAREA_CID); @@ -252,62 +242,7 @@ nsNativeTextControlFrame::PostCreateWidget(nsIPresContext* aPresContext, nsITextAreaWidget* textArea = nsnull; nsITextWidget* text = nsnull; if (NS_OK == mWidget->QueryInterface(kITextWidgetIID,(void**)&text)) { - -#ifdef SingleSignon - /* get name of text */ - PRBool failed = PR_TRUE; - nsAutoString name; - GetName(&name); - - /* get url name */ - char *URLName = nsnull; - nsIURI* docURL = nsnull; - nsIDocument* doc = nsnull; - mContent->GetDocument(doc); - if (nsnull != doc) { - docURL = doc->GetDocumentURL(); - NS_RELEASE(doc); - if (nsnull != docURL) { -#ifdef NECKO - char* spec; -#else - const char* spec; -#endif - (void)docURL->GetSpec(&spec); - if (nsnull != spec) { - URLName = (char*)PR_Malloc(PL_strlen(spec)+1); - PL_strcpy(URLName, spec); - } - NS_RELEASE(docURL); - } - } - - if (nsnull != URLName) { - /* invoke single-signon to get previously-used value of text */ - nsIWalletService *service; - nsresult res = nsServiceManager::GetService(kWalletServiceCID, - kIWalletServiceIID, - (nsISupports **)&service); - if ((NS_OK == res) && (nsnull != service)) { - char* valueString = NULL; - char* nameString = name.ToNewCString(); - res = service->SI_RestoreSignonData(URLName, nameString, &valueString); - delete[] nameString; - nsServiceManager::ReleaseService(kWalletServiceCID, service); - PR_FREEIF(URLName); - if (valueString && *valueString) { - value = valueString; - failed = PR_FALSE; - } - } - } - if (failed) { - GetText(&value, PR_TRUE); - } -#else - GetText(&value, PR_TRUE); -#endif - + GetText(&value, PR_TRUE); text->SetText(value, ignore); PRInt32 maxLength; nsresult result = GetMaxLength(&maxLength); diff --git a/layout/html/forms/src/nsTextControlFrame.cpp b/layout/html/forms/src/nsTextControlFrame.cpp index 34d3edec0c0e..92846d9e5c47 100644 --- a/layout/html/forms/src/nsTextControlFrame.cpp +++ b/layout/html/forms/src/nsTextControlFrame.cpp @@ -46,16 +46,6 @@ #include "nsILookAndFeel.h" #include "nsIComponentManager.h" -#ifdef SingleSignon -#include "nsIDocument.h" -#include "prmem.h" -#include "nsIURL.h" -#include "nsIWalletService.h" -#include "nsIServiceManager.h" -static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); -static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID); -#endif - static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID); static NS_DEFINE_IID(kTextAreaCID, NS_TEXTAREA_CID);