Simplifies RemoveOperationDelegate implementation.

RecursiveOperationDelegate supports PostProcessDirectory(), so
RemoveOperationDelegate implementation can be simplified with the moethd.

BUG=282107
TEST=Ran content_unittests and unit_tests

Review URL: https://chromiumcodereview.appspot.com/23844007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224168 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/webkit/browser/fileapi/remove_operation_delegate.cc b/webkit/browser/fileapi/remove_operation_delegate.cc
index 5988733..b053960 100644
--- a/webkit/browser/fileapi/remove_operation_delegate.cc
+++ b/webkit/browser/fileapi/remove_operation_delegate.cc
@@ -28,39 +28,30 @@
 }
 
 void RemoveOperationDelegate::RunRecursively() {
-  StartRecursiveOperation(
-      url_,
-      base::Bind(&RemoveOperationDelegate::RemoveNextDirectory,
-                 weak_factory_.GetWeakPtr()));
+  StartRecursiveOperation(url_, callback_);
 }
 
 void RemoveOperationDelegate::ProcessFile(const FileSystemURL& url,
                                           const StatusCallback& callback) {
-  if (to_remove_directories_.size() == 1u &&
-      to_remove_directories_.top() == url) {
-    // We seem to have been re-directed from ProcessDirectory.
-    to_remove_directories_.pop();
-  }
-  operation_runner()->RemoveFile(url, base::Bind(
-      &RemoveOperationDelegate::DidRemoveFile,
-      weak_factory_.GetWeakPtr(), callback));
+  operation_runner()->RemoveFile(
+      url,
+      base::Bind(&RemoveOperationDelegate::DidRemoveFile,
+                 weak_factory_.GetWeakPtr(), callback));
 }
 
 void RemoveOperationDelegate::ProcessDirectory(const FileSystemURL& url,
                                                const StatusCallback& callback) {
-  to_remove_directories_.push(url);
   callback.Run(base::PLATFORM_FILE_OK);
 }
 
 void RemoveOperationDelegate::PostProcessDirectory(
     const FileSystemURL& url, const StatusCallback& callback) {
-  callback.Run(base::PLATFORM_FILE_OK);
+  operation_runner()->RemoveDirectory(url, callback);
 }
 
 void RemoveOperationDelegate::DidTryRemoveFile(
     base::PlatformFileError error) {
-  if (error == base::PLATFORM_FILE_OK ||
-      error != base::PLATFORM_FILE_ERROR_NOT_A_FILE) {
+  if (error != base::PLATFORM_FILE_ERROR_NOT_A_FILE) {
     callback_.Run(error);
     return;
   }
@@ -76,18 +67,4 @@
   callback.Run(error);
 }
 
-void RemoveOperationDelegate::RemoveNextDirectory(
-    base::PlatformFileError error) {
-  if (error != base::PLATFORM_FILE_OK ||
-      to_remove_directories_.empty()) {
-    callback_.Run(error);
-    return;
-  }
-  FileSystemURL url = to_remove_directories_.top();
-  to_remove_directories_.pop();
-  operation_runner()->RemoveDirectory(url, base::Bind(
-      &RemoveOperationDelegate::RemoveNextDirectory,
-      weak_factory_.GetWeakPtr()));
-}
-
 }  // namespace fileapi