dom/filesystem/CreateFileTask.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_CreateFileTask_h
     8 #define mozilla_dom_CreateFileTask_h
    10 #include "mozilla/dom/FileSystemTaskBase.h"
    11 #include "nsAutoPtr.h"
    13 class nsIDOMBlob;
    14 class nsIInputStream;
    16 namespace mozilla {
    17 namespace dom {
    19 class Promise;
    21 class CreateFileTask MOZ_FINAL
    22   : public FileSystemTaskBase
    23 {
    24 public:
    25   CreateFileTask(FileSystemBase* aFileSystem,
    26                  const nsAString& aPath,
    27                  nsIDOMBlob* aBlobData,
    28                  InfallibleTArray<uint8_t>& aArrayData,
    29                  bool replace);
    30   CreateFileTask(FileSystemBase* aFileSystem,
    31                  const FileSystemCreateFileParams& aParam,
    32                  FileSystemRequestParent* aParent);
    34   virtual
    35   ~CreateFileTask();
    37   already_AddRefed<Promise>
    38   GetPromise();
    40   virtual void
    41   GetPermissionAccessType(nsCString& aAccess) const MOZ_OVERRIDE;
    43 protected:
    44   virtual FileSystemParams
    45   GetRequestParams(const nsString& aFileSystem) const MOZ_OVERRIDE;
    47   virtual FileSystemResponseValue
    48   GetSuccessRequestResult() const MOZ_OVERRIDE;
    50   virtual void
    51   SetSuccessRequestResult(const FileSystemResponseValue& aValue) MOZ_OVERRIDE;
    53   virtual nsresult
    54   Work() MOZ_OVERRIDE;
    56   virtual void
    57   HandlerCallback() MOZ_OVERRIDE;
    59 private:
    60   void
    61   GetOutputBufferSize() const;
    63   static uint32_t sOutputBufferSize;
    64   nsRefPtr<Promise> mPromise;
    65   nsString mTargetRealPath;
    66   nsCOMPtr<nsIDOMBlob> mBlobData;
    67   nsCOMPtr<nsIInputStream> mBlobStream;
    68   InfallibleTArray<uint8_t> mArrayData;
    69   bool mReplace;
    70   nsCOMPtr<nsIDOMFile> mTargetFile;
    71 };
    73 } // namespace dom
    74 } // namespace mozilla
    76 #endif // mozilla_dom_CreateFileTask_h

mercurial