OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/ui/webui/print_preview/printer_backend_proxy.h" | 5 #include "chrome/browser/ui/webui/print_preview/printer_backend_proxy.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 base::Bind(cb, "")); | 127 base::Bind(cb, "")); |
128 }; | 128 }; |
129 | 129 |
130 void EnumeratePrinters(const EnumeratePrintersCallback& cb) override { | 130 void EnumeratePrinters(const EnumeratePrintersCallback& cb) override { |
131 // PrintersManager is not thread safe and must be called from the UI | 131 // PrintersManager is not thread safe and must be called from the UI |
132 // thread. | 132 // thread. |
133 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 133 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
134 | 134 |
135 PrinterList printer_list; | 135 PrinterList printer_list; |
136 | 136 |
137 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 137 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
138 switches::kEnableNativeCups)) { | 138 switches::kDisableNativeCups)) { |
139 AddPrintersToList(prefs_->GetPrinters(), &printer_list); | 139 AddPrintersToList(prefs_->GetPrinters(), &printer_list); |
140 AddPrintersToList(prefs_->GetRecommendedPrinters(), &printer_list); | 140 AddPrintersToList(prefs_->GetRecommendedPrinters(), &printer_list); |
141 } | 141 } |
142 | 142 |
143 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 143 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
144 base::Bind(cb, printer_list)); | 144 base::Bind(cb, printer_list)); |
145 }; | 145 }; |
146 | 146 |
147 void ConfigurePrinterAndFetchCapabilities( | 147 void ConfigurePrinterAndFetchCapabilities( |
148 const std::string& printer_name, | 148 const std::string& printer_name, |
(...skipping 24 matching lines...) Expand all Loading... |
173 }; | 173 }; |
174 | 174 |
175 } // namespace | 175 } // namespace |
176 | 176 |
177 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( | 177 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( |
178 Profile* profile) { | 178 Profile* profile) { |
179 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); | 179 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); |
180 } | 180 } |
181 | 181 |
182 } // namespace printing | 182 } // namespace printing |
OLD | NEW |