2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-03-23 00:15:36 -07:00
|
|
|
#ifndef nsPlacesExportService_h_
|
|
|
|
#define nsPlacesExportService_h_
|
2007-05-03 01:56:41 -07:00
|
|
|
|
|
|
|
#include "nsIPlacesImportExportService.h"
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2012-06-05 19:08:30 -07:00
|
|
|
#include "nsIFile.h"
|
2007-05-03 01:56:41 -07:00
|
|
|
#include "nsIOutputStream.h"
|
|
|
|
#include "nsIFaviconService.h"
|
|
|
|
#include "nsIAnnotationService.h"
|
2012-02-24 04:42:24 -08:00
|
|
|
#include "mozIAsyncLivemarks.h"
|
2007-05-03 01:56:41 -07:00
|
|
|
#include "nsINavHistoryService.h"
|
|
|
|
#include "nsINavBookmarksService.h"
|
2007-05-31 17:44:43 -07:00
|
|
|
#include "nsIChannel.h"
|
2007-05-03 01:56:41 -07:00
|
|
|
|
2012-03-23 00:15:36 -07:00
|
|
|
class nsPlacesExportService : public nsIPlacesImportExportService
|
2007-05-03 01:56:41 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPLACESIMPORTEXPORTSERVICE
|
2012-03-23 00:15:36 -07:00
|
|
|
nsPlacesExportService();
|
2007-05-03 01:56:41 -07:00
|
|
|
|
2010-03-23 18:17:49 -07:00
|
|
|
/**
|
|
|
|
* Obtains the service's object.
|
|
|
|
*/
|
2012-03-23 00:15:36 -07:00
|
|
|
static nsPlacesExportService* GetSingleton();
|
2010-03-23 18:17:49 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the service's object. This should only be called once.
|
|
|
|
*/
|
|
|
|
nsresult Init();
|
|
|
|
|
2007-05-03 01:56:41 -07:00
|
|
|
private:
|
2012-03-23 00:15:36 -07:00
|
|
|
static nsPlacesExportService* gExportService;
|
|
|
|
virtual ~nsPlacesExportService();
|
2007-05-03 01:56:41 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIFaviconService> mFaviconService;
|
|
|
|
nsCOMPtr<nsIAnnotationService> mAnnotationService;
|
|
|
|
nsCOMPtr<nsINavBookmarksService> mBookmarksService;
|
|
|
|
nsCOMPtr<nsINavHistoryService> mHistoryService;
|
2012-02-24 04:42:24 -08:00
|
|
|
nsCOMPtr<mozIAsyncLivemarks> mLivemarkService;
|
2007-05-03 01:56:41 -07:00
|
|
|
|
2007-05-24 22:41:49 -07: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 01:56:41 -07:00
|
|
|
nsresult WriteItem(nsINavHistoryResultNode* aItem, const nsACString& aIndent, nsIOutputStream* aOutput);
|
2007-05-24 22:41:49 -07:00
|
|
|
nsresult WriteLivemark(nsINavHistoryResultNode* aFolder, const nsACString& aIndent, nsIOutputStream* aOutput);
|
|
|
|
nsresult WriteContainerContents(nsINavHistoryResultNode* aFolder, const nsACString& aIndent, nsIOutputStream* aOutput);
|
2007-05-14 21:18:25 -07:00
|
|
|
nsresult WriteSeparator(nsINavHistoryResultNode* aItem, const nsACString& aIndent, nsIOutputStream* aOutput);
|
2007-05-11 12:26:14 -07:00
|
|
|
nsresult WriteDescription(PRInt64 aId, PRInt32 aType, nsIOutputStream* aOutput);
|
2007-05-03 01:56:41 -07:00
|
|
|
|
2007-05-10 16:52:47 -07: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 12:53:59 -07:00
|
|
|
}
|
2007-05-03 01:56:41 -07:00
|
|
|
};
|
|
|
|
|
2012-03-23 00:15:36 -07:00
|
|
|
#endif // nsPlacesExportService_h_
|