| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/service/cloud_print/print_system.h" | 5 #include "chrome/service/cloud_print/print_system.h" |
| 6 | 6 |
| 7 #include <cups/cups.h> | 7 #include <cups/cups.h> |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <pthread.h> | 10 #include <pthread.h> |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 return new PrintSystemCUPS(print_system_settings); | 615 return new PrintSystemCUPS(print_system_settings); |
| 616 } | 616 } |
| 617 | 617 |
| 618 int PrintSystemCUPS::PrintFile(const GURL& url, const char* name, | 618 int PrintSystemCUPS::PrintFile(const GURL& url, const char* name, |
| 619 const char* filename, const char* title, | 619 const char* filename, const char* title, |
| 620 int num_options, cups_option_t* options) { | 620 int num_options, cups_option_t* options) { |
| 621 if (url.is_empty()) { // Use default (local) print server. | 621 if (url.is_empty()) { // Use default (local) print server. |
| 622 return cupsPrintFile(name, filename, title, num_options, options); | 622 return cupsPrintFile(name, filename, title, num_options, options); |
| 623 } else { | 623 } else { |
| 624 printing::HttpConnectionCUPS http(url); | 624 printing::HttpConnectionCUPS http(url); |
| 625 http.SetBlocking(false); |
| 625 return cupsPrintFile2(http.http(), name, filename, | 626 return cupsPrintFile2(http.http(), name, filename, |
| 626 title, num_options, options); | 627 title, num_options, options); |
| 627 } | 628 } |
| 628 } | 629 } |
| 629 | 630 |
| 630 int PrintSystemCUPS::GetJobs(cups_job_t** jobs, const GURL& url, | 631 int PrintSystemCUPS::GetJobs(cups_job_t** jobs, const GURL& url, |
| 631 const char* name, int myjobs, int whichjobs) { | 632 const char* name, int myjobs, int whichjobs) { |
| 632 if (url.is_empty()) { // Use default (local) print server. | 633 if (url.is_empty()) { // Use default (local) print server. |
| 633 return cupsGetJobs(jobs, name, myjobs, whichjobs); | 634 return cupsGetJobs(jobs, name, myjobs, whichjobs); |
| 634 } else { | 635 } else { |
| 635 printing::HttpConnectionCUPS http(url); | 636 printing::HttpConnectionCUPS http(url); |
| 637 http.SetBlocking(false); |
| 636 return cupsGetJobs2(http.http(), jobs, name, myjobs, whichjobs); | 638 return cupsGetJobs2(http.http(), jobs, name, myjobs, whichjobs); |
| 637 } | 639 } |
| 638 } | 640 } |
| 639 | 641 |
| 640 PlatformJobId PrintSystemCUPS::SpoolPrintJob( | 642 PlatformJobId PrintSystemCUPS::SpoolPrintJob( |
| 641 const std::string& print_ticket, | 643 const std::string& print_ticket, |
| 642 const FilePath& print_data_file_path, | 644 const FilePath& print_data_file_path, |
| 643 const std::string& print_data_mime_type, | 645 const std::string& print_data_mime_type, |
| 644 const std::string& printer_name, | 646 const std::string& printer_name, |
| 645 const std::string& job_title, | 647 const std::string& job_title, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 *short_printer_name = full_printer_name.substr(separator + 1); | 728 *short_printer_name = full_printer_name.substr(separator + 1); |
| 727 return &(*it); | 729 return &(*it); |
| 728 } | 730 } |
| 729 } | 731 } |
| 730 | 732 |
| 731 LOG(WARNING) << "Server not found for printer: " << full_printer_name; | 733 LOG(WARNING) << "Server not found for printer: " << full_printer_name; |
| 732 return NULL; | 734 return NULL; |
| 733 } | 735 } |
| 734 | 736 |
| 735 } // namespace cloud_print | 737 } // namespace cloud_print |
| OLD | NEW |