Commit a2e94b75 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove extensions::file_util::DeleteFile().

Just use base::DeleteFile() and related functions directly. The issues
that forced the creation of extensions::file_util::DeleteFile() no
longer exist.

Bug: 1009837
Change-Id: If9cc24a8ad20ef6a647ce38e57f90ad180afaef6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2284353Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785998}
parent a9ee4a68
...@@ -1088,12 +1088,12 @@ void CrxInstaller::CleanupTempFiles() { ...@@ -1088,12 +1088,12 @@ void CrxInstaller::CleanupTempFiles() {
// Delete the temp directory and crx file as necessary. // Delete the temp directory and crx file as necessary.
if (!temp_dir_.value().empty()) { if (!temp_dir_.value().empty()) {
file_util::DeleteFile(temp_dir_, true); base::DeletePathRecursively(temp_dir_);
temp_dir_ = base::FilePath(); temp_dir_ = base::FilePath();
} }
if (delete_source_ && !source_file_.value().empty()) { if (delete_source_ && !source_file_.value().empty()) {
file_util::DeleteFile(source_file_, false); base::DeleteFile(source_file_);
source_file_ = base::FilePath(); source_file_ = base::FilePath();
} }
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/debug/alias.h" #include "base/debug/alias.h"
#include "base/debug/dump_without_crashing.h" #include "base/debug/dump_without_crashing.h"
#include "base/files/file_util.h"
#include "base/location.h" #include "base/location.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
...@@ -97,7 +98,6 @@ ...@@ -97,7 +98,6 @@
#include "extensions/common/extension_urls.h" #include "extensions/common/extension_urls.h"
#include "extensions/common/feature_switch.h" #include "extensions/common/feature_switch.h"
#include "extensions/common/features/feature_channel.h" #include "extensions/common/features/feature_channel.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/shared_module_info.h" #include "extensions/common/manifest_handlers/shared_module_info.h"
#include "extensions/common/manifest_url_handlers.h" #include "extensions/common/manifest_url_handlers.h"
...@@ -586,8 +586,9 @@ bool ExtensionService::UpdateExtension(const CRXFileInfo& file, ...@@ -586,8 +586,9 @@ bool ExtensionService::UpdateExtension(const CRXFileInfo& file,
if (file_ownership_passed && if (file_ownership_passed &&
!GetExtensionFileTaskRunner()->PostTask( !GetExtensionFileTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::BindOnce(&file_util::DeleteFile, file.path, false))) base::BindOnce(base::GetDeleteFileCallback(), file.path))) {
NOTREACHED(); NOTREACHED();
}
return false; return false;
} }
...@@ -1545,8 +1546,9 @@ void ExtensionService::OnExtensionInstalled( ...@@ -1545,8 +1546,9 @@ void ExtensionService::OnExtensionInstalled(
// Delete the extension directory since we're not going to // Delete the extension directory since we're not going to
// load it. // load it.
if (!GetExtensionFileTaskRunner()->PostTask( if (!GetExtensionFileTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&file_util::DeleteFile, FROM_HERE,
extension->path(), true))) { base::BindOnce(base::GetDeletePathRecursivelyCallback(),
extension->path()))) {
NOTREACHED(); NOTREACHED();
} }
return; return;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/rand_util.h" #include "base/rand_util.h"
...@@ -44,7 +45,6 @@ ...@@ -44,7 +45,6 @@
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/extension_set.h" #include "extensions/common/extension_set.h"
#include "extensions/common/extension_updater_uma.h" #include "extensions/common/extension_updater_uma.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest.h" #include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -597,7 +597,7 @@ void ExtensionUpdater::CleanUpCrxFileIfNeeded(const base::FilePath& crx_path, ...@@ -597,7 +597,7 @@ void ExtensionUpdater::CleanUpCrxFileIfNeeded(const base::FilePath& crx_path,
bool file_ownership_passed) { bool file_ownership_passed) {
if (file_ownership_passed && if (file_ownership_passed &&
!GetExtensionFileTaskRunner()->PostTask( !GetExtensionFileTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&file_util::DeleteFile, crx_path, false))) { FROM_HERE, base::BindOnce(base::GetDeleteFileCallback(), crx_path))) {
NOTREACHED(); NOTREACHED();
} }
} }
......
...@@ -442,10 +442,6 @@ base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir) { ...@@ -442,10 +442,6 @@ base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir) {
return temp_path; return temp_path;
} }
void DeleteFile(const base::FilePath& path, bool recursive) {
base::DeleteFile(path, recursive);
}
base::FilePath ExtensionURLToRelativeFilePath(const GURL& url) { base::FilePath ExtensionURLToRelativeFilePath(const GURL& url) {
base::StringPiece url_path = url.path_piece(); base::StringPiece url_path = url.path_piece();
if (url_path.empty() || url_path[0] != '/') if (url_path.empty() || url_path[0] != '/')
......
...@@ -119,11 +119,6 @@ bool CheckForWindowsReservedFilenames(const base::FilePath& extension_dir, ...@@ -119,11 +119,6 @@ bool CheckForWindowsReservedFilenames(const base::FilePath& extension_dir,
// an empty file path on failure. // an empty file path on failure.
base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir); base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir);
// Helper function to delete files. This is used to avoid ugly casts which
// would be necessary with PostMessage since base::Delete is overloaded.
// TODO(skerner): Make a version of Delete that is not overloaded in file_util.
void DeleteFile(const base::FilePath& path, bool recursive);
// Get a relative file path from a chrome-extension:// URL. // Get a relative file path from a chrome-extension:// URL.
base::FilePath ExtensionURLToRelativeFilePath(const GURL& url); base::FilePath ExtensionURLToRelativeFilePath(const GURL& url);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment