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

Side by Side Diff: chrome/browser/ui/webui/print_preview/printer_backend_proxy_chromeos.cc

Issue 2903113002: Track printer protocol usage for CUPS printers. (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « no previous file | chromeos/printing/printer_configuration.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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("Printing.CUPS.ProtocolUsed",
129 printer->GetProtocol(),
130 chromeos::Printer::kProtocolMax);
131
126 if (prefs_->IsConfigurationCurrent(*printer)) { 132 if (prefs_->IsConfigurationCurrent(*printer)) {
127 // Skip setup if the printer is already installed. 133 // Skip setup if the printer is already installed.
128 HandlePrinterSetup(std::move(printer), cb, chromeos::SUCCESS); 134 HandlePrinterSetup(std::move(printer), cb, chromeos::SUCCESS);
129 return; 135 return;
130 } 136 }
131 137
132 const chromeos::Printer& printer_ref = *printer; 138 const chromeos::Printer& printer_ref = *printer;
133 printer_configurer_->SetUpPrinter( 139 printer_configurer_->SetUpPrinter(
134 printer_ref, 140 printer_ref,
135 base::Bind(&PrinterBackendProxyChromeos::HandlePrinterSetup, 141 base::Bind(&PrinterBackendProxyChromeos::HandlePrinterSetup,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 }; 189 };
184 190
185 } // namespace 191 } // namespace
186 192
187 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( 193 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create(
188 Profile* profile) { 194 Profile* profile) {
189 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); 195 return base::MakeUnique<PrinterBackendProxyChromeos>(profile);
190 } 196 }
191 197
192 } // namespace printing 198 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chromeos/printing/printer_configuration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698