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

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

Issue 10387162: Add additional stats for print preview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | no next file » | 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 494c6dce253860f9a21b123fd566f88399d4e599..49ac9c0b88ca857ed15ed2018d024fcf5148f0bc 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -95,6 +95,15 @@ enum PrintSettingsBuckets {
PRINT_SETTINGS_BUCKET_BOUNDARY
};
+enum PrintDestinationBuckets {
+ DESTINATION_SHOWN,
+ DESTINATION_CLOSED_CHANGED,
+ DESTINATION_CLOSED_UNCHANGED,
+ SIGNIN_PROMPT,
+ SIGNIN_TRIGGERED,
+ PRINT_DESTINATION_BUCKET_BOUNDARY
+};
+
void ReportUserActionHistogram(enum UserActionBuckets event) {
UMA_HISTOGRAM_ENUMERATION("PrintPreview.UserAction", event,
USERACTION_BUCKET_BOUNDARY);
@@ -105,6 +114,11 @@ void ReportPrintSettingHistogram(enum PrintSettingsBuckets setting) {
PRINT_SETTINGS_BUCKET_BOUNDARY);
}
+void ReportPrintDestinationHistogram(enum PrintDestinationBuckets event) {
+ UMA_HISTOGRAM_ENUMERATION("PrintPreview.DestinationAction", event,
+ PRINT_DESTINATION_BUCKET_BOUNDARY);
+}
+
// Name of a dictionary fielad holdong cloud print related data;
const char kCloudPrintData[] = "cloudPrintData";
// Name of a dictionary field holding the initiator tab title.
@@ -210,6 +224,7 @@ PrintPreviewHandler::PrintPreviewHandler()
: print_backend_(printing::PrintBackend::CreateInstance(NULL)),
regenerate_preview_request_count_(0),
manage_printers_dialog_request_count_(0),
+ manage_cloud_printers_dialog_request_count_(0),
reported_failed_preview_(false),
has_logged_printers_count_(false) {
ReportUserActionHistogram(PREVIEW_STARTED);
@@ -260,6 +275,9 @@ void PrintPreviewHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("getInitialSettings",
base::Bind(&PrintPreviewHandler::HandleGetInitialSettings,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("reportDestinationEvent",
+ base::Bind(&PrintPreviewHandler::HandleReportDestinationEvent,
+ base::Unretained(this)));
}
TabContentsWrapper* PrintPreviewHandler::preview_tab_wrapper() const {
@@ -536,7 +554,6 @@ void PrintPreviewHandler::HandlePrintWithCloudPrint() {
// Record the number of times the user asks to print via cloud print
// instead of the print preview dialog.
ReportStats();
- ReportUserActionHistogram(PRINT_WITH_CLOUD_PRINT);
PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
web_ui()->GetController());
@@ -562,6 +579,7 @@ void PrintPreviewHandler::HandlePrintWithCloudPrint() {
}
void PrintPreviewHandler::HandleManageCloudPrint(const ListValue* /*args*/) {
+ ++manage_cloud_printers_dialog_request_count_;
Browser* browser = BrowserList::GetLastActive();
if (browser != NULL)
browser->OpenURL(OpenURLParams(
@@ -608,6 +626,8 @@ void PrintPreviewHandler::HandleClosePreviewTab(const ListValue* /*args*/) {
void PrintPreviewHandler::ReportStats() {
UMA_HISTOGRAM_COUNTS("PrintPreview.ManagePrinters",
manage_printers_dialog_request_count_);
+ UMA_HISTOGRAM_COUNTS("PrintPreview.ManageCloudPrinters",
+ manage_cloud_printers_dialog_request_count_);
}
void PrintPreviewHandler::GetNumberFormatAndMeasurementSystem(
@@ -636,6 +656,18 @@ void PrintPreviewHandler::HandleGetInitialSettings(const ListValue* /*args*/) {
base::Bind(&PrintSystemTaskProxy::GetDefaultPrinter, task.get()));
}
+void PrintPreviewHandler::HandleReportDestinationEvent(const ListValue* args) {
+ int event_number;
+ bool ret = args->GetInteger(0, &event_number);
+ if (!ret)
+ return;
+ enum PrintDestinationBuckets event =
+ static_cast<enum PrintDestinationBuckets>(event_number);
+ if (event >= PRINT_DESTINATION_BUCKET_BOUNDARY)
+ return;
+ ReportPrintDestinationHistogram(event);
+}
+
void PrintPreviewHandler::SendInitialSettings(
const std::string& default_printer,
const std::string& cloud_print_data) {
@@ -709,6 +741,7 @@ void PrintPreviewHandler::SendCloudPrintEnabled() {
void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings,
std::string print_ticket) {
+ ReportUserActionHistogram(PRINT_WITH_CLOUD_PRINT);
scoped_refptr<base::RefCountedBytes> data;
PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
web_ui()->GetController());
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698