Chromium Code Reviews| 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 "printing/backend/print_backend.h" | 5 #include "printing/backend/print_backend.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | |
| 9 #include "printing/backend/print_backend_consts.h" | |
| 10 #if defined(USE_CUPS) | |
|
Lei Zhang
2016/06/28 22:27:35
#includes inside an #if goes in their own section
skau
2016/06/28 23:58:19
Done.
| |
| 11 #include "printing/backend/print_backend_cups.h" | |
| 12 #endif // defined(USE_CUPS) | |
| 13 #include "url/gurl.h" | |
| 8 | 14 |
| 9 namespace printing { | 15 namespace printing { |
| 10 | 16 |
| 11 // Provides a stubbed out PrintBackend implementation for use on ChromeOS. | 17 // Provides a stubbed out PrintBackend implementation for use on ChromeOS. |
| 12 class PrintBackendChromeOS : public PrintBackend { | 18 class PrintBackendChromeOS : public PrintBackend { |
| 13 public: | 19 public: |
| 14 PrintBackendChromeOS(); | 20 PrintBackendChromeOS(); |
| 15 | 21 |
| 16 // PrintBackend implementation. | 22 // PrintBackend implementation. |
| 17 bool EnumeratePrinters(PrinterList* printer_list) override; | 23 bool EnumeratePrinters(PrinterList* printer_list) override; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 return std::string(); | 71 return std::string(); |
| 66 } | 72 } |
| 67 | 73 |
| 68 bool PrintBackendChromeOS::IsValidPrinter(const std::string& printer_name) { | 74 bool PrintBackendChromeOS::IsValidPrinter(const std::string& printer_name) { |
| 69 NOTREACHED(); | 75 NOTREACHED(); |
| 70 return true; | 76 return true; |
| 71 } | 77 } |
| 72 | 78 |
| 73 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( | 79 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( |
| 74 const base::DictionaryValue* print_backend_settings) { | 80 const base::DictionaryValue* print_backend_settings) { |
| 81 if (PrintBackend::native_cups_enabled) { | |
| 82 #if defined(USE_CUPS) | |
| 83 std::string print_server_url_str; | |
| 84 std::string cups_blocking; | |
| 85 int encryption = HTTP_ENCRYPT_NEVER; | |
| 86 if (print_backend_settings) { | |
| 87 print_backend_settings->GetString(kCUPSPrintServerURL, | |
| 88 &print_server_url_str); | |
| 89 | |
| 90 print_backend_settings->GetString(kCUPSBlocking, &cups_blocking); | |
| 91 | |
| 92 print_backend_settings->GetInteger(kCUPSEncryption, &encryption); | |
| 93 } | |
| 94 GURL print_server_url(print_server_url_str.c_str()); | |
| 95 return new PrintBackendCUPS(print_server_url, | |
| 96 static_cast<http_encryption_t>(encryption), | |
| 97 cups_blocking == kValueTrue); | |
| 98 #endif // defined(USE_CUPS) | |
| 99 } | |
| 100 | |
| 75 return new PrintBackendChromeOS(); | 101 return new PrintBackendChromeOS(); |
| 76 } | 102 } |
| 77 | 103 |
| 78 } // namespace printing | 104 } // namespace printing |
| 79 | |
| OLD | NEW |