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 15 : public RecursiveOperationDelegate { 16 public: 17 RemoveOperationDelegate(FileSystemContext* file_system_context, 18 const FileSystemURL& url, 19 const StatusCallback& callback); 20 virtual ~RemoveOperationDelegate(); 21 22 // RecursiveOperationDelegate overrides: 23 virtual void Run() OVERRIDE; 24 virtual void RunRecursively() OVERRIDE; 25 virtual void ProcessFile(const FileSystemURL& url, 26 const StatusCallback& callback) OVERRIDE; 27 virtual void ProcessDirectory(const FileSystemURL& url, 28 const StatusCallback& callback) OVERRIDE; 29 30 private: 31 void DidTryRemoveFile(base::PlatformFileError error); 32 void DidRemoveFile(const StatusCallback& callback, 33 base::PlatformFileError error); 34 void RemoveNextDirectory(base::PlatformFileError error); 35 36 FileSystemURL url_; 37 StatusCallback callback_; 38 39 std::stack<FileSystemURL> to_remove_directories_; 40 41 base::WeakPtrFactory<RemoveOperationDelegate> weak_factory_; 42 43 DISALLOW_COPY_AND_ASSIGN(RemoveOperationDelegate); 44 }; 45 46 } // namespace fileapi 47 48 #endif // WEBKIT_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_ 49