| 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"
|
|
|