OLD | NEW |
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 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 COLOR, | 98 COLOR, |
99 BLACK_AND_WHITE, | 99 BLACK_AND_WHITE, |
100 COLLATE, | 100 COLLATE, |
101 SIMPLEX, | 101 SIMPLEX, |
102 DUPLEX, | 102 DUPLEX, |
103 PRINT_SETTINGS_BUCKET_BOUNDARY | 103 PRINT_SETTINGS_BUCKET_BOUNDARY |
104 }; | 104 }; |
105 | 105 |
106 enum UiBucketGroups { | 106 enum UiBucketGroups { |
107 DESTINATION_SEARCH, | 107 DESTINATION_SEARCH, |
| 108 GCP_PROMO, |
108 UI_BUCKET_GROUP_BOUNDARY | 109 UI_BUCKET_GROUP_BOUNDARY |
109 }; | 110 }; |
110 | 111 |
111 enum PrintDestinationBuckets { | 112 enum PrintDestinationBuckets { |
112 DESTINATION_SHOWN, | 113 DESTINATION_SHOWN, |
113 DESTINATION_CLOSED_CHANGED, | 114 DESTINATION_CLOSED_CHANGED, |
114 DESTINATION_CLOSED_UNCHANGED, | 115 DESTINATION_CLOSED_UNCHANGED, |
115 SIGNIN_PROMPT, | 116 SIGNIN_PROMPT, |
116 SIGNIN_TRIGGERED, | 117 SIGNIN_TRIGGERED, |
117 PRINT_DESTINATION_BUCKET_BOUNDARY | 118 PRINT_DESTINATION_BUCKET_BOUNDARY |
118 }; | 119 }; |
119 | 120 |
| 121 enum GcpPromoBuckets { |
| 122 PROMO_SHOWN, |
| 123 PROMO_CLOSED, |
| 124 PROMO_CLICKED, |
| 125 GCP_PROMO_BUCKET_BOUNDARY |
| 126 }; |
| 127 |
120 void ReportUserActionHistogram(enum UserActionBuckets event) { | 128 void ReportUserActionHistogram(enum UserActionBuckets event) { |
121 UMA_HISTOGRAM_ENUMERATION("PrintPreview.UserAction", event, | 129 UMA_HISTOGRAM_ENUMERATION("PrintPreview.UserAction", event, |
122 USERACTION_BUCKET_BOUNDARY); | 130 USERACTION_BUCKET_BOUNDARY); |
123 } | 131 } |
124 | 132 |
125 void ReportPrintSettingHistogram(enum PrintSettingsBuckets setting) { | 133 void ReportPrintSettingHistogram(enum PrintSettingsBuckets setting) { |
126 UMA_HISTOGRAM_ENUMERATION("PrintPreview.PrintSettings", setting, | 134 UMA_HISTOGRAM_ENUMERATION("PrintPreview.PrintSettings", setting, |
127 PRINT_SETTINGS_BUCKET_BOUNDARY); | 135 PRINT_SETTINGS_BUCKET_BOUNDARY); |
128 } | 136 } |
129 | 137 |
130 void ReportPrintDestinationHistogram(enum PrintDestinationBuckets event) { | 138 void ReportPrintDestinationHistogram(enum PrintDestinationBuckets event) { |
131 UMA_HISTOGRAM_ENUMERATION("PrintPreview.DestinationAction", event, | 139 UMA_HISTOGRAM_ENUMERATION("PrintPreview.DestinationAction", event, |
132 PRINT_DESTINATION_BUCKET_BOUNDARY); | 140 PRINT_DESTINATION_BUCKET_BOUNDARY); |
133 } | 141 } |
134 | 142 |
| 143 void ReportGcpPromoHistogram(enum GcpPromoBuckets event) { |
| 144 UMA_HISTOGRAM_ENUMERATION("PrintPreview.GcpPromo", event, |
| 145 GCP_PROMO_BUCKET_BOUNDARY); |
| 146 } |
| 147 |
135 // Name of a dictionary field holding cloud print related data; | 148 // Name of a dictionary field holding cloud print related data; |
136 const char kAppState[] = "appState"; | 149 const char kAppState[] = "appState"; |
137 // Name of a dictionary field holding the initiator tab title. | 150 // Name of a dictionary field holding the initiator tab title. |
138 const char kInitiatorTabTitle[] = "initiatorTabTitle"; | 151 const char kInitiatorTabTitle[] = "initiatorTabTitle"; |
139 // Name of a dictionary field holding the measurement system according to the | 152 // Name of a dictionary field holding the measurement system according to the |
140 // locale. | 153 // locale. |
141 const char kMeasurementSystem[] = "measurementSystem"; | 154 const char kMeasurementSystem[] = "measurementSystem"; |
142 // Name of a dictionary field holding the number format according to the locale. | 155 // Name of a dictionary field holding the number format according to the locale. |
143 const char kNumberFormat[] = "numberFormat"; | 156 const char kNumberFormat[] = "numberFormat"; |
144 // Name of a dictionary field specifying whether to print automatically in | 157 // Name of a dictionary field specifying whether to print automatically in |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 return; | 711 return; |
699 | 712 |
700 enum UiBucketGroups ui_bucket_group = | 713 enum UiBucketGroups ui_bucket_group = |
701 static_cast<enum UiBucketGroups>(event_group); | 714 static_cast<enum UiBucketGroups>(event_group); |
702 if (ui_bucket_group >= UI_BUCKET_GROUP_BOUNDARY) | 715 if (ui_bucket_group >= UI_BUCKET_GROUP_BOUNDARY) |
703 return; | 716 return; |
704 | 717 |
705 switch (ui_bucket_group) { | 718 switch (ui_bucket_group) { |
706 case DESTINATION_SEARCH: { | 719 case DESTINATION_SEARCH: { |
707 enum PrintDestinationBuckets event = | 720 enum PrintDestinationBuckets event = |
708 static_cast<enum PrintDestinationBuckets>(event_number); | 721 static_cast<enum PrintDestinationBuckets>(event_number); |
709 if (event >= PRINT_DESTINATION_BUCKET_BOUNDARY) | 722 if (event >= PRINT_DESTINATION_BUCKET_BOUNDARY) |
710 return; | 723 return; |
711 ReportPrintDestinationHistogram(event); | 724 ReportPrintDestinationHistogram(event); |
712 break; | 725 break; |
713 } | 726 } |
| 727 case GCP_PROMO: { |
| 728 enum GcpPromoBuckets event = |
| 729 static_cast<enum GcpPromoBuckets>(event_number); |
| 730 if (event >= GCP_PROMO_BUCKET_BOUNDARY) |
| 731 return; |
| 732 ReportGcpPromoHistogram(event); |
| 733 break; |
| 734 } |
714 default: | 735 default: |
715 break; | 736 break; |
716 } | 737 } |
717 } | 738 } |
718 | 739 |
719 void PrintPreviewHandler::SendInitialSettings( | 740 void PrintPreviewHandler::SendInitialSettings( |
720 const std::string& default_printer, | 741 const std::string& default_printer, |
721 const std::string& cloud_print_data) { | 742 const std::string& cloud_print_data) { |
722 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( | 743 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( |
723 web_ui()->GetController()); | 744 web_ui()->GetController()); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 return; | 956 return; |
936 | 957 |
937 // We no longer require the initiator tab details. Remove those details | 958 // We no longer require the initiator tab details. Remove those details |
938 // associated with the preview tab to allow the initiator tab to create | 959 // associated with the preview tab to allow the initiator tab to create |
939 // another preview tab. | 960 // another preview tab. |
940 printing::PrintPreviewTabController* tab_controller = | 961 printing::PrintPreviewTabController* tab_controller = |
941 printing::PrintPreviewTabController::GetInstance(); | 962 printing::PrintPreviewTabController::GetInstance(); |
942 if (tab_controller) | 963 if (tab_controller) |
943 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); | 964 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); |
944 } | 965 } |
OLD | NEW |