Bug 575740 Switch xpfe autocomplete to the new component registration r=bienvenu

This commit is contained in:
Neil Rashbrook 2010-07-04 11:50:17 +01:00
Родитель d7ce66ac8c
Коммит 5995074b64
2 изменённых файлов: 26 добавлений и 23 удалений

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

@ -37,10 +37,9 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "prtypes.h"
#include "nsAutoComplete.h"
#include "nsReadableUtils.h"
#include "nsIGenericFactory.h"
#include "nsComponentManagerUtils.h"
#include "mozilla/ModuleUtils.h"
/******************************************************************************
* nsAutoCompleteItem
@ -89,7 +88,7 @@ NS_IMETHODIMP nsAutoCompleteItem::GetClassName(char * *aClassName)
}
NS_IMETHODIMP nsAutoCompleteItem::SetClassName(const char * aClassName)
{
mClassName.AssignWithConversion(aClassName);
mClassName.Assign(aClassName);
return NS_OK;
}
@ -114,9 +113,9 @@ NS_IMETHODIMP nsAutoCompleteItem::SetParam(nsISupports * aParam)
NS_IMPL_ISUPPORTS1(nsAutoCompleteResults, nsIAutoCompleteResults)
nsAutoCompleteResults::nsAutoCompleteResults() :
mItems(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID)),
mDefaultItemIndex(0)
{
NS_NewISupportsArray(getter_AddRefs(mItems));
}
nsAutoCompleteResults::~nsAutoCompleteResults()
@ -180,19 +179,25 @@ NS_IMETHODIMP nsAutoCompleteResults::SetDefaultItemIndex(PRInt32 aDefaultItemInd
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteItem)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteResults)
static const nsModuleComponentInfo components[] = {
{
"AutoComplete Search Results",
NS_AUTOCOMPLETERESULTS_CID,
NS_AUTOCOMPLETERESULTS_CONTRACTID,
nsAutoCompleteResultsConstructor
},
{
"AutoComplete Search Item",
NS_AUTOCOMPLETEITEM_CID,
NS_AUTOCOMPLETEITEM_CONTRACTID,
nsAutoCompleteItemConstructor
}
NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETERESULTS_CID);
NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETEITEM_CID);
const mozilla::Module::CIDEntry kAutoCompleteCIDs[] = {
{ &kNS_AUTOCOMPLETERESULTS_CID, false, NULL, nsAutoCompleteResultsConstructor },
{ &kNS_AUTOCOMPLETEITEM_CID, false, NULL, nsAutoCompleteItemConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(xpAutoComplete, components)
const mozilla::Module::ContractIDEntry kAutoCompleteContracts[] = {
{ NS_AUTOCOMPLETERESULTS_CONTRACTID, &kNS_AUTOCOMPLETERESULTS_CID },
{ NS_AUTOCOMPLETEITEM_CONTRACTID, &kNS_AUTOCOMPLETEITEM_CID },
{ NULL }
};
static const mozilla::Module kAutoCompleteModule = {
mozilla::Module::kVersion,
kAutoCompleteCIDs,
kAutoCompleteContracts
};
NSMODULE_DEFN(xpAutoComplete) = &kAutoCompleteModule;

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

@ -40,9 +40,7 @@
#define nsAutoComplete_h___
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIAutoCompleteListener.h"
#include "nsStringGlue.h"
#include "nsIAutoCompleteResults.h"
@ -61,7 +59,7 @@ public:
private:
nsString mValue;
nsString mComment;
nsString mClassName;
nsCString mClassName;
nsCOMPtr<nsISupports> mParam;
};