Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsFileSystemDataSource_h__ |
michael@0 | 7 | #define nsFileSystemDataSource_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIRDFDataSource.h" |
michael@0 | 10 | #include "nsIRDFLiteral.h" |
michael@0 | 11 | #include "nsIRDFResource.h" |
michael@0 | 12 | #include "nsIRDFService.h" |
michael@0 | 13 | #include "nsCOMPtr.h" |
michael@0 | 14 | #include "nsString.h" |
michael@0 | 15 | #include "mozilla/Attributes.h" |
michael@0 | 16 | |
michael@0 | 17 | #if defined(XP_UNIX) || defined(XP_WIN) |
michael@0 | 18 | #define USE_NC_EXTENSION |
michael@0 | 19 | #endif |
michael@0 | 20 | |
michael@0 | 21 | class FileSystemDataSource MOZ_FINAL : public nsIRDFDataSource |
michael@0 | 22 | { |
michael@0 | 23 | public: |
michael@0 | 24 | NS_DECL_ISUPPORTS |
michael@0 | 25 | NS_DECL_NSIRDFDATASOURCE |
michael@0 | 26 | |
michael@0 | 27 | static nsresult Create(nsISupports* aOuter, |
michael@0 | 28 | const nsIID& aIID, void **aResult); |
michael@0 | 29 | |
michael@0 | 30 | ~FileSystemDataSource() { } |
michael@0 | 31 | nsresult Init(); |
michael@0 | 32 | |
michael@0 | 33 | private: |
michael@0 | 34 | FileSystemDataSource() { } |
michael@0 | 35 | |
michael@0 | 36 | // helper methods |
michael@0 | 37 | bool isFileURI(nsIRDFResource* aResource); |
michael@0 | 38 | bool isDirURI(nsIRDFResource* aSource); |
michael@0 | 39 | nsresult GetVolumeList(nsISimpleEnumerator **aResult); |
michael@0 | 40 | nsresult GetFolderList(nsIRDFResource *source, bool allowHidden, bool onlyFirst, nsISimpleEnumerator **aResult); |
michael@0 | 41 | nsresult GetName(nsIRDFResource *source, nsIRDFLiteral** aResult); |
michael@0 | 42 | nsresult GetURL(nsIRDFResource *source, bool *isFavorite, nsIRDFLiteral** aResult); |
michael@0 | 43 | nsresult GetFileSize(nsIRDFResource *source, nsIRDFInt** aResult); |
michael@0 | 44 | nsresult GetLastMod(nsIRDFResource *source, nsIRDFDate** aResult); |
michael@0 | 45 | |
michael@0 | 46 | nsCOMPtr<nsIRDFService> mRDFService; |
michael@0 | 47 | |
michael@0 | 48 | // pseudo-constants |
michael@0 | 49 | nsCOMPtr<nsIRDFResource> mNC_FileSystemRoot; |
michael@0 | 50 | nsCOMPtr<nsIRDFResource> mNC_Child; |
michael@0 | 51 | nsCOMPtr<nsIRDFResource> mNC_Name; |
michael@0 | 52 | nsCOMPtr<nsIRDFResource> mNC_URL; |
michael@0 | 53 | nsCOMPtr<nsIRDFResource> mNC_Icon; |
michael@0 | 54 | nsCOMPtr<nsIRDFResource> mNC_Length; |
michael@0 | 55 | nsCOMPtr<nsIRDFResource> mNC_IsDirectory; |
michael@0 | 56 | nsCOMPtr<nsIRDFResource> mWEB_LastMod; |
michael@0 | 57 | nsCOMPtr<nsIRDFResource> mNC_FileSystemObject; |
michael@0 | 58 | nsCOMPtr<nsIRDFResource> mNC_pulse; |
michael@0 | 59 | nsCOMPtr<nsIRDFResource> mRDF_InstanceOf; |
michael@0 | 60 | nsCOMPtr<nsIRDFResource> mRDF_type; |
michael@0 | 61 | |
michael@0 | 62 | nsCOMPtr<nsIRDFLiteral> mLiteralTrue; |
michael@0 | 63 | nsCOMPtr<nsIRDFLiteral> mLiteralFalse; |
michael@0 | 64 | |
michael@0 | 65 | #ifdef USE_NC_EXTENSION |
michael@0 | 66 | nsresult GetExtension(nsIRDFResource *source, nsIRDFLiteral** aResult); |
michael@0 | 67 | nsCOMPtr<nsIRDFResource> mNC_extension; |
michael@0 | 68 | #endif |
michael@0 | 69 | |
michael@0 | 70 | #ifdef XP_WIN |
michael@0 | 71 | bool isValidFolder(nsIRDFResource *source); |
michael@0 | 72 | nsresult getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral); |
michael@0 | 73 | nsCOMPtr<nsIRDFResource> mNC_IEFavoriteObject; |
michael@0 | 74 | nsCOMPtr<nsIRDFResource> mNC_IEFavoriteFolder; |
michael@0 | 75 | nsCString ieFavoritesDir; |
michael@0 | 76 | #endif |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | #endif // nsFileSystemDataSource_h__ |