2014-03-12 06:30:21 +00:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_RemoveTask_h
|
|
|
|
#define mozilla_dom_RemoveTask_h
|
|
|
|
|
|
|
|
#include "mozilla/dom/FileSystemTaskBase.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2014-07-19 01:31:11 +00:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2014-03-12 06:30:21 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-10-08 16:15:23 +00:00
|
|
|
class FileImpl;
|
2014-03-12 06:30:21 +00:00
|
|
|
class Promise;
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class RemoveTask final
|
2014-03-12 06:30:21 +00:00
|
|
|
: public FileSystemTaskBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RemoveTask(FileSystemBase* aFileSystem,
|
|
|
|
const nsAString& aDirPath,
|
2014-10-08 16:15:23 +00:00
|
|
|
FileImpl* aTargetFile,
|
2014-03-12 06:30:21 +00:00
|
|
|
const nsAString& aTargetPath,
|
2014-07-19 01:31:11 +00:00
|
|
|
bool aRecursive,
|
|
|
|
ErrorResult& aRv);
|
2014-03-12 06:30:21 +00:00
|
|
|
RemoveTask(FileSystemBase* aFileSystem,
|
|
|
|
const FileSystemRemoveParams& aParam,
|
|
|
|
FileSystemRequestParent* aParent);
|
|
|
|
|
|
|
|
virtual
|
|
|
|
~RemoveTask();
|
|
|
|
|
|
|
|
already_AddRefed<Promise>
|
|
|
|
GetPromise();
|
|
|
|
|
|
|
|
virtual void
|
2015-03-21 16:28:04 +00:00
|
|
|
GetPermissionAccessType(nsCString& aAccess) const override;
|
2014-03-12 06:30:21 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual FileSystemParams
|
2015-03-21 16:28:04 +00:00
|
|
|
GetRequestParams(const nsString& aFileSystem) const override;
|
2014-03-12 06:30:21 +00:00
|
|
|
|
|
|
|
virtual FileSystemResponseValue
|
2015-03-21 16:28:04 +00:00
|
|
|
GetSuccessRequestResult() const override;
|
2014-03-12 06:30:21 +00:00
|
|
|
|
|
|
|
virtual void
|
2015-03-21 16:28:04 +00:00
|
|
|
SetSuccessRequestResult(const FileSystemResponseValue& aValue) override;
|
2014-03-12 06:30:21 +00:00
|
|
|
|
|
|
|
virtual nsresult
|
2015-03-21 16:28:04 +00:00
|
|
|
Work() override;
|
2014-03-12 06:30:21 +00:00
|
|
|
|
|
|
|
virtual void
|
2015-03-21 16:28:04 +00:00
|
|
|
HandlerCallback() override;
|
2014-03-12 06:30:21 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<Promise> mPromise;
|
|
|
|
nsString mDirRealPath;
|
2014-10-08 16:15:23 +00:00
|
|
|
// This cannot be a File because this object will be used on a different
|
|
|
|
// thread and File is not thread-safe. Let's use the FileImpl instead.
|
|
|
|
nsRefPtr<FileImpl> mTargetFileImpl;
|
2014-03-12 06:30:21 +00:00
|
|
|
nsString mTargetRealPath;
|
|
|
|
bool mRecursive;
|
|
|
|
bool mReturnValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_RemoveTask_h
|