Index: chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc |
diff --git a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc |
index 0a07cfacdb7c40c997af2f8f262a9bfcc2e7ef08..3e3198472a496f5f435ef2522dd3f3593c219cb9 100644 |
--- a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc |
+++ b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc |
@@ -11,6 +11,7 @@ |
#include "base/files/file_util.h" |
#include "base/json/json_string_value_serializer.h" |
#include "base/memory/ptr_util.h" |
+#include "base/metrics/histogram_macros.h" |
#include "base/path_service.h" |
#include "base/strings/string_util.h" |
#include "base/threading/sequenced_task_runner_handle.h" |
@@ -44,6 +45,14 @@ namespace settings { |
namespace { |
+// These values are written to logs. New enum values can be added, but existing |
+// enums must never be renumbered or deleted and reused. |
+enum PpdSourceForHistogram { kUser = 0, kScs = 1, kPpdSourceMax }; |
+ |
+void RecordPpdSource(const PpdSourceForHistogram& source) { |
+ UMA_HISTOGRAM_ENUMERATION("Printing.CUPS.PpdSource", kUser, kPpdSourceMax); |
Mark P
2017/05/26 22:57:29
Shouldn't this be source, not kUser?
skau
2017/05/26 23:31:51
Done.
|
+} |
+ |
void OnRemovedPrinter(bool success) {} |
std::unique_ptr<base::DictionaryValue> GetPrinterInfo(const Printer& printer) { |
@@ -225,6 +234,7 @@ void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) { |
// Verify a valid ppd path is present. |
if (!printer_ppd_path.empty()) { |
+ RecordPpdSource(kUser); |
GURL tmp = net::FilePathToFileURL(base::FilePath(printer_ppd_path)); |
if (!tmp.is_valid()) { |
LOG(ERROR) << "Invalid ppd path: " << printer_ppd_path; |
@@ -233,6 +243,7 @@ void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) { |
} |
printer->mutable_ppd_reference()->user_supplied_ppd_url = tmp.spec(); |
} else if (!printer_manufacturer.empty() && !printer_model.empty()) { |
+ RecordPpdSource(kScs); |
// Using the manufacturer and model, get a ppd reference. |
if (!ppd_provider_->GetPpdReference(printer_manufacturer, printer_model, |
printer->mutable_ppd_reference())) { |
@@ -255,6 +266,8 @@ void CupsPrintersHandler::OnAddedPrinter( |
std::unique_ptr<Printer> printer, |
chromeos::PrinterSetupResult result_code) { |
std::string printer_name = printer->display_name(); |
+ UMA_HISTOGRAM_ENUMERATION("Printing.CUPS.PrinterSetupResult", result_code, |
+ chromeos::PrinterSetupResult::kMaxValue); |
switch (result_code) { |
case chromeos::PrinterSetupResult::kSuccess: { |
auto* manager = PrintersManagerFactory::GetForBrowserContext(profile_); |