Bug 575740 Switch xpfe autocomplete to the new component registration r=bienvenu
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 04 Jul 2010 11:50:17 +0100
changeset 47209 55f39d8d866ce6ce6e7c0b62189798f18b1c8de4
parent 47208 dda7c56c17b4247dd88e2617f3eabcc377d8d29f
child 47210 d2d570a50ddfb311b97cd457705df69e9378d87b
push id14273
push userneil@parkwaycc.co.uk
push dateSun, 04 Jul 2010 10:50:33 +0000
treeherdermozilla-central@55f39d8d866c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu
bugs575740
milestone2.0b2pre
first release with
nightly win64
55f39d8d866c / 4.0b2pre / 20100704054020 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
Bug 575740 Switch xpfe autocomplete to the new component registration r=bienvenu
xpfe/components/autocomplete/src/nsAutoComplete.cpp
xpfe/components/autocomplete/src/nsAutoComplete.h
--- a/xpfe/components/autocomplete/src/nsAutoComplete.cpp
+++ b/xpfe/components/autocomplete/src/nsAutoComplete.cpp
@@ -32,20 +32,19 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** 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
  ******************************************************************************/
 
 NS_IMPL_ISUPPORTS1(nsAutoCompleteItem, nsIAutoCompleteItem)
 
 nsAutoCompleteItem::nsAutoCompleteItem()
@@ -84,17 +83,17 @@ NS_IMETHODIMP nsAutoCompleteItem::SetCom
 NS_IMETHODIMP nsAutoCompleteItem::GetClassName(char * *aClassName)
 {
     if (!aClassName) return NS_ERROR_NULL_POINTER;
     *aClassName = ToNewCString(mClassName);
     return NS_OK;
 }
 NS_IMETHODIMP nsAutoCompleteItem::SetClassName(const char * aClassName)
 {
-    mClassName.AssignWithConversion(aClassName);
+    mClassName.Assign(aClassName);
     return NS_OK;
 }
 
 /* attribute nsISupports param; */
 NS_IMETHODIMP nsAutoCompleteItem::GetParam(nsISupports * *aParam)
 {
     if (!aParam) return NS_ERROR_NULL_POINTER;
     *aParam = mParam;
@@ -109,19 +108,19 @@ NS_IMETHODIMP nsAutoCompleteItem::SetPar
 
 
 /******************************************************************************
  * nsAutoCompleteResults
  ******************************************************************************/
 NS_IMPL_ISUPPORTS1(nsAutoCompleteResults, nsIAutoCompleteResults)
 
 nsAutoCompleteResults::nsAutoCompleteResults() :
+    mItems(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID)),
     mDefaultItemIndex(0)
 {
-    NS_NewISupportsArray(getter_AddRefs(mItems));
 }
 
 nsAutoCompleteResults::~nsAutoCompleteResults()
 {
 }
 
 NS_IMETHODIMP nsAutoCompleteResults::GetSearchString(PRUnichar * *aSearchString)
 {
@@ -175,24 +174,30 @@ NS_IMETHODIMP nsAutoCompleteResults::Set
 {
     mDefaultItemIndex = aDefaultItemIndex;
     return NS_OK;
 }
 
 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;
--- a/xpfe/components/autocomplete/src/nsAutoComplete.h
+++ b/xpfe/components/autocomplete/src/nsAutoComplete.h
@@ -35,19 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsAutoComplete_h___
 #define nsAutoComplete_h___
 
 #include "nsCOMPtr.h"
-#include "nsString.h"
-#include "nsIDOMHTMLInputElement.h"
-#include "nsIAutoCompleteListener.h"
+#include "nsStringGlue.h"
 #include "nsIAutoCompleteResults.h"
 
 
 /******************************************************************************
  * nsAutoCompleteItem
  ******************************************************************************/
 class nsAutoCompleteItem : public nsIAutoCompleteItem
 {
@@ -56,17 +54,17 @@ public:
 	virtual ~nsAutoCompleteItem();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAUTOCOMPLETEITEM
 
 private:
     nsString mValue;
     nsString mComment;
-    nsString mClassName;
+    nsCString mClassName;
     
     nsCOMPtr<nsISupports> mParam;
 };
 
 /******************************************************************************
  * nsAutoCompleteResults
  ******************************************************************************/
 class nsAutoCompleteResults : public nsIAutoCompleteResults