| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 676 } |
| 677 | 677 |
| 678 std::string PrintSystemCUPS::GetSupportedMimeTypes() { | 678 std::string PrintSystemCUPS::GetSupportedMimeTypes() { |
| 679 // Since we hand off the document to the CUPS server directly, list some types | 679 // Since we hand off the document to the CUPS server directly, list some types |
| 680 // that we know CUPS supports (http://www.cups.org/articles.php?L205+TFAQ+Q) | 680 // that we know CUPS supports (http://www.cups.org/articles.php?L205+TFAQ+Q) |
| 681 // TODO(sanjeevr): Determine this dynamically (http://crbug.com/73240). | 681 // TODO(sanjeevr): Determine this dynamically (http://crbug.com/73240). |
| 682 return | 682 return |
| 683 "application/pdf,application/postscript,image/jpeg,image/png,image/gif"; | 683 "application/pdf,application/postscript,image/jpeg,image/png,image/gif"; |
| 684 } | 684 } |
| 685 | 685 |
| 686 std::string PrintSystem::GenerateProxyId() { | |
| 687 // TODO(gene): This code should generate a unique id for proxy. ID should be | |
| 688 // unique for this user. Rand may return the same number. We'll need to change | |
| 689 // this in the future. | |
| 690 std::string id("CP_PROXY_"); | |
| 691 id += base::Uint64ToString(base::RandUint64()); | |
| 692 return id; | |
| 693 } | |
| 694 | |
| 695 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 686 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
| 696 const DictionaryValue* print_system_settings) { | 687 const DictionaryValue* print_system_settings) { |
| 697 return new PrintSystemCUPS(print_system_settings); | 688 return new PrintSystemCUPS(print_system_settings); |
| 698 } | 689 } |
| 699 | 690 |
| 700 int PrintSystemCUPS::PrintFile(const GURL& url, const char* name, | 691 int PrintSystemCUPS::PrintFile(const GURL& url, const char* name, |
| 701 const char* filename, const char* title, | 692 const char* filename, const char* title, |
| 702 int num_options, cups_option_t* options) { | 693 int num_options, cups_option_t* options) { |
| 703 if (url.is_empty()) { // Use default (local) print server. | 694 if (url.is_empty()) { // Use default (local) print server. |
| 704 return cupsPrintFile(name, filename, title, num_options, options); | 695 return cupsPrintFile(name, filename, title, num_options, options); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 809 |
| 819 void PrintSystemCUPS::RunCapsCallback( | 810 void PrintSystemCUPS::RunCapsCallback( |
| 820 const PrinterCapsAndDefaultsCallback& callback, | 811 const PrinterCapsAndDefaultsCallback& callback, |
| 821 bool succeeded, | 812 bool succeeded, |
| 822 const std::string& printer_name, | 813 const std::string& printer_name, |
| 823 const printing::PrinterCapsAndDefaults& printer_info) { | 814 const printing::PrinterCapsAndDefaults& printer_info) { |
| 824 callback.Run(succeeded, printer_name, printer_info); | 815 callback.Run(succeeded, printer_name, printer_info); |
| 825 } | 816 } |
| 826 | 817 |
| 827 } // namespace cloud_print | 818 } // namespace cloud_print |
| OLD | NEW |