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