mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 469645 - Remove /mozilla/pref-migrator, r+sr=benjamin
This commit is contained in:
parent
b09843231d
commit
2c38acc533
@ -1,56 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
#ifndef nsPrefMigrationCIDs_h___
|
||||
#define nsPrefMigrationCIDs_h___
|
||||
|
||||
#define NS_PREFCONVERTER_CID {0xdb97abfa, 0x1dd1, 0x11b2, \
|
||||
{0xaf, 0x32, 0xad, 0x4c, 0x3b, 0x35, 0x4d, 0xfb}}
|
||||
|
||||
#define NS_PREFMIGRATION_CID {0xa2a7f03c, 0x6a6c, 0x11d3, \
|
||||
{0x9e, 0x9f, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78}}
|
||||
|
||||
#define NS_PrefMigrationFactory_CID {0xad1b40a0, 0x6a6c, 0x11d3, \
|
||||
{0x8d, 0x83, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78}}
|
||||
|
||||
#define NS_PMProgressDialog_CID {0x9e180fc9, 0x6d11, 0x11d3, \
|
||||
{0xb9, 0xf5, 0x0, 0x10, 0x83, 0x2, 0x2c, 0xf8}}
|
||||
|
||||
#endif /* nsPrefMigrationCIDs_h___ */
|
||||
// {9E180FC9-6D11-11d3-B9F5-001083022CF8}
|
||||
// {9E180FC9-6D11-11d3-B9F5-001083022CF8}
|
@ -1,89 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = prefmigr
|
||||
LIBRARY_NAME = nsprefm
|
||||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsPrefMigrationModule
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = xpcom \
|
||||
xpcom_obsolete \
|
||||
string \
|
||||
pref \
|
||||
intl \
|
||||
docshell \
|
||||
dom \
|
||||
layout \
|
||||
js \
|
||||
necko \
|
||||
widget \
|
||||
webbrwsr \
|
||||
uconv \
|
||||
windowwatcher \
|
||||
embed_base \
|
||||
content \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsPrefMigration.cpp \
|
||||
nsPrefMigrationFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsPrefMigration.h \
|
||||
nsPrefMigrationFactory.h \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(LIBS_DIR) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(MOZ_XPCOM_OBSOLETE_LIBS) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,185 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsPrefMigration_h___
|
||||
#define nsPrefMigration_h___
|
||||
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsPrefMigrationCIDs.h"
|
||||
#include "nsIPrefMigration.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
||||
#define MIGRATION_SUCCESS 0
|
||||
#define MIGRATION_RETRY 1
|
||||
#define MIGRATION_CANCEL 2
|
||||
#define MIGRATION_CREATE_NEW 3
|
||||
|
||||
#define MAX_DRIVES 4
|
||||
|
||||
//Interfaces Needed
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#define IMAP_MAIL_FILTER_FILE_NAME_FORMAT_IN_4x "%s Rules"
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
#define NEED_TO_COPY_AND_RENAME_NEWSRC_FILES
|
||||
#endif
|
||||
|
||||
class nsPrefConverter: public nsIPrefConverter
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_CID_ACCESSOR(NS_PREFCONVERTER_CID)
|
||||
|
||||
nsPrefConverter();
|
||||
virtual ~nsPrefConverter();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPREFCONVERTER
|
||||
|
||||
nsresult GetPlatformCharset(nsCString& aCharset);
|
||||
};
|
||||
|
||||
class nsPrefMigration: public nsIPrefMigration
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_CID_ACCESSOR(NS_PREFMIGRATION_CID)
|
||||
|
||||
static nsPrefMigration *GetInstance();
|
||||
|
||||
nsPrefMigration();
|
||||
virtual ~nsPrefMigration();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIPREFMIGRATION
|
||||
|
||||
// todo try to move this to private. We need this because we need to call this
|
||||
// from a thread.
|
||||
|
||||
nsVoidArray mProfilesToMigrate;
|
||||
nsresult ProcessPrefsCallback(const char* oldProfilePathStr, const char * newProfilePathStr);
|
||||
void WaitForThread();
|
||||
|
||||
nsresult mErrorCode;
|
||||
|
||||
private:
|
||||
|
||||
static nsPrefMigration* mInstance;
|
||||
|
||||
nsresult ConvertPersistentStringToFileSpec(const char *str, nsIFileSpec *path);
|
||||
nsresult CreateNewUser5Tree(nsIFileSpec* oldProfilePath,
|
||||
nsIFileSpec* newProfilePath);
|
||||
|
||||
nsresult GetDirFromPref(nsIFileSpec* oldProfilePath,
|
||||
nsIFileSpec* newProfilePath,
|
||||
const char* newDirName,
|
||||
const char* pref,
|
||||
nsIFileSpec* newPath,
|
||||
nsIFileSpec* oldPath);
|
||||
|
||||
nsresult GetSizes(nsFileSpec inputPath,
|
||||
PRBool readSubdirs,
|
||||
PRUint32* sizeTotal);
|
||||
|
||||
nsresult ComputeSpaceRequirements(PRInt64 DriveArray[],
|
||||
PRUint32 SpaceReqArray[],
|
||||
PRInt64 Drive,
|
||||
PRUint32 SpaceNeeded);
|
||||
|
||||
nsresult DoTheCopy(nsIFileSpec *oldPath,
|
||||
nsIFileSpec *newPath,
|
||||
PRBool readSubdirs);
|
||||
nsresult DoTheCopy(nsIFileSpec *oldPath,
|
||||
nsIFileSpec *newPath,
|
||||
const char *fileOrDirName,
|
||||
PRBool isDirectory = PR_FALSE);
|
||||
|
||||
nsresult DoTheCopyAndRename(nsIFileSpec *oldPath,
|
||||
nsIFileSpec *newPath,
|
||||
PRBool readSubdirs,
|
||||
PRBool needToRenameFiles,
|
||||
const char *oldName,
|
||||
const char *newName);
|
||||
nsresult DoTheCopyAndRename(nsIFileSpec *aPath,
|
||||
PRBool aReadSubdirs,
|
||||
const char *aOldName,
|
||||
const char *aNewName);
|
||||
nsresult CopyFilesByPattern(nsIFileSpec * oldPathSpec,
|
||||
nsIFileSpec * newPathSpec,
|
||||
const char *pattern);
|
||||
|
||||
|
||||
#ifdef NEED_TO_COPY_AND_RENAME_NEWSRC_FILES
|
||||
nsresult CopyAndRenameNewsrcFiles(nsIFileSpec *newPath);
|
||||
#endif /* NEED_TO_COPY_AND_RENAME_NEWSRC_FILES */
|
||||
|
||||
nsresult DoSpecialUpdates(nsIFileSpec * profilePath);
|
||||
nsresult Rename4xFileAfterMigration(nsIFileSpec *profilePath, const char *oldFileName, const char *newFileName);
|
||||
#ifdef IMAP_MAIL_FILTER_FILE_NAME_FORMAT_IN_4x
|
||||
nsresult RenameAndMove4xImapFilterFile(nsIFileSpec *profilePath, const char *hostname);
|
||||
nsresult RenameAndMove4xImapFilterFiles(nsIFileSpec *profilePath);
|
||||
#endif /* IMAP_MAIL_FILTER_FILE_NAME_FORMAT_IN_4x */
|
||||
nsresult RenameAndMove4xPopStateFile(nsIFileSpec *profilePath);
|
||||
nsresult RenameAndMove4xPopFilterFile(nsIFileSpec *profilePath);
|
||||
nsresult RenameAndMove4xPopFile(nsIFileSpec * profilePath, const char *fileNameIn4x, const char *fileNameIn5x);
|
||||
|
||||
nsresult DetermineOldPath(nsIFileSpec *profilePath, const char *oldPathName, const char *oldPathEntityName, nsIFileSpec *oldPath);
|
||||
nsresult SetPremigratedFilePref(const char *pref_name, nsIFileSpec *filePath);
|
||||
#ifdef NEED_TO_COPY_AND_RENAME_NEWSRC_FILES
|
||||
nsresult GetPremigratedFilePref(const char *pref_name, nsIFileSpec **filePath);
|
||||
#endif /* NEED_TO_COPY_AND_RENAME_NEWSRC_FILES */
|
||||
|
||||
nsresult getPrefService();
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> m_prefBranch;
|
||||
nsCOMPtr<nsILocalFile> m_prefsFile;
|
||||
nsCOMPtr<nsIDOMWindowInternal> m_parentWindow;
|
||||
nsCOMPtr<nsIDOMWindow> mPMProgressWindow;
|
||||
};
|
||||
|
||||
#endif /* nsPrefMigration_h___ */
|
@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* 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 "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsPrefMigration.h"
|
||||
#include "nsPrefMigrationFactory.h"
|
||||
|
||||
static NS_IMETHODIMP
|
||||
CreateNewPrefMigration(nsISupports* aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsPrefMigration* inst = nsPrefMigration::GetInstance();
|
||||
if (inst == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(rv)) {
|
||||
*aResult = nsnull;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrefConverter)
|
||||
|
||||
static const nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "Profile Migration",
|
||||
NS_PREFMIGRATION_CID,
|
||||
NS_PROFILEMIGRATION_CONTRACTID,
|
||||
CreateNewPrefMigration },
|
||||
{ "Pref Conversion",
|
||||
NS_PREFCONVERTER_CID,
|
||||
NS_PREFCONVERTER_CONTRACTID, nsPrefConverterConstructor}
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(nsPrefMigrationModule, components)
|
@ -1,68 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsPrefMigrationFactory_h___
|
||||
#define nsPrefMigrationFactory_h___
|
||||
|
||||
#include "nsPrefMigrationCIDs.h"
|
||||
#include "nsIPrefMigration.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
// Module implementation
|
||||
class nsPrefMigrationModule : public nsIModule
|
||||
{
|
||||
public:
|
||||
nsPrefMigrationModule();
|
||||
virtual ~nsPrefMigrationModule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIMODULE
|
||||
|
||||
protected:
|
||||
nsresult Initialize();
|
||||
|
||||
void Shutdown();
|
||||
|
||||
PRBool mInitialized;
|
||||
nsCOMPtr<nsIGenericFactory> mFactory;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user