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

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

Issue 2597343002: Add a histogram to track the type of documents printed (HTML vs PDF) (Closed)
Patch Set: Reduce diff Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/print_preview_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 PAGE_RANGE, 138 PAGE_RANGE,
139 DEFAULT_MEDIA, 139 DEFAULT_MEDIA,
140 NON_DEFAULT_MEDIA, 140 NON_DEFAULT_MEDIA,
141 COPIES, 141 COPIES,
142 NON_DEFAULT_MARGINS, 142 NON_DEFAULT_MARGINS,
143 DISTILL_PAGE_UNUSED, 143 DISTILL_PAGE_UNUSED,
144 SCALING, 144 SCALING,
145 PRINT_SETTINGS_BUCKET_BOUNDARY 145 PRINT_SETTINGS_BUCKET_BOUNDARY
146 }; 146 };
147 147
148 enum PrintDocumentTypeBuckets {
Ilya Sherman 2016/12/28 23:25:53 Please document that this enum is used to back an
rbpotter 2016/12/28 23:57:29 Done. Made similar notes for the two enums above,
149 HTML_DOCUMENT = 0,
150 PDF_DOCUMENT,
151 PRINT_DOCUMENT_TYPE_BUCKET_BOUNDARY
152 };
153
148 void ReportUserActionHistogram(enum UserActionBuckets event) { 154 void ReportUserActionHistogram(enum UserActionBuckets event) {
149 UMA_HISTOGRAM_ENUMERATION("PrintPreview.UserAction", event, 155 UMA_HISTOGRAM_ENUMERATION("PrintPreview.UserAction", event,
150 USERACTION_BUCKET_BOUNDARY); 156 USERACTION_BUCKET_BOUNDARY);
151 } 157 }
152 158
153 void ReportPrintSettingHistogram(enum PrintSettingsBuckets setting) { 159 void ReportPrintSettingHistogram(enum PrintSettingsBuckets setting) {
154 UMA_HISTOGRAM_ENUMERATION("PrintPreview.PrintSettings", setting, 160 UMA_HISTOGRAM_ENUMERATION("PrintPreview.PrintSettings", setting,
155 PRINT_SETTINGS_BUCKET_BOUNDARY); 161 PRINT_SETTINGS_BUCKET_BOUNDARY);
156 } 162 }
157 163
164 void ReportPrintDocumentTypeHistogram(enum PrintDocumentTypeBuckets doctype) {
165 UMA_HISTOGRAM_ENUMERATION("PrintPreview.PrintDocumentType", doctype,
166 PRINT_DOCUMENT_TYPE_BUCKET_BOUNDARY);
167 }
168
158 // Name of a dictionary field holding cloud print related data; 169 // Name of a dictionary field holding cloud print related data;
159 const char kAppState[] = "appState"; 170 const char kAppState[] = "appState";
160 // Name of a dictionary field holding the initiator title. 171 // Name of a dictionary field holding the initiator title.
161 const char kInitiatorTitle[] = "initiatorTitle"; 172 const char kInitiatorTitle[] = "initiatorTitle";
162 // Name of a dictionary field holding the measurement system according to the 173 // Name of a dictionary field holding the measurement system according to the
163 // locale. 174 // locale.
164 const char kMeasurementSystem[] = "measurementSystem"; 175 const char kMeasurementSystem[] = "measurementSystem";
165 // Name of a dictionary field holding the number format according to the locale. 176 // Name of a dictionary field holding the number format according to the locale.
166 const char kNumberFormat[] = "numberFormat"; 177 const char kNumberFormat[] = "numberFormat";
167 // Name of a dictionary field specifying whether to print automatically in 178 // Name of a dictionary field specifying whether to print automatically in
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // before printing. 808 // before printing.
798 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforePrint", 809 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforePrint",
799 regenerate_preview_request_count_); 810 regenerate_preview_request_count_);
800 811
801 std::unique_ptr<base::DictionaryValue> settings = GetSettingsDictionary(args); 812 std::unique_ptr<base::DictionaryValue> settings = GetSettingsDictionary(args);
802 if (!settings) 813 if (!settings)
803 return; 814 return;
804 815
805 ReportPrintSettingsStats(*settings); 816 ReportPrintSettingsStats(*settings);
806 817
818 // Report whether the user printed a PDF or an HTML document.
819 ReportPrintDocumentTypeHistogram(print_preview_ui()->source_is_modifiable() ?
820 HTML_DOCUMENT : PDF_DOCUMENT);
821
807 // Never try to add headers/footers here. It's already in the generated PDF. 822 // Never try to add headers/footers here. It's already in the generated PDF.
808 settings->SetBoolean(printing::kSettingHeaderFooterEnabled, false); 823 settings->SetBoolean(printing::kSettingHeaderFooterEnabled, false);
809 824
810 bool print_to_pdf = false; 825 bool print_to_pdf = false;
811 bool is_cloud_printer = false; 826 bool is_cloud_printer = false;
812 bool print_with_privet = false; 827 bool print_with_privet = false;
813 bool print_with_extension = false; 828 bool print_with_extension = false;
814 829
815 bool open_pdf_in_preview = false; 830 bool open_pdf_in_preview = false;
816 #if defined(OS_MACOSX) 831 #if defined(OS_MACOSX)
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 1732
1718 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1733 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1719 if (gaia_cookie_manager_service_) 1734 if (gaia_cookie_manager_service_)
1720 gaia_cookie_manager_service_->RemoveObserver(this); 1735 gaia_cookie_manager_service_->RemoveObserver(this);
1721 } 1736 }
1722 1737
1723 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1738 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1724 const base::Closure& closure) { 1739 const base::Closure& closure) {
1725 pdf_file_saved_closure_ = closure; 1740 pdf_file_saved_closure_ = closure;
1726 } 1741 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698