OLD | NEW |
(Empty) | |
| 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 |
| 5 #ifndef WEBKIT_FILEAPI_REMOVE_OPERATION_DELEGATE_H_ |
| 6 #define WEBKIT_FILEAPI_REMOVE_OPERATION_DELEGATE_H_ |
| 7 |
| 8 #include <queue> |
| 9 #include <stack> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 #include "webkit/fileapi/file_system_operation.h" |
| 15 #include "webkit/fileapi/file_system_url.h" |
| 16 |
| 17 namespace fileapi { |
| 18 |
| 19 class FileSystemURL; |
| 20 class LocalFileSystemOperation; |
| 21 |
| 22 class RemoveOperationDelegate |
| 23 : public base::SupportsWeakPtr<RemoveOperationDelegate> { |
| 24 public: |
| 25 typedef FileSystemOperation::StatusCallback StatusCallback; |
| 26 typedef FileSystemOperation::FileEntryList FileEntryList; |
| 27 |
| 28 RemoveOperationDelegate(LocalFileSystemOperation* original_operation, |
| 29 const StatusCallback& callback); |
| 30 virtual ~RemoveOperationDelegate(); |
| 31 |
| 32 void Run(const FileSystemURL& url); |
| 33 void RunRecursively(const FileSystemURL& url); |
| 34 |
| 35 private: |
| 36 void ProcessNextDirectory(base::PlatformFileError error); |
| 37 void DidTryRemoveFile( |
| 38 const FileSystemURL& url, |
| 39 base::PlatformFileError error); |
| 40 void DidReadDirectory( |
| 41 const FileSystemURL& parent, |
| 42 base::PlatformFileError error, |
| 43 const FileEntryList& entries, |
| 44 bool has_more); |
| 45 void RemoveFile(const FileSystemURL& url); |
| 46 void DidRemoveFile(base::PlatformFileError error); |
| 47 void RemoveNextDirectory(base::PlatformFileError error); |
| 48 |
| 49 LocalFileSystemOperation* NewOperation(const FileSystemURL& url); |
| 50 |
| 51 LocalFileSystemOperation* original_operation_; |
| 52 StatusCallback callback_; |
| 53 |
| 54 std::queue<FileSystemURL> pending_directories_; |
| 55 std::stack<FileSystemURL> to_remove_directories_; |
| 56 |
| 57 int inflight_operations_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(RemoveOperationDelegate); |
| 60 }; |
| 61 |
| 62 } // namespace fileapi |
| 63 |
| 64 #endif // WEBKIT_FILEAPI_REMOVE_OPERATION_DELEGATE_H_ |
OLD | NEW |