Bug 705100 - Remove usage of nsISupportsArray in browser/components/migration r=mak

--HG--
extra : rebase_source : a1d9e9d273c200c8b071deca04e4ef1184d2703f
This commit is contained in:
Matthew Noorenberghe 2011-11-29 02:26:19 -08:00
parent 40c2b857d0
commit 58ded20f8a
9 changed files with 26 additions and 32 deletions

View File

@ -186,8 +186,8 @@ var MigrationWizard = {
this._wiz.currentPage.next = "importItems"; this._wiz.currentPage.next = "importItems";
var sourceProfiles = this._migrator.sourceProfiles; var sourceProfiles = this._migrator.sourceProfiles;
if (sourceProfiles && sourceProfiles.Count() == 1) { if (sourceProfiles && sourceProfiles.length == 1) {
var profileName = sourceProfiles.QueryElementAt(0, Components.interfaces.nsISupportsString); var profileName = sourceProfiles.queryElementAt(0, Ci.nsISupportsString);
this._selectedProfile = profileName.data; this._selectedProfile = profileName.data;
} }
else else
@ -211,10 +211,9 @@ var MigrationWizard = {
// and we canceled the dialog. When that happens, _migrator will be null. // and we canceled the dialog. When that happens, _migrator will be null.
if (this._migrator) { if (this._migrator) {
var sourceProfiles = this._migrator.sourceProfiles; var sourceProfiles = this._migrator.sourceProfiles;
var count = sourceProfiles.Count(); for (var i = 0; i < sourceProfiles.length; ++i) {
for (var i = 0; i < count; ++i) {
var item = document.createElement("radio"); var item = document.createElement("radio");
var str = sourceProfiles.QueryElementAt(i, Components.interfaces.nsISupportsString); var str = sourceProfiles.queryElementAt(i, Ci.nsISupportsString);
item.id = str.data; item.id = str.data;
item.setAttribute("label", str.data); item.setAttribute("label", str.data);
profiles.appendChild(item); profiles.appendChild(item);

View File

@ -36,10 +36,10 @@
#include "nsISupports.idl" #include "nsISupports.idl"
interface nsISupportsArray; interface nsIArray;
interface nsIProfileStartup; interface nsIProfileStartup;
[scriptable, uuid(f8365b4a-da55-4e47-be7a-230142360f62)] [scriptable, uuid(5f445759-86a8-4dd3-ab84-4fc5341d9d9d)]
interface nsIBrowserProfileMigrator : nsISupports interface nsIBrowserProfileMigrator : nsISupports
{ {
/** /**
@ -89,8 +89,8 @@ interface nsIBrowserProfileMigrator : nsISupports
* An enumeration of available profiles. If the import source does * An enumeration of available profiles. If the import source does
* not support profiles, this attribute is null. * not support profiles, this attribute is null.
*/ */
readonly attribute nsISupportsArray sourceProfiles; readonly attribute nsIArray sourceProfiles;
/** /**
* The import source homepage. Returns null if not present/available * The import source homepage. Returns null if not present/available
*/ */

View File

@ -54,7 +54,6 @@
#include "nsAppDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h"
#include "nsIRDFService.h" #include "nsIRDFService.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
#include "nsISupportsArray.h"
#include "nsXPCOMCID.h" #include "nsXPCOMCID.h"
#define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties" #define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties"

View File

@ -65,7 +65,6 @@
#include "nsIPrefService.h" #include "nsIPrefService.h"
#include "nsIPrefBranch.h" #include "nsIPrefBranch.h"
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
#include "nsISupportsArray.h"
#include "nsIProfileMigrator.h" #include "nsIProfileMigrator.h"
#include "nsIBrowserProfileMigrator.h" #include "nsIBrowserProfileMigrator.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
@ -486,7 +485,7 @@ nsIEProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsIEProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult) nsIEProfileMigrator::GetSourceProfiles(nsIArray** aResult)
{ {
*aResult = nsnull; *aResult = nsnull;
return NS_OK; return NS_OK;

View File

@ -170,12 +170,12 @@ nsOperaProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
NS_IMETHODIMP NS_IMETHODIMP
nsOperaProfileMigrator::GetSourceExists(bool* aResult) nsOperaProfileMigrator::GetSourceExists(bool* aResult)
{ {
nsCOMPtr<nsISupportsArray> profiles; nsCOMPtr<nsIArray> profiles;
GetSourceProfiles(getter_AddRefs(profiles)); GetSourceProfiles(getter_AddRefs(profiles));
if (profiles) { if (profiles) {
PRUint32 count; PRUint32 count;
profiles->Count(&count); profiles->GetLength(&count);
*aResult = count > 0; *aResult = count > 0;
} }
else else
@ -187,13 +187,13 @@ nsOperaProfileMigrator::GetSourceExists(bool* aResult)
NS_IMETHODIMP NS_IMETHODIMP
nsOperaProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult) nsOperaProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
{ {
nsCOMPtr<nsISupportsArray> profiles; nsCOMPtr<nsIArray> profiles;
GetSourceProfiles(getter_AddRefs(profiles)); GetSourceProfiles(getter_AddRefs(profiles));
#ifdef XP_WIN #ifdef XP_WIN
if (profiles) { if (profiles) {
PRUint32 count; PRUint32 count;
profiles->Count(&count); profiles->GetLength(&count);
*aResult = count > 1; *aResult = count > 1;
} }
else else
@ -204,12 +204,12 @@ nsOperaProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsOperaProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult) nsOperaProfileMigrator::GetSourceProfiles(nsIArray** aResult)
{ {
if (!mProfiles) { if (!mProfiles) {
nsresult rv; nsresult rv;
mProfiles = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv); mProfiles = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIProperties> fileLocator(do_GetService("@mozilla.org/file/directory_service;1")); nsCOMPtr<nsIProperties> fileLocator(do_GetService("@mozilla.org/file/directory_service;1"));
@ -238,7 +238,7 @@ nsOperaProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
nsAutoString leafName; nsAutoString leafName;
curr->GetLeafName(leafName); curr->GetLeafName(leafName);
string->SetData(leafName); string->SetData(leafName);
mProfiles->AppendElement(string); mProfiles->AppendElement(string, false);
} }
e->HasMoreElements(&hasMore); e->HasMoreElements(&hasMore);
@ -255,7 +255,7 @@ nsOperaProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
if (exists) { if (exists) {
nsCOMPtr<nsISupportsString> string(do_CreateInstance("@mozilla.org/supports-string;1")); nsCOMPtr<nsISupportsString> string(do_CreateInstance("@mozilla.org/supports-string;1"));
string->SetData(OPERA_PREFERENCES_FOLDER_NAME); string->SetData(OPERA_PREFERENCES_FOLDER_NAME);
mProfiles->AppendElement(string); mProfiles->AppendElement(string, false);
} }
#elif defined (XP_UNIX) #elif defined (XP_UNIX)
fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file)); fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file));
@ -268,7 +268,7 @@ nsOperaProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
if (exists) { if (exists) {
nsCOMPtr<nsISupportsString> string(do_CreateInstance("@mozilla.org/supports-string;1")); nsCOMPtr<nsISupportsString> string(do_CreateInstance("@mozilla.org/supports-string;1"));
string->SetData(OPERA_PREFERENCES_FOLDER_NAME); string->SetData(OPERA_PREFERENCES_FOLDER_NAME);
mProfiles->AppendElement(string); mProfiles->AppendElement(string, false);
} }
#endif #endif
} }

View File

@ -42,9 +42,9 @@
#include "nsIBinaryInputStream.h" #include "nsIBinaryInputStream.h"
#include "nsIBrowserProfileMigrator.h" #include "nsIBrowserProfileMigrator.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsISupportsArray.h"
#include "nsStringAPI.h" #include "nsStringAPI.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsIMutableArray.h"
#include "nsINavHistoryService.h" #include "nsINavHistoryService.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
@ -144,7 +144,7 @@ protected:
private: private:
nsCOMPtr<nsILocalFile> mOperaProfile; nsCOMPtr<nsILocalFile> mOperaProfile;
nsCOMPtr<nsISupportsArray> mProfiles; nsCOMPtr<nsIMutableArray> mProfiles;
nsCOMPtr<nsIObserverService> mObserverService; nsCOMPtr<nsIObserverService> mObserverService;
}; };

View File

@ -45,7 +45,7 @@
#include "nsIProperties.h" #include "nsIProperties.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsISupportsArray.h" #include "nsIMutableArray.h"
#include "nsIToolkitProfile.h" #include "nsIToolkitProfile.h"
#include "nsIToolkitProfileService.h" #include "nsIToolkitProfileService.h"
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
@ -127,13 +127,12 @@ nsProfileMigrator::Migrate(nsIProfileStartup* aStartup)
// By opening the Migration FE with a supplied bpm, it will automatically // By opening the Migration FE with a supplied bpm, it will automatically
// migrate from it. // migrate from it.
nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsISupportsArray> params = nsCOMPtr<nsIMutableArray> params = do_CreateInstance(NS_ARRAY_CONTRACTID);
do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
if (!ww || !params) return NS_ERROR_FAILURE; if (!ww || !params) return NS_ERROR_FAILURE;
params->AppendElement(cstr); params->AppendElement(cstr, false);
params->AppendElement(bpm); params->AppendElement(bpm, false);
params->AppendElement(aStartup); params->AppendElement(aStartup, false);
nsCOMPtr<nsIDOMWindow> migrateWizard; nsCOMPtr<nsIDOMWindow> migrateWizard;
return ww->OpenWindow(nsnull, return ww->OpenWindow(nsnull,

View File

@ -59,7 +59,6 @@
#include "nsIRDFService.h" #include "nsIRDFService.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
#include "nsISupportsArray.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsSafariProfileMigrator.h" #include "nsSafariProfileMigrator.h"
#include "nsToolkitCompsCID.h" #include "nsToolkitCompsCID.h"
@ -202,7 +201,7 @@ nsSafariProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSafariProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult) nsSafariProfileMigrator::GetSourceProfiles(nsIArray** aResult)
{ {
*aResult = nsnull; *aResult = nsnull;
return NS_OK; return NS_OK;

View File

@ -41,7 +41,6 @@
#include "nsIBrowserProfileMigrator.h" #include "nsIBrowserProfileMigrator.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsISupportsArray.h"
#include "nsStringAPI.h" #include "nsStringAPI.h"
#include "nsINavHistoryService.h" #include "nsINavHistoryService.h"