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";
var sourceProfiles = this._migrator.sourceProfiles;
if (sourceProfiles && sourceProfiles.Count() == 1) {
var profileName = sourceProfiles.QueryElementAt(0, Components.interfaces.nsISupportsString);
if (sourceProfiles && sourceProfiles.length == 1) {
var profileName = sourceProfiles.queryElementAt(0, Ci.nsISupportsString);
this._selectedProfile = profileName.data;
}
else
@ -211,10 +211,9 @@ var MigrationWizard = {
// and we canceled the dialog. When that happens, _migrator will be null.
if (this._migrator) {
var sourceProfiles = this._migrator.sourceProfiles;
var count = sourceProfiles.Count();
for (var i = 0; i < count; ++i) {
for (var i = 0; i < sourceProfiles.length; ++i) {
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.setAttribute("label", str.data);
profiles.appendChild(item);

View File

@ -36,10 +36,10 @@
#include "nsISupports.idl"
interface nsISupportsArray;
interface nsIArray;
interface nsIProfileStartup;
[scriptable, uuid(f8365b4a-da55-4e47-be7a-230142360f62)]
[scriptable, uuid(5f445759-86a8-4dd3-ab84-4fc5341d9d9d)]
interface nsIBrowserProfileMigrator : nsISupports
{
/**
@ -89,8 +89,8 @@ interface nsIBrowserProfileMigrator : nsISupports
* An enumeration of available profiles. If the import source does
* 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
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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