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 <stack> | |
9 | |
10 #include "webkit/browser/fileapi/recursive_operation_delegate.h" | |
11 | |
12 namespace fileapi { | |
13 | |
14 class RemoveOperationDelegate | |
15 : public RecursiveOperationDelegate, | |
16 public base::SupportsWeakPtr<RemoveOperationDelegate> { | |
17 public: | |
18 RemoveOperationDelegate(FileSystemContext* file_system_context, | |
19 LocalFileSystemOperation* operation, | |
20 const FileSystemURL& url, | |
21 const StatusCallback& callback); | |
22 virtual ~RemoveOperationDelegate(); | |
23 | |
24 // RecursiveOperationDelegate overrides: | |
25 virtual void Run() OVERRIDE; | |
26 virtual void RunRecursively() OVERRIDE; | |
27 virtual void ProcessFile(const FileSystemURL& url, | |
28 const StatusCallback& callback) OVERRIDE; | |
29 virtual void ProcessDirectory(const FileSystemURL& url, | |
30 const StatusCallback& callback) OVERRIDE; | |
31 | |
32 using base::SupportsWeakPtr<RemoveOperationDelegate>::AsWeakPtr; | |
33 | |
34 private: | |
35 void DidTryRemoveFile(base::PlatformFileError error); | |
36 void DidRemoveFile(const StatusCallback& callback, | |
37 base::PlatformFileError error); | |
38 void RemoveNextDirectory(base::PlatformFileError error); | |
39 | |
40 FileSystemURL url_; | |
41 StatusCallback callback_; | |
42 | |
43 std::stack<FileSystemURL> to_remove_directories_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(RemoveOperationDelegate); | |
46 }; | |
47 | |
48 } // namespace fileapi | |
49 | |
50 #endif // WEBKIT_FILEAPI_REMOVE_OPERATION_DELEGATE_H_ | |
OLD | NEW |