2005-12-01 15:03:48 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2005-12-01 15:03:48 +00:00
|
|
|
|
|
|
|
#ifndef nsFileSystemDataSource_h__
|
|
|
|
#define nsFileSystemDataSource_h__
|
|
|
|
|
|
|
|
#include "nsIRDFDataSource.h"
|
|
|
|
#include "nsIRDFLiteral.h"
|
|
|
|
#include "nsIRDFResource.h"
|
|
|
|
#include "nsIRDFService.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
2012-06-13 03:42:36 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2005-12-01 15:03:48 +00:00
|
|
|
|
2014-02-10 22:57:01 +00:00
|
|
|
#if defined(XP_UNIX) || defined(XP_WIN)
|
2005-12-01 15:03:48 +00:00
|
|
|
#define USE_NC_EXTENSION
|
|
|
|
#endif
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class FileSystemDataSource final : public nsIRDFDataSource
|
2005-12-01 15:03:48 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-02-07 10:19:08 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2005-12-01 15:03:48 +00:00
|
|
|
NS_DECL_NSIRDFDATASOURCE
|
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
static nsresult Create(nsISupports* aOuter,
|
|
|
|
const nsIID& aIID, void **aResult);
|
2005-12-01 15:03:48 +00:00
|
|
|
|
2005-12-01 16:06:27 +00:00
|
|
|
nsresult Init();
|
2005-12-01 15:03:48 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
FileSystemDataSource() { }
|
2014-06-30 22:11:50 +00:00
|
|
|
~FileSystemDataSource() { }
|
2005-12-01 15:03:48 +00:00
|
|
|
|
|
|
|
// helper methods
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isFileURI(nsIRDFResource* aResource);
|
|
|
|
bool isDirURI(nsIRDFResource* aSource);
|
2005-12-01 15:03:48 +00:00
|
|
|
nsresult GetVolumeList(nsISimpleEnumerator **aResult);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetFolderList(nsIRDFResource *source, bool allowHidden, bool onlyFirst, nsISimpleEnumerator **aResult);
|
2005-12-01 15:03:48 +00:00
|
|
|
nsresult GetName(nsIRDFResource *source, nsIRDFLiteral** aResult);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetURL(nsIRDFResource *source, bool *isFavorite, nsIRDFLiteral** aResult);
|
2005-12-01 15:03:48 +00:00
|
|
|
nsresult GetFileSize(nsIRDFResource *source, nsIRDFInt** aResult);
|
|
|
|
nsresult GetLastMod(nsIRDFResource *source, nsIRDFDate** aResult);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIRDFService> mRDFService;
|
|
|
|
|
|
|
|
// pseudo-constants
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_FileSystemRoot;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_Child;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_Name;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_URL;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_Icon;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_Length;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_IsDirectory;
|
|
|
|
nsCOMPtr<nsIRDFResource> mWEB_LastMod;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_FileSystemObject;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_pulse;
|
|
|
|
nsCOMPtr<nsIRDFResource> mRDF_InstanceOf;
|
|
|
|
nsCOMPtr<nsIRDFResource> mRDF_type;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIRDFLiteral> mLiteralTrue;
|
|
|
|
nsCOMPtr<nsIRDFLiteral> mLiteralFalse;
|
|
|
|
|
|
|
|
#ifdef USE_NC_EXTENSION
|
|
|
|
nsresult GetExtension(nsIRDFResource *source, nsIRDFLiteral** aResult);
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_extension;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XP_WIN
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isValidFolder(nsIRDFResource *source);
|
2005-12-01 15:03:48 +00:00
|
|
|
nsresult getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral);
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_IEFavoriteObject;
|
|
|
|
nsCOMPtr<nsIRDFResource> mNC_IEFavoriteFolder;
|
|
|
|
nsCString ieFavoritesDir;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsFileSystemDataSource_h__
|