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

Switch to 1-parameter version of base::DeleteFile() in {printing/, ui/}.

The 1-parameter version is simpler, and the 2-parameter version is
deprecated.

Bug: 1009837
Change-Id: If36164e2de06f7590e3c619b1d4a78bc55b3a366
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2284369
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786508}
parent 438f0541
...@@ -528,7 +528,7 @@ bool ParsePpdCapabilities(cups_dest_t* dest, ...@@ -528,7 +528,7 @@ bool ParsePpdCapabilities(cups_dest_t* dest,
return false; return false;
if (!base::WriteFile(ppd_file_path, printer_capabilities)) { if (!base::WriteFile(ppd_file_path, printer_capabilities)) {
base::DeleteFile(ppd_file_path, false); base::DeleteFile(ppd_file_path);
return false; return false;
} }
...@@ -617,7 +617,7 @@ bool ParsePpdCapabilities(cups_dest_t* dest, ...@@ -617,7 +617,7 @@ bool ParsePpdCapabilities(cups_dest_t* dest,
} }
ppdClose(ppd); ppdClose(ppd);
base::DeleteFile(ppd_file_path, false); base::DeleteFile(ppd_file_path);
*printer_info = caps; *printer_info = caps;
return true; return true;
......
...@@ -186,7 +186,7 @@ bool PrintBackendCUPS::GetPrinterCapsAndDefaults( ...@@ -186,7 +186,7 @@ bool PrintBackendCUPS::GetPrinterCapsAndDefaults(
std::string content; std::string content;
bool res = base::ReadFileToString(ppd_path, &content); bool res = base::ReadFileToString(ppd_path, &content);
base::DeleteFile(ppd_path, false); base::DeleteFile(ppd_path);
if (res) { if (res) {
printer_info->printer_capabilities.swap(content); printer_info->printer_capabilities.swap(content);
...@@ -298,7 +298,7 @@ base::FilePath PrintBackendCUPS::GetPPD(const char* name) { ...@@ -298,7 +298,7 @@ base::FilePath PrintBackendCUPS::GetPPD(const char* name) {
LOG(ERROR) << "Error downloading PPD file, name: " << name LOG(ERROR) << "Error downloading PPD file, name: " << name
<< ", CUPS error: " << static_cast<int>(error_code) << ", CUPS error: " << static_cast<int>(error_code)
<< ", HTTP error: " << http_error; << ", HTTP error: " << http_error;
base::DeleteFile(ppd_path, false); base::DeleteFile(ppd_path);
ppd_path.clear(); ppd_path.clear();
} }
} }
......
...@@ -211,7 +211,7 @@ base::FilePath WriteFileContentsToTempFile(const base::FilePath& suggested_name, ...@@ -211,7 +211,7 @@ base::FilePath WriteFileContentsToTempFile(const base::FilePath& suggested_name,
// Don't write to the temp file for empty content--leave it at 0-bytes. // Don't write to the temp file for empty content--leave it at 0-bytes.
if (!(data.Size() == 1 && data.get()[0] == '\0')) { if (!(data.Size() == 1 && data.get()[0] == '\0')) {
if (base::WriteFile(temp_path, data.get(), data.Size()) < 0) { if (base::WriteFile(temp_path, data.get(), data.Size()) < 0) {
base::DeleteFile(temp_path, false); base::DeleteFile(temp_path);
return base::FilePath(); return base::FilePath();
} }
} }
......
...@@ -526,7 +526,7 @@ bool IconUtil::CreateIconFileFromImageFamily( ...@@ -526,7 +526,7 @@ bool IconUtil::CreateIconFileFromImageFamily(
if (write_type == NORMAL_WRITE) { if (write_type == NORMAL_WRITE) {
if (base::WriteFile(icon_path, buffer)) if (base::WriteFile(icon_path, buffer))
return true; return true;
bool delete_success = base::DeleteFile(icon_path, false); bool delete_success = base::DeleteFile(icon_path);
DCHECK(delete_success); DCHECK(delete_success);
return false; return false;
} }
......
...@@ -389,7 +389,7 @@ void PrintDialogGtk::PrintDocument(const printing::MetafilePlayer& metafile, ...@@ -389,7 +389,7 @@ void PrintDialogGtk::PrintDocument(const printing::MetafilePlayer& metafile,
success = metafile.SaveTo(&file); success = metafile.SaveTo(&file);
file.Close(); file.Close();
if (!success) if (!success)
base::DeleteFile(path_to_pdf_, false); base::DeleteFile(path_to_pdf_);
} }
if (!success) { if (!success) {
......
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