remove_operation_delegate.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright (c) 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef STORAGE_BROWSER_FILE_SYSTEM_REMOVE_OPERATION_DELEGATE_H_
  5. #define STORAGE_BROWSER_FILE_SYSTEM_REMOVE_OPERATION_DELEGATE_H_
  6. #include "storage/browser/file_system/recursive_operation_delegate.h"
  7. namespace storage {
  8. class RemoveOperationDelegate : public RecursiveOperationDelegate {
  9. public:
  10. RemoveOperationDelegate(FileSystemContext* file_system_context,
  11. const FileSystemURL& url,
  12. StatusCallback callback);
  13. RemoveOperationDelegate(const RemoveOperationDelegate&) = delete;
  14. RemoveOperationDelegate& operator=(const RemoveOperationDelegate&) = delete;
  15. ~RemoveOperationDelegate() override;
  16. // RecursiveOperationDelegate overrides:
  17. void Run() override;
  18. void RunRecursively() override;
  19. void ProcessFile(const FileSystemURL& url, StatusCallback callback) override;
  20. void ProcessDirectory(const FileSystemURL& url,
  21. StatusCallback callback) override;
  22. void PostProcessDirectory(const FileSystemURL& url,
  23. StatusCallback callback) override;
  24. private:
  25. void DidTryRemoveFile(base::File::Error error);
  26. void DidTryRemoveDirectory(base::File::Error remove_file_error,
  27. base::File::Error remove_directory_error);
  28. void DidRemoveFile(StatusCallback callback, base::File::Error error);
  29. #if DCHECK_IS_ON()
  30. bool did_run_ = false;
  31. #endif
  32. FileSystemURL url_;
  33. StatusCallback callback_;
  34. base::WeakPtrFactory<RemoveOperationDelegate> weak_factory_{this};
  35. };
  36. } // namespace storage
  37. #endif // STORAGE_BROWSER_FILE_SYSTEM_REMOVE_OPERATION_DELEGATE_H_