Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: printing/backend/print_backend_chromeos.cc

Issue 1934013002: Enable the cups backend when --enable-native-cups is specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cupsFlag
Patch Set: Cleaned Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/command_line.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h"
10 #include "chrome/common/chrome_switches.h"
11 #include "printing/backend/cups_helper.h"
12 #include "printing/backend/print_backend_consts.h"
13 #include "printing/backend/print_backend_cups.h"
14 #include "url/gurl.h"
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
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 (base::CommandLine::ForCurrentProcess()->HasSwitch(
Lei Zhang 2016/06/28 19:09:47 Given that PrintBackend::CreateInstance() has many
skau 2016/06/28 21:40:15 Done.
83 switches::kEnableNativeCups)) {
84 #ifdef USE_CUPS
Lei Zhang 2016/06/28 19:09:47 nit: #if defined(USE_CUPS)
skau 2016/06/28 21:40:15 Done.
85 std::string print_server_url_str, cups_blocking;
Lei Zhang 2016/06/28 19:09:47 nit: one decl per line
skau 2016/06/28 21:40:15 Done.
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 // USE_CUPS
100 }
101
75 return new PrintBackendChromeOS(); 102 return new PrintBackendChromeOS();
76 } 103 }
77 104
78 } // namespace printing 105 } // namespace printing
79
OLDNEW
« printing/DEPS ('K') | « printing/DEPS ('k') | printing/backend/print_backend_cups.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698