- add sources.
[platform/framework/web/crosswalk.git] / src / webkit / browser / fileapi / remove_operation_delegate.h
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_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_
6 #define WEBKIT_BROWSER_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 : public RecursiveOperationDelegate {
15  public:
16   RemoveOperationDelegate(FileSystemContext* file_system_context,
17                           const FileSystemURL& url,
18                           const StatusCallback& callback);
19   virtual ~RemoveOperationDelegate();
20
21   // RecursiveOperationDelegate overrides:
22   virtual void Run() OVERRIDE;
23   virtual void RunRecursively() OVERRIDE;
24   virtual void ProcessFile(const FileSystemURL& url,
25                            const StatusCallback& callback) OVERRIDE;
26   virtual void ProcessDirectory(const FileSystemURL& url,
27                                 const StatusCallback& callback) OVERRIDE;
28   virtual void PostProcessDirectory(const FileSystemURL& url,
29                                     const StatusCallback& callback) OVERRIDE;
30
31  private:
32   void DidTryRemoveFile(base::PlatformFileError error);
33   void DidTryRemoveDirectory(base::PlatformFileError remove_file_error,
34                              base::PlatformFileError remove_directory_error);
35   void DidRemoveFile(const StatusCallback& callback,
36                      base::PlatformFileError error);
37
38   FileSystemURL url_;
39   StatusCallback callback_;
40   base::WeakPtrFactory<RemoveOperationDelegate> weak_factory_;
41   DISALLOW_COPY_AND_ASSIGN(RemoveOperationDelegate);
42 };
43
44 }  // namespace fileapi
45
46 #endif  // WEBKIT_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_