update_engine: use new base::Delete{File,PathRecursively}

base::DeleteFile(const FilePath& path, bool recursive) would be
deprecated in next libchrome uprev.

BUG=chromium:1144735
TEST=cros_run_unit_tests --board=eve --packages update_engine

Change-Id: Iaeac97f533a156c2c29f7ba53755664d6591b0a1
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2543515
Tested-by: Grace Cham <hscham@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Grace Cham <hscham@chromium.org>
diff --git a/common/prefs.cc b/common/prefs.cc
index 52a58b7..84fe536 100644
--- a/common/prefs.cc
+++ b/common/prefs.cc
@@ -41,7 +41,11 @@
        dir_path = path_enum.Next()) {
     DeleteEmptyDirectories(dir_path);
     if (base::IsDirectoryEmpty(dir_path))
+#if BASE_VER < 800000
       base::DeleteFile(dir_path, false);
+#else
+      base::DeleteFile(dir_path);
+#endif
   }
 }
 
@@ -210,7 +214,11 @@
 bool Prefs::FileStorage::DeleteKey(const string& key) {
   base::FilePath filename;
   TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename));
+#if BASE_VER < 800000
   TEST_AND_RETURN_FALSE(base::DeleteFile(filename, false));
+#else
+  TEST_AND_RETURN_FALSE(base::DeleteFile(filename));
+#endif
   return true;
 }
 
diff --git a/cros/hardware_chromeos.cc b/cros/hardware_chromeos.cc
index b9018ff..14f2497 100644
--- a/cros/hardware_chromeos.cc
+++ b/cros/hardware_chromeos.cc
@@ -253,7 +253,7 @@
 }
 
 bool HardwareChromeOS::CancelPowerwash() {
-  bool result = base::DeleteFile(base::FilePath(kPowerwashMarkerFile), false);
+  bool result = base::DeleteFile(base::FilePath(kPowerwashMarkerFile));
 
   if (result) {
     LOG(INFO) << "Successfully deleted the powerwash marker file : "
@@ -264,7 +264,7 @@
   }
 
   // Delete the rollback save marker file if it existed.
-  if (!base::DeleteFile(base::FilePath(kRollbackSaveMarkerFile), false)) {
+  if (!base::DeleteFile(base::FilePath(kRollbackSaveMarkerFile))) {
     PLOG(ERROR) << "Could not remove rollback save marker";
   }
 
diff --git a/cros/logging.cc b/cros/logging.cc
index e09166c..8b6c556 100644
--- a/cros/logging.cc
+++ b/cros/logging.cc
@@ -46,7 +46,7 @@
     base::ReplaceFile(
         base::FilePath(symlink_path), base::FilePath(log_path), nullptr);
   }
-  base::DeleteFile(base::FilePath(symlink_path), true);
+  base::DeletePathRecursively(base::FilePath(symlink_path));
   if (symlink(log_path.c_str(), symlink_path.c_str()) == -1) {
     PLOG(ERROR) << "Unable to create symlink " << symlink_path
                 << " pointing at " << log_path;
diff --git a/payload_consumer/delta_performer_integration_test.cc b/payload_consumer/delta_performer_integration_test.cc
index 374131e..e7ccff5 100644
--- a/payload_consumer/delta_performer_integration_test.cc
+++ b/payload_consumer/delta_performer_integration_test.cc
@@ -464,7 +464,11 @@
 
     EXPECT_TRUE(base::CopyFile(mnt_path.Append("regular-small"),
                                mnt_path.Append("regular-small2")));
+#if BASE_VER < 800000
     EXPECT_TRUE(base::DeleteFile(mnt_path.Append("regular-small"), false));
+#else
+    EXPECT_TRUE(base::DeleteFile(mnt_path.Append("regular-small")));
+#endif
     EXPECT_TRUE(base::Move(mnt_path.Append("regular-small2"),
                            mnt_path.Append("regular-small")));
     EXPECT_TRUE(
@@ -491,7 +495,11 @@
     EXPECT_TRUE(base::Move(mnt_path.Append("tmp"),
                            mnt_path.Append("link-hard-regular-16k")));
 
+#if BASE_VER < 800000
     EXPECT_TRUE(base::DeleteFile(mnt_path.Append("link-short_symlink"), false));
+#else
+    EXPECT_TRUE(base::DeleteFile(mnt_path.Append("link-short_symlink")));
+#endif
     EXPECT_TRUE(test_utils::WriteFileString(
         mnt_path.Append("link-short_symlink").value(), "foobar"));
 
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index 91c3a64..72d1a22 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -284,7 +284,7 @@
 void PostinstallRunnerAction::Cleanup() {
   utils::UnmountFilesystem(fs_mount_dir_);
 #ifndef __ANDROID__
-  if (!base::DeleteFile(base::FilePath(fs_mount_dir_), false)) {
+  if (!base::DeleteFile(base::FilePath(fs_mount_dir_))) {
     PLOG(WARNING) << "Not removing temporary mountpoint " << fs_mount_dir_;
   }
 #endif  // !__ANDROID__