dom/filesystem/GetFileOrDirectoryTask.h

changeset 2
7e26c7da4463
equal deleted inserted replaced
-1:000000000000 0:323da63e787a
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/. */
6
7 #ifndef mozilla_dom_GetFileOrDirectory_h
8 #define mozilla_dom_GetFileOrDirectory_h
9
10 #include "mozilla/dom/FileSystemTaskBase.h"
11 #include "nsAutoPtr.h"
12
13 namespace mozilla {
14 namespace dom {
15
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);
27
28 virtual
29 ~GetFileOrDirectoryTask();
30
31 already_AddRefed<Promise>
32 GetPromise();
33
34 virtual void
35 GetPermissionAccessType(nsCString& aAccess) const MOZ_OVERRIDE;
36 protected:
37 virtual FileSystemParams
38 GetRequestParams(const nsString& aFileSystem) const MOZ_OVERRIDE;
39
40 virtual FileSystemResponseValue
41 GetSuccessRequestResult() const MOZ_OVERRIDE;
42
43 virtual void
44 SetSuccessRequestResult(const FileSystemResponseValue& aValue) MOZ_OVERRIDE;
45
46 virtual nsresult
47 Work() MOZ_OVERRIDE;
48
49 virtual void
50 HandlerCallback() MOZ_OVERRIDE;
51
52 private:
53 nsRefPtr<Promise> mPromise;
54 nsString mTargetRealPath;
55 // Whether we get a directory.
56 bool mIsDirectory;
57 nsCOMPtr<nsIDOMFile> mTargetFile;
58 };
59
60 } // namespace dom
61 } // namespace mozilla
62
63 #endif // mozilla_dom_GetFileOrDirectory_h

mercurial