2012-06-03 20:33:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
2014-06-12 07:35:29 +04:00
|
|
|
#ifndef mozilla_dom_MutableFile_h
|
|
|
|
#define mozilla_dom_MutableFile_h
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-05-07 18:32:12 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
2012-12-02 12:58:57 +04:00
|
|
|
|
2014-05-07 18:32:12 +04:00
|
|
|
class nsIFile;
|
2014-05-07 18:33:02 +04:00
|
|
|
class nsIOfflineStorage;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2013-03-17 12:51:36 +04:00
|
|
|
namespace mozilla {
|
2014-05-07 18:32:12 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2012-06-03 20:33:52 +04:00
|
|
|
class FileService;
|
2014-05-07 18:32:12 +04:00
|
|
|
|
2012-06-03 20:33:52 +04:00
|
|
|
/**
|
2014-07-17 20:40:54 +04:00
|
|
|
* This class provides a base for MutableFile implementations.
|
2015-04-02 09:22:19 +03:00
|
|
|
* The subclasses can override implementation of IsInvalid and CreateStream.
|
2014-06-12 07:35:29 +04:00
|
|
|
* (for example IDBMutableFile provides IndexedDB specific implementation).
|
2012-06-03 20:33:52 +04:00
|
|
|
*/
|
2014-07-17 20:40:54 +04:00
|
|
|
class MutableFileBase
|
2012-06-03 20:33:52 +04:00
|
|
|
{
|
|
|
|
friend class FileService;
|
|
|
|
|
|
|
|
public:
|
2014-07-17 20:40:54 +04:00
|
|
|
NS_IMETHOD_(MozExternalRefCountType)
|
|
|
|
AddRef() = 0;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
NS_IMETHOD_(MozExternalRefCountType)
|
|
|
|
Release() = 0;
|
2014-05-07 18:33:02 +04:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
IsInvalid()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// A temporary method that will be removed along with nsIOfflineStorage
|
|
|
|
// interface.
|
|
|
|
virtual nsIOfflineStorage*
|
|
|
|
Storage() = 0;
|
|
|
|
|
2012-06-03 20:33:52 +04:00
|
|
|
virtual already_AddRefed<nsISupports>
|
2014-07-17 20:40:54 +04:00
|
|
|
CreateStream(bool aReadOnly);
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-05-07 18:33:02 +04:00
|
|
|
|
2012-06-03 20:33:52 +04:00
|
|
|
protected:
|
2014-07-17 20:40:54 +04:00
|
|
|
MutableFileBase();
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
virtual ~MutableFileBase();
|
2012-06-03 20:33:52 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIFile> mFile;
|
2014-05-07 18:33:02 +04:00
|
|
|
|
|
|
|
nsCString mStorageId;
|
2012-06-03 20:33:52 +04:00
|
|
|
nsString mFileName;
|
|
|
|
};
|
|
|
|
|
2014-05-07 18:32:12 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-06-12 07:35:29 +04:00
|
|
|
#endif // mozilla_dom_MutableFile_h
|