Bug 413021 - "Migration/Import Wizard offer migrate from IE on Mac (where no IE is installed)" [p=dev@schonfeld.org (Michael Schonfeld) r=Mano a1.9b4=beltzner a=blocking-firefox3+]

This commit is contained in:
reed@reedloden.com 2008-03-02 21:58:06 -08:00
parent 01854162fc
commit 9ba705c471

View File

@ -48,9 +48,11 @@
#include "nsISupportsPrimitives.h"
#include "nsServiceManagerUtils.h"
#include "nsIProperties.h"
#include <InternetConfig.h>
#define MACIE_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("Favorites.html")
#define MACIE_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING("Explorer")
#define MACIE_DEFAULT_HOMEPAGE_PREF "\p4D534945¥WWWHomePage"
#define TEMP_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("bookmarks_tmp.html")
#define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties"
@ -137,11 +139,37 @@ nsMacIEProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
NS_IMETHODIMP
nsMacIEProfileMigrator::GetSourceExists(PRBool* aResult)
{
// Since the IE bookmarks file can sometimes be created by programs
// other than Internet Explorer, thus misleading, we must first
// check whether IE is even installed on this Mac. We accomplish this by
// checking one of IEs stored preferences in the apple.internetconfig file.
PRBool prefExists = PR_FALSE;
OSErr err;
ICInstance icInstance;
err = ::ICStart(&icInstance, 'FRFX');
if (err == noErr) {
ICAttr attrs;
Str255 IEhomePageValue;
long size = kICFileSpecHeaderSize;
err = ::ICGetPref(icInstance, MACIE_DEFAULT_HOMEPAGE_PREF, &attrs,
IEhomePageValue, &size);
if (err == noErr)
prefExists = PR_TRUE;
::ICStop(icInstance);
}
if (!prefExists) {
*aResult = PR_FALSE;
return NS_OK;
}
PRUint16 data;
GetMigrateData(nsnull, PR_FALSE, &data);
*aResult = data != 0;
return NS_OK;
}