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 #include "url/gurl.h" | |
11 | |
12 #if defined(USE_CUPS) | |
13 #include "printing/backend/print_backend_cups.h" | |
14 #endif // defined(USE_CUPS) | |
8 | 15 |
9 namespace printing { | 16 namespace printing { |
10 | 17 |
11 // Provides a stubbed out PrintBackend implementation for use on ChromeOS. | 18 // Provides a stubbed out PrintBackend implementation for use on ChromeOS. |
12 class PrintBackendChromeOS : public PrintBackend { | 19 class PrintBackendChromeOS : public PrintBackend { |
13 public: | 20 public: |
14 PrintBackendChromeOS(); | 21 PrintBackendChromeOS(); |
15 | 22 |
16 // PrintBackend implementation. | 23 // PrintBackend implementation. |
17 bool EnumeratePrinters(PrinterList* printer_list) override; | 24 bool EnumeratePrinters(PrinterList* printer_list) override; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 return std::string(); | 72 return std::string(); |
66 } | 73 } |
67 | 74 |
68 bool PrintBackendChromeOS::IsValidPrinter(const std::string& printer_name) { | 75 bool PrintBackendChromeOS::IsValidPrinter(const std::string& printer_name) { |
69 NOTREACHED(); | 76 NOTREACHED(); |
70 return true; | 77 return true; |
71 } | 78 } |
72 | 79 |
73 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( | 80 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( |
74 const base::DictionaryValue* print_backend_settings) { | 81 const base::DictionaryValue* print_backend_settings) { |
82 if (PrintBackend::GetNativeCupsEnabled()) { | |
Lei Zhang
2016/06/29 00:22:31
Does it work if you omit PrintBackend:: ?
skau
2016/06/29 00:40:17
It does!
| |
83 #if defined(USE_CUPS) | |
84 std::string print_server_url_str; | |
85 std::string cups_blocking; | |
86 int encryption = HTTP_ENCRYPT_NEVER; | |
87 if (print_backend_settings) { | |
88 print_backend_settings->GetString(kCUPSPrintServerURL, | |
89 &print_server_url_str); | |
90 | |
91 print_backend_settings->GetString(kCUPSBlocking, &cups_blocking); | |
92 | |
93 print_backend_settings->GetInteger(kCUPSEncryption, &encryption); | |
94 } | |
95 GURL print_server_url(print_server_url_str.c_str()); | |
96 return new PrintBackendCUPS(print_server_url, | |
97 static_cast<http_encryption_t>(encryption), | |
98 cups_blocking == kValueTrue); | |
99 #endif // defined(USE_CUPS) | |
100 } | |
101 | |
75 return new PrintBackendChromeOS(); | 102 return new PrintBackendChromeOS(); |
76 } | 103 } |
77 | 104 |
78 } // namespace printing | 105 } // namespace printing |
79 | |
OLD | NEW |