2007-05-03 08:56:41 +00:00
|
|
|
#ifndef nsPlacesImportExportService_h__
|
|
|
|
#define nsPlacesImportExportService_h__
|
|
|
|
|
|
|
|
#include "nsIPlacesImportExportService.h"
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsILocalFile.h"
|
|
|
|
#include "nsIOutputStream.h"
|
|
|
|
#include "nsIFaviconService.h"
|
|
|
|
#include "nsIAnnotationService.h"
|
|
|
|
#include "nsILivemarkService.h"
|
|
|
|
#include "nsINavHistoryService.h"
|
|
|
|
#include "nsINavBookmarksService.h"
|
2007-06-01 00:44:43 +00:00
|
|
|
#include "nsIChannel.h"
|
2007-05-03 08:56:41 +00:00
|
|
|
|
2007-06-01 00:44:43 +00:00
|
|
|
class nsPlacesImportExportService : public nsIPlacesImportExportService,
|
|
|
|
public nsINavHistoryBatchCallback
|
2007-05-03 08:56:41 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPLACESIMPORTEXPORTSERVICE
|
2007-06-01 00:44:43 +00:00
|
|
|
NS_DECL_NSINAVHISTORYBATCHCALLBACK
|
2007-05-03 08:56:41 +00:00
|
|
|
nsPlacesImportExportService();
|
|
|
|
|
2010-03-24 01:17:49 +00:00
|
|
|
/**
|
|
|
|
* Obtains the service's object.
|
|
|
|
*/
|
|
|
|
static nsPlacesImportExportService* GetSingleton();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the service's object. This should only be called once.
|
|
|
|
*/
|
|
|
|
nsresult Init();
|
|
|
|
|
2007-05-03 08:56:41 +00:00
|
|
|
private:
|
2010-03-24 01:17:49 +00:00
|
|
|
static nsPlacesImportExportService* gImportExportService;
|
2007-05-03 08:56:41 +00:00
|
|
|
virtual ~nsPlacesImportExportService();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIFaviconService> mFaviconService;
|
|
|
|
nsCOMPtr<nsIAnnotationService> mAnnotationService;
|
|
|
|
nsCOMPtr<nsINavBookmarksService> mBookmarksService;
|
|
|
|
nsCOMPtr<nsINavHistoryService> mHistoryService;
|
|
|
|
nsCOMPtr<nsILivemarkService> mLivemarkService;
|
|
|
|
|
2007-06-01 00:44:43 +00:00
|
|
|
nsCOMPtr<nsIChannel> mImportChannel;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsImportDefaults;
|
2007-06-01 00:44:43 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult ImportHTMLFromFileInternal(nsILocalFile* aFile, bool aAllowRootChanges,
|
|
|
|
PRInt64 aFolder, bool aIsImportDefaults);
|
|
|
|
nsresult ImportHTMLFromURIInternal(nsIURI* aURI, bool aAllowRootChanges,
|
|
|
|
PRInt64 aFolder, bool aIsImportDefaults);
|
2007-05-25 05:41:49 +00:00
|
|
|
nsresult WriteContainer(nsINavHistoryResultNode* aFolder, const nsACString& aIndent, nsIOutputStream* aOutput);
|
|
|
|
nsresult WriteContainerHeader(nsINavHistoryResultNode* aFolder, const nsACString& aIndent, nsIOutputStream* aOutput);
|
|
|
|
nsresult WriteTitle(nsINavHistoryResultNode* aItem, nsIOutputStream* aOutput);
|
2007-05-03 08:56:41 +00:00
|
|
|
nsresult WriteItem(nsINavHistoryResultNode* aItem, const nsACString& aIndent, nsIOutputStream* aOutput);
|
2007-05-25 05:41:49 +00:00
|
|
|
nsresult WriteLivemark(nsINavHistoryResultNode* aFolder, const nsACString& aIndent, nsIOutputStream* aOutput);
|
|
|
|
nsresult WriteContainerContents(nsINavHistoryResultNode* aFolder, const nsACString& aIndent, nsIOutputStream* aOutput);
|
2007-05-15 04:18:25 +00:00
|
|
|
nsresult WriteSeparator(nsINavHistoryResultNode* aItem, const nsACString& aIndent, nsIOutputStream* aOutput);
|
2007-05-11 19:26:14 +00:00
|
|
|
nsresult WriteDescription(PRInt64 aId, PRInt32 aType, nsIOutputStream* aOutput);
|
2007-05-03 08:56:41 +00:00
|
|
|
|
2007-05-10 23:52:47 +00:00
|
|
|
inline nsresult EnsureServiceState() {
|
|
|
|
NS_ENSURE_STATE(mHistoryService);
|
|
|
|
NS_ENSURE_STATE(mFaviconService);
|
|
|
|
NS_ENSURE_STATE(mAnnotationService);
|
|
|
|
NS_ENSURE_STATE(mBookmarksService);
|
|
|
|
NS_ENSURE_STATE(mLivemarkService);
|
|
|
|
return NS_OK;
|
2007-06-16 19:53:59 +00:00
|
|
|
}
|
2007-05-03 08:56:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsPlacesImportExportService_h__
|