Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
index 7a9693961a36b6508b956476611925a04a84758a..70b0a7b2af7cfce13c1bfc13b4f433efcc1db963 100644 |
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
@@ -107,6 +107,8 @@ using printing::PrintViewManager; |
namespace { |
+// This enum is used to back an UMA histogram, and should therefore be treated |
+// as append only. |
enum UserActionBuckets { |
PRINT_TO_PRINTER, |
PRINT_TO_PDF, |
@@ -122,6 +124,8 @@ enum UserActionBuckets { |
USERACTION_BUCKET_BOUNDARY |
}; |
+// This enum is used to back an UMA histogram, and should therefore be treated |
+// as append only. |
enum PrintSettingsBuckets { |
LANDSCAPE = 0, |
PORTRAIT, |
@@ -145,6 +149,14 @@ enum PrintSettingsBuckets { |
PRINT_SETTINGS_BUCKET_BOUNDARY |
}; |
+// This enum is used to back an UMA histogram, and should therefore be treated |
+// as append only. |
+enum PrintDocumentTypeBuckets { |
+ HTML_DOCUMENT = 0, |
Lei Zhang
2017/02/25 01:04:01
Maybe we should see how often users print images t
|
+ PDF_DOCUMENT, |
+ PRINT_DOCUMENT_TYPE_BUCKET_BOUNDARY |
+}; |
+ |
void ReportUserActionHistogram(enum UserActionBuckets event) { |
UMA_HISTOGRAM_ENUMERATION("PrintPreview.UserAction", event, |
USERACTION_BUCKET_BOUNDARY); |
@@ -155,6 +167,11 @@ void ReportPrintSettingHistogram(enum PrintSettingsBuckets setting) { |
PRINT_SETTINGS_BUCKET_BOUNDARY); |
} |
+void ReportPrintDocumentTypeHistogram(enum PrintDocumentTypeBuckets doctype) { |
+ UMA_HISTOGRAM_ENUMERATION("PrintPreview.PrintDocumentType", doctype, |
+ PRINT_DOCUMENT_TYPE_BUCKET_BOUNDARY); |
+} |
+ |
// Name of a dictionary field holding cloud print related data; |
const char kAppState[] = "appState"; |
// Name of a dictionary field holding the initiator title. |
@@ -804,6 +821,10 @@ void PrintPreviewHandler::HandlePrint(const base::ListValue* args) { |
ReportPrintSettingsStats(*settings); |
+ // Report whether the user printed a PDF or an HTML document. |
+ ReportPrintDocumentTypeHistogram(print_preview_ui()->source_is_modifiable() ? |
+ HTML_DOCUMENT : PDF_DOCUMENT); |
+ |
// Never try to add headers/footers here. It's already in the generated PDF. |
settings->SetBoolean(printing::kSettingHeaderFooterEnabled, false); |