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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 601573002: Add UMA stats for new Print Preview UI elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add INVITATION_AVAILABLE UMA stat. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/print_preview/settings/more_settings.js ('k') | printing/print_job_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f757b592899af606c3e8f4e9cfbc8139084338c0..ed2c3d5745ba048c03fe6390a506a771858a2f09 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -121,6 +121,11 @@ enum PrintSettingsBuckets {
CSS_BACKGROUND,
SELECTION_ONLY,
EXTERNAL_PDF_PREVIEW,
+ PAGE_RANGE,
+ DEFAULT_MEDIA,
+ NON_DEFAULT_MEDIA,
+ COPIES,
+ NON_DEFAULT_MARGINS,
PRINT_SETTINGS_BUCKET_BOUNDARY
};
@@ -196,10 +201,33 @@ base::DictionaryValue* GetSettingsDictionary(const base::ListValue* args) {
void ReportPrintSettingsStats(const base::DictionaryValue& settings) {
ReportPrintSettingHistogram(TOTAL);
+ const base::ListValue* page_range_array = NULL;
+ if (settings.GetList(printing::kSettingPageRange, &page_range_array) &&
+ !page_range_array->empty()) {
+ ReportPrintSettingHistogram(PAGE_RANGE);
+ }
+
+ const base::DictionaryValue* media_size_value = NULL;
+ if (settings.GetDictionary(printing::kSettingMediaSize, &media_size_value) &&
+ !media_size_value->empty()) {
+ bool is_default = false;
+ if (media_size_value->GetBoolean(printing::kSettingMediaSizeIsDefault,
+ &is_default) &&
+ is_default) {
+ ReportPrintSettingHistogram(DEFAULT_MEDIA);
+ } else {
+ ReportPrintSettingHistogram(NON_DEFAULT_MEDIA);
+ }
+ }
+
bool landscape = false;
if (settings.GetBoolean(printing::kSettingLandscape, &landscape))
ReportPrintSettingHistogram(landscape ? LANDSCAPE : PORTRAIT);
+ int copies = 1;
+ if (settings.GetInteger(printing::kSettingCopies, &copies) && copies > 1)
+ ReportPrintSettingHistogram(COPIES);
+
bool collate = false;
if (settings.GetBoolean(printing::kSettingCollate, &collate) && collate)
ReportPrintSettingHistogram(COLLATE);
@@ -214,6 +242,12 @@ void ReportPrintSettingsStats(const base::DictionaryValue& settings) {
printing::IsColorModelSelected(color_mode) ? COLOR : BLACK_AND_WHITE);
}
+ int margins_type = 0;
+ if (settings.GetInteger(printing::kSettingMarginsType, &margins_type) &&
+ margins_type != 0) {
+ ReportPrintSettingHistogram(NON_DEFAULT_MARGINS);
+ }
+
bool headers = false;
if (settings.GetBoolean(printing::kSettingHeaderFooterEnabled, &headers) &&
headers) {
@@ -758,6 +792,8 @@ void PrintPreviewHandler::HandlePrint(const base::ListValue* args) {
if (!settings.get())
return;
+ ReportPrintSettingsStats(*settings);
+
// Never try to add headers/footers here. It's already in the generated PDF.
settings->SetBoolean(printing::kSettingHeaderFooterEnabled, false);
@@ -836,7 +872,6 @@ void PrintPreviewHandler::HandlePrint(const base::ListValue* args) {
UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPrinter", page_count);
ReportUserActionHistogram(PRINT_TO_PRINTER);
}
- ReportPrintSettingsStats(*settings);
// This tries to activate the initiator as well, so do not clear the
// association with the initiator yet.
« no previous file with comments | « chrome/browser/resources/print_preview/settings/more_settings.js ('k') | printing/print_job_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698