Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4969)

Unified Diff: chrome/service/cloud_print/print_system_cups.cc

Issue 1920793005: Merge to M51: Cloud Print Proxy: Delete print jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/service/cloud_print/print_system_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/print_system_cups.cc
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc
index 5751fdcdfaba20b67a23cc662aa2e140d40e6353..4f101bcb83d6203cc2d4dcf574a4f32f5f819ad4 100644
--- a/chrome/service/cloud_print/print_system_cups.cc
+++ b/chrome/service/cloud_print/print_system_cups.cc
@@ -16,6 +16,7 @@
#include "base/bind.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/location.h"
#include "base/logging.h"
@@ -731,26 +732,26 @@ int PrintSystemCUPS::PrintFile(const GURL& url, http_encryption_t encryption,
const char* name, const char* filename,
const char* title, int num_options,
cups_option_t* options) {
- if (url.is_empty()) { // Use default (local) print server.
+ // Use default (local) print server.
+ if (url.is_empty())
return cupsPrintFile(name, filename, title, num_options, options);
- } else {
- printing::HttpConnectionCUPS http(url, encryption);
- http.SetBlocking(false);
- return cupsPrintFile2(http.http(), name, filename,
- title, num_options, options);
- }
+
+ printing::HttpConnectionCUPS http(url, encryption);
+ http.SetBlocking(false);
+ return cupsPrintFile2(http.http(), name, filename, title, num_options,
+ options);
}
int PrintSystemCUPS::GetJobs(cups_job_t** jobs, const GURL& url,
http_encryption_t encryption,
const char* name, int myjobs, int whichjobs) {
- if (url.is_empty()) { // Use default (local) print server.
+ // Use default (local) print server.
+ if (url.is_empty())
return cupsGetJobs(jobs, name, myjobs, whichjobs);
- } else {
- printing::HttpConnectionCUPS http(url, encryption);
- http.SetBlocking(false);
- return cupsGetJobs2(http.http(), jobs, name, myjobs, whichjobs);
- }
+
+ printing::HttpConnectionCUPS http(url, encryption);
+ http.SetBlocking(false);
+ return cupsGetJobs2(http.http(), jobs, name, myjobs, whichjobs);
}
PlatformJobId PrintSystemCUPS::SpoolPrintJob(
@@ -797,13 +798,11 @@ PlatformJobId PrintSystemCUPS::SpoolPrintJob(
cups_options.push_back(opt);
}
- int job_id = PrintFile(server_info->url,
- cups_encryption_,
- short_printer_name.c_str(),
- print_data_file_path.value().c_str(),
- job_title.c_str(),
- cups_options.size(),
- &(cups_options[0]));
+ int job_id =
+ PrintFile(server_info->url, cups_encryption_, short_printer_name.c_str(),
+ print_data_file_path.value().c_str(), job_title.c_str(),
+ cups_options.size(), cups_options.data());
+ base::DeleteFile(print_data_file_path, false);
// TODO(alexyu): Output printer id.
VLOG(1) << "CP_CUPS: Job spooled"
« no previous file with comments | « no previous file | chrome/service/cloud_print/print_system_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698