1 #ifndef nsPlacesImportExportService_h__
2 #define nsPlacesImportExportService_h__
4 #include "nsIPlacesImportExportService.h"
7 #include "nsILocalFile.h"
8 #include "nsIOutputStream.h"
9 #include "nsIFaviconService.h"
10 #include "nsIAnnotationService.h"
11 #include "nsILivemarkService.h"
12 #include "nsINavHistoryService.h"
13 #include "nsINavBookmarksService.h"
14 #include "nsIMicrosummaryService.h"
15 #include "nsIChannel.h"
17 class nsPlacesImportExportService
: public nsIPlacesImportExportService
,
18 public nsINavHistoryBatchCallback
22 NS_DECL_NSIPLACESIMPORTEXPORTSERVICE
23 NS_DECL_NSINAVHISTORYBATCHCALLBACK
24 nsPlacesImportExportService();
27 virtual ~nsPlacesImportExportService();
30 nsCOMPtr
<nsIFaviconService
> mFaviconService
;
31 nsCOMPtr
<nsIAnnotationService
> mAnnotationService
;
32 nsCOMPtr
<nsINavBookmarksService
> mBookmarksService
;
33 nsCOMPtr
<nsINavHistoryService
> mHistoryService
;
34 nsCOMPtr
<nsILivemarkService
> mLivemarkService
;
35 nsCOMPtr
<nsIMicrosummaryService
> mMicrosummaryService
;
37 nsCOMPtr
<nsIChannel
> mImportChannel
;
38 PRBool mIsImportDefaults
;
40 nsresult
ImportHTMLFromFileInternal(nsILocalFile
* aFile
, PRBool aAllowRootChanges
,
41 PRInt64 aFolder
, PRBool aIsImportDefaults
);
42 nsresult
WriteContainer(nsINavHistoryResultNode
* aFolder
, const nsACString
& aIndent
, nsIOutputStream
* aOutput
);
43 nsresult
WriteContainerHeader(nsINavHistoryResultNode
* aFolder
, const nsACString
& aIndent
, nsIOutputStream
* aOutput
);
44 nsresult
WriteTitle(nsINavHistoryResultNode
* aItem
, nsIOutputStream
* aOutput
);
45 nsresult
WriteItem(nsINavHistoryResultNode
* aItem
, const nsACString
& aIndent
, nsIOutputStream
* aOutput
);
46 nsresult
WriteLivemark(nsINavHistoryResultNode
* aFolder
, const nsACString
& aIndent
, nsIOutputStream
* aOutput
);
47 nsresult
WriteContainerContents(nsINavHistoryResultNode
* aFolder
, const nsACString
& aIndent
, nsIOutputStream
* aOutput
);
48 nsresult
WriteSeparator(nsINavHistoryResultNode
* aItem
, const nsACString
& aIndent
, nsIOutputStream
* aOutput
);
49 nsresult
WriteDescription(PRInt64 aId
, PRInt32 aType
, nsIOutputStream
* aOutput
);
51 inline nsresult
EnsureServiceState() {
52 NS_ENSURE_STATE(mHistoryService
);
53 NS_ENSURE_STATE(mFaviconService
);
54 NS_ENSURE_STATE(mAnnotationService
);
55 NS_ENSURE_STATE(mBookmarksService
);
56 NS_ENSURE_STATE(mLivemarkService
);
57 NS_ENSURE_STATE(mMicrosummaryService
);
62 #endif // nsPlacesImportExportService_h__