dom/filesystem/GetFileOrDirectoryTask.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/filesystem/GetFileOrDirectoryTask.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_GetFileOrDirectory_h
    1.11 +#define mozilla_dom_GetFileOrDirectory_h
    1.12 +
    1.13 +#include "mozilla/dom/FileSystemTaskBase.h"
    1.14 +#include "nsAutoPtr.h"
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace dom {
    1.18 +
    1.19 +class GetFileOrDirectoryTask MOZ_FINAL
    1.20 +  : public FileSystemTaskBase
    1.21 +{
    1.22 +public:
    1.23 +  // If aDirectoryOnly is set, we should ensure that the target is a directory.
    1.24 +  GetFileOrDirectoryTask(FileSystemBase* aFileSystem,
    1.25 +                         const nsAString& aTargetPath,
    1.26 +                         bool aDirectoryOnly);
    1.27 +  GetFileOrDirectoryTask(FileSystemBase* aFileSystem,
    1.28 +                         const FileSystemGetFileOrDirectoryParams& aParam,
    1.29 +                         FileSystemRequestParent* aParent);
    1.30 +
    1.31 +  virtual
    1.32 +  ~GetFileOrDirectoryTask();
    1.33 +
    1.34 +  already_AddRefed<Promise>
    1.35 +  GetPromise();
    1.36 +
    1.37 +  virtual void
    1.38 +  GetPermissionAccessType(nsCString& aAccess) const MOZ_OVERRIDE;
    1.39 +protected:
    1.40 +  virtual FileSystemParams
    1.41 +  GetRequestParams(const nsString& aFileSystem) const MOZ_OVERRIDE;
    1.42 +
    1.43 +  virtual FileSystemResponseValue
    1.44 +  GetSuccessRequestResult() const MOZ_OVERRIDE;
    1.45 +
    1.46 +  virtual void
    1.47 +  SetSuccessRequestResult(const FileSystemResponseValue& aValue) MOZ_OVERRIDE;
    1.48 +
    1.49 +  virtual nsresult
    1.50 +  Work() MOZ_OVERRIDE;
    1.51 +
    1.52 +  virtual void
    1.53 +  HandlerCallback() MOZ_OVERRIDE;
    1.54 +
    1.55 +private:
    1.56 +  nsRefPtr<Promise> mPromise;
    1.57 +  nsString mTargetRealPath;
    1.58 +  // Whether we get a directory.
    1.59 +  bool mIsDirectory;
    1.60 +  nsCOMPtr<nsIDOMFile> mTargetFile;
    1.61 +};
    1.62 +
    1.63 +} // namespace dom
    1.64 +} // namespace mozilla
    1.65 +
    1.66 +#endif // mozilla_dom_GetFileOrDirectory_h

mercurial