Chromium Code Reviews| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/metrics/histogram_macros.h" | |
| 14 #include "base/task_scheduler/post_task.h" | 15 #include "base/task_scheduler/post_task.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/printing/cups_print_job_manager.h" | 17 #include "chrome/browser/chromeos/printing/cups_print_job_manager.h" |
| 17 #include "chrome/browser/chromeos/printing/cups_print_job_manager_factory.h" | 18 #include "chrome/browser/chromeos/printing/cups_print_job_manager_factory.h" |
| 18 #include "chrome/browser/chromeos/printing/ppd_provider_factory.h" | 19 #include "chrome/browser/chromeos/printing/ppd_provider_factory.h" |
| 19 #include "chrome/browser/chromeos/printing/printer_configurer.h" | 20 #include "chrome/browser/chromeos/printing/printer_configurer.h" |
| 20 #include "chrome/browser/chromeos/printing/printers_manager.h" | 21 #include "chrome/browser/chromeos/printing/printers_manager.h" |
| 21 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" | 22 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/webui/print_preview/printer_capabilities.h" | 24 #include "chrome/browser/ui/webui/print_preview/printer_capabilities.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 117 |
| 117 std::unique_ptr<chromeos::Printer> printer = | 118 std::unique_ptr<chromeos::Printer> printer = |
| 118 prefs_->GetPrinter(printer_name); | 119 prefs_->GetPrinter(printer_name); |
| 119 if (!printer) { | 120 if (!printer) { |
| 120 // If the printer was removed, the lookup will fail. | 121 // If the printer was removed, the lookup will fail. |
| 121 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 122 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 122 base::Bind(cb, nullptr)); | 123 base::Bind(cb, nullptr)); |
| 123 return; | 124 return; |
| 124 } | 125 } |
| 125 | 126 |
| 127 // Log printer configuration for selected printer. | |
| 128 UMA_HISTOGRAM_ENUMERATION("CUPS.ProtocolUsed", printer->GetProtocol(), | |
| 129 chromeos::Printer::PROTOCOL_MAX); | |
|
Carlson
2017/05/25 16:24:35
Should we be leaving space in the enum for possibl
skau
2017/05/25 18:49:55
No. The max value is just to help in constructing
| |
| 130 | |
| 126 if (prefs_->IsConfigurationCurrent(*printer)) { | 131 if (prefs_->IsConfigurationCurrent(*printer)) { |
| 127 // Skip setup if the printer is already installed. | 132 // Skip setup if the printer is already installed. |
| 128 HandlePrinterSetup(std::move(printer), cb, chromeos::SUCCESS); | 133 HandlePrinterSetup(std::move(printer), cb, chromeos::SUCCESS); |
| 129 return; | 134 return; |
| 130 } | 135 } |
| 131 | 136 |
| 132 const chromeos::Printer& printer_ref = *printer; | 137 const chromeos::Printer& printer_ref = *printer; |
| 133 printer_configurer_->SetUpPrinter( | 138 printer_configurer_->SetUpPrinter( |
| 134 printer_ref, | 139 printer_ref, |
| 135 base::Bind(&PrinterBackendProxyChromeos::HandlePrinterSetup, | 140 base::Bind(&PrinterBackendProxyChromeos::HandlePrinterSetup, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 }; | 188 }; |
| 184 | 189 |
| 185 } // namespace | 190 } // namespace |
| 186 | 191 |
| 187 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( | 192 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( |
| 188 Profile* profile) { | 193 Profile* profile) { |
| 189 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); | 194 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); |
| 190 } | 195 } |
| 191 | 196 |
| 192 } // namespace printing | 197 } // namespace printing |
| OLD | NEW |