Chromium Code Reviews| Index: chrome/service/cloud_print/print_system_cups.cc |
| =================================================================== |
| --- chrome/service/cloud_print/print_system_cups.cc (revision 137176) |
| +++ chrome/service/cloud_print/print_system_cups.cc (working copy) |
| @@ -133,9 +133,11 @@ |
| // <functions>2() are called when print server is specified, and plain |
| // version in another case. There is an issue specifing CUPS_HTTP_DEFAULT |
| // in the <functions>2(), it does not work in CUPS prior to 1.4. |
| - int GetJobs(cups_job_t** jobs, const GURL& url, const char* name, |
| + int GetJobs(cups_job_t** jobs, const GURL& url, |
| + http_encryption_t encryption, const char* name, |
| int myjobs, int whichjobs); |
| - int PrintFile(const GURL& url, const char* name, const char* filename, |
| + int PrintFile(const GURL& url, http_encryption_t encryption, |
| + const char* name, const char* filename, |
| const char* title, int num_options, cups_option_t* options); |
|
Ryan Sleevi
2012/05/17 00:35:27
nit: these too
|
| void InitPrintBackends(const DictionaryValue* print_system_settings); |
| @@ -166,6 +168,7 @@ |
| bool initialized_; |
| bool printer_enum_succeeded_; |
| bool notify_delete_; |
| + http_encryption_t cups_encryption_; |
| }; |
| class PrintServerWatcherCUPS |
| @@ -406,12 +409,18 @@ |
| kCheckForPrinterUpdatesMinutes)), |
| initialized_(false), |
| printer_enum_succeeded_(false), |
| - notify_delete_(true) { |
| + notify_delete_(true), |
| + cups_encryption_(HTTP_ENCRYPT_NEVER) { |
| if (print_system_settings) { |
| int timeout; |
| if (print_system_settings->GetInteger(kCUPSUpdateTimeoutMs, &timeout)) |
| update_timeout_ = base::TimeDelta::FromMilliseconds(timeout); |
| + int encryption; |
| + if (print_system_settings->GetInteger(kCUPSEncryption, &encryption)) |
| + cups_encryption_ = |
| + static_cast<http_encryption_t>(encryption); |
| + |
| bool notify_delete = true; |
| if (print_system_settings->GetBoolean(kCUPSNotifyDelete, ¬ify_delete)) |
| notify_delete_ = notify_delete; |
| @@ -448,6 +457,9 @@ |
| // Make CUPS requests non-blocking. |
| backend_settings.SetString(kCUPSBlocking, kValueFalse); |
| + // Set encryption for backend. |
| + backend_settings.SetInteger(kCUPSEncryption, cups_encryption_); |
| + |
| PrintServerInfoCUPS print_server; |
| print_server.backend = |
| printing::PrintBackend::CreateInstance(&backend_settings); |
| @@ -590,7 +602,7 @@ |
| child_process_logging::ScopedPrinterInfoSetter prn_info( |
| server_info->backend->GetPrinterDriverInfo(short_printer_name)); |
| cups_job_t* jobs = NULL; |
| - int num_jobs = GetJobs(&jobs, server_info->url, |
| + int num_jobs = GetJobs(&jobs, server_info->url, cups_encryption_, |
| short_printer_name.c_str(), 1, -1); |
| bool error = (num_jobs == 0) && (cupsLastError() > IPP_OK_EVENTS_COMPLETE); |
| if (error) { |
| @@ -713,13 +725,14 @@ |
| return new PrintSystemCUPS(print_system_settings); |
| } |
| -int PrintSystemCUPS::PrintFile(const GURL& url, const char* name, |
| - const char* filename, const char* title, |
| - int num_options, cups_option_t* options) { |
| +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. |
| return cupsPrintFile(name, filename, title, num_options, options); |
| } else { |
| - printing::HttpConnectionCUPS http(url); |
| + printing::HttpConnectionCUPS http(url, encryption); |
| http.SetBlocking(false); |
| return cupsPrintFile2(http.http(), name, filename, |
| title, num_options, options); |
| @@ -727,11 +740,12 @@ |
| } |
| 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. |
| return cupsGetJobs(jobs, name, myjobs, whichjobs); |
| } else { |
| - printing::HttpConnectionCUPS http(url); |
| + printing::HttpConnectionCUPS http(url, encryption); |
| http.SetBlocking(false); |
| return cupsGetJobs2(http.http(), jobs, name, myjobs, whichjobs); |
| } |
| @@ -782,6 +796,7 @@ |
| } |
| 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(), |