Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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_GetFileOrDirectory_h
8 #define mozilla_dom_GetFileOrDirectory_h
10 #include "mozilla/dom/FileSystemTaskBase.h"
11 #include "nsAutoPtr.h"
13 namespace mozilla {
14 namespace dom {
16 class GetFileOrDirectoryTask MOZ_FINAL
17 : public FileSystemTaskBase
18 {
19 public:
20 // If aDirectoryOnly is set, we should ensure that the target is a directory.
21 GetFileOrDirectoryTask(FileSystemBase* aFileSystem,
22 const nsAString& aTargetPath,
23 bool aDirectoryOnly);
24 GetFileOrDirectoryTask(FileSystemBase* aFileSystem,
25 const FileSystemGetFileOrDirectoryParams& aParam,
26 FileSystemRequestParent* aParent);
28 virtual
29 ~GetFileOrDirectoryTask();
31 already_AddRefed<Promise>
32 GetPromise();
34 virtual void
35 GetPermissionAccessType(nsCString& aAccess) const MOZ_OVERRIDE;
36 protected:
37 virtual FileSystemParams
38 GetRequestParams(const nsString& aFileSystem) const MOZ_OVERRIDE;
40 virtual FileSystemResponseValue
41 GetSuccessRequestResult() const MOZ_OVERRIDE;
43 virtual void
44 SetSuccessRequestResult(const FileSystemResponseValue& aValue) MOZ_OVERRIDE;
46 virtual nsresult
47 Work() MOZ_OVERRIDE;
49 virtual void
50 HandlerCallback() MOZ_OVERRIDE;
52 private:
53 nsRefPtr<Promise> mPromise;
54 nsString mTargetRealPath;
55 // Whether we get a directory.
56 bool mIsDirectory;
57 nsCOMPtr<nsIDOMFile> mTargetFile;
58 };
60 } // namespace dom
61 } // namespace mozilla
63 #endif // mozilla_dom_GetFileOrDirectory_h