michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_GetFileOrDirectory_h michael@0: #define mozilla_dom_GetFileOrDirectory_h michael@0: michael@0: #include "mozilla/dom/FileSystemTaskBase.h" michael@0: #include "nsAutoPtr.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class GetFileOrDirectoryTask MOZ_FINAL michael@0: : public FileSystemTaskBase michael@0: { michael@0: public: michael@0: // If aDirectoryOnly is set, we should ensure that the target is a directory. michael@0: GetFileOrDirectoryTask(FileSystemBase* aFileSystem, michael@0: const nsAString& aTargetPath, michael@0: bool aDirectoryOnly); michael@0: GetFileOrDirectoryTask(FileSystemBase* aFileSystem, michael@0: const FileSystemGetFileOrDirectoryParams& aParam, michael@0: FileSystemRequestParent* aParent); michael@0: michael@0: virtual michael@0: ~GetFileOrDirectoryTask(); michael@0: michael@0: already_AddRefed michael@0: GetPromise(); michael@0: michael@0: virtual void michael@0: GetPermissionAccessType(nsCString& aAccess) const MOZ_OVERRIDE; michael@0: protected: michael@0: virtual FileSystemParams michael@0: GetRequestParams(const nsString& aFileSystem) const MOZ_OVERRIDE; michael@0: michael@0: virtual FileSystemResponseValue michael@0: GetSuccessRequestResult() const MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: SetSuccessRequestResult(const FileSystemResponseValue& aValue) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: Work() MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: HandlerCallback() MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: nsRefPtr mPromise; michael@0: nsString mTargetRealPath; michael@0: // Whether we get a directory. michael@0: bool mIsDirectory; michael@0: nsCOMPtr mTargetFile; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_GetFileOrDirectory_h