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

Side by Side Diff: components/autofill/core/browser/autofill_metrics.cc

Issue 1931043002: Remove requestAutocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_metrics.h" 5 #include "components/autofill/core/browser/autofill_metrics.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 break; 171 break;
172 } 172 }
173 173
174 // Interpolate the |metric| with the |group|, so that all metrics for a given 174 // Interpolate the |metric| with the |group|, so that all metrics for a given
175 // |group| are adjacent. 175 // |group| are adjacent.
176 return (group * AutofillMetrics::NUM_FIELD_TYPE_QUALITY_METRICS) + metric; 176 return (group * AutofillMetrics::NUM_FIELD_TYPE_QUALITY_METRICS) + metric;
177 } 177 }
178 178
179 namespace { 179 namespace {
180 180
181 std::string WalletApiMetricToString(
182 AutofillMetrics::WalletApiCallMetric metric) {
183 switch (metric) {
184 case AutofillMetrics::ACCEPT_LEGAL_DOCUMENTS:
185 return "AcceptLegalDocuments";
186 case AutofillMetrics::AUTHENTICATE_INSTRUMENT:
187 return "AuthenticateInstrument";
188 case AutofillMetrics::GET_FULL_WALLET:
189 return "GetFullWallet";
190 case AutofillMetrics::GET_WALLET_ITEMS:
191 return "GetWalletItems";
192 case AutofillMetrics::SAVE_TO_WALLET:
193 return "SaveToWallet";
194 case AutofillMetrics::UNKNOWN_API_CALL:
195 case AutofillMetrics::NUM_WALLET_API_CALLS:
196 NOTREACHED();
197 return "UnknownApiCall";
198 }
199
200 NOTREACHED();
201 return "UnknownApiCall";
202 }
203
204 // A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name| 181 // A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name|
205 // to vary over the program's runtime. 182 // to vary over the program's runtime.
206 void LogUMAHistogramEnumeration(const std::string& name, 183 void LogUMAHistogramEnumeration(const std::string& name,
207 int sample, 184 int sample,
208 int boundary_value) { 185 int boundary_value) {
209 DCHECK_LT(sample, boundary_value); 186 DCHECK_LT(sample, boundary_value);
210 187
211 // Note: This leaks memory, which is expected behavior. 188 // Note: This leaks memory, which is expected behavior.
212 base::HistogramBase* histogram = 189 base::HistogramBase* histogram =
213 base::LinearHistogram::FactoryGet( 190 base::LinearHistogram::FactoryGet(
214 name, 191 name,
215 1, 192 1,
216 boundary_value, 193 boundary_value,
217 boundary_value + 1, 194 boundary_value + 1,
218 base::HistogramBase::kUmaTargetedHistogramFlag); 195 base::HistogramBase::kUmaTargetedHistogramFlag);
219 histogram->Add(sample); 196 histogram->Add(sample);
220 } 197 }
221 198
222 // A version of the UMA_HISTOGRAM_TIMES macro that allows the |name|
223 // to vary over the program's runtime.
224 void LogUMAHistogramTimes(const std::string& name,
225 const base::TimeDelta& duration) {
226 // Note: This leaks memory, which is expected behavior.
227 base::HistogramBase* histogram =
228 base::Histogram::FactoryTimeGet(
229 name,
230 base::TimeDelta::FromMilliseconds(1),
231 base::TimeDelta::FromSeconds(10),
232 50,
233 base::HistogramBase::kUmaTargetedHistogramFlag);
234 histogram->AddTime(duration);
235 }
236
237 // A version of the UMA_HISTOGRAM_LONG_TIMES macro that allows the |name| 199 // A version of the UMA_HISTOGRAM_LONG_TIMES macro that allows the |name|
238 // to vary over the program's runtime. 200 // to vary over the program's runtime.
239 void LogUMAHistogramLongTimes(const std::string& name, 201 void LogUMAHistogramLongTimes(const std::string& name,
240 const base::TimeDelta& duration) { 202 const base::TimeDelta& duration) {
241 // Note: This leaks memory, which is expected behavior. 203 // Note: This leaks memory, which is expected behavior.
242 base::HistogramBase* histogram = 204 base::HistogramBase* histogram =
243 base::Histogram::FactoryTimeGet( 205 base::Histogram::FactoryTimeGet(
244 name, 206 name,
245 base::TimeDelta::FromMilliseconds(1), 207 base::TimeDelta::FromMilliseconds(1),
246 base::TimeDelta::FromHours(1), 208 base::TimeDelta::FromHours(1),
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 void AutofillMetrics::LogScanCreditCardCompleted( 275 void AutofillMetrics::LogScanCreditCardCompleted(
314 const base::TimeDelta& duration, 276 const base::TimeDelta& duration,
315 bool completed) { 277 bool completed) {
316 std::string suffix = completed ? "Completed" : "Cancelled"; 278 std::string suffix = completed ? "Completed" : "Cancelled";
317 LogUMAHistogramLongTimes("Autofill.ScanCreditCard.Duration_" + suffix, 279 LogUMAHistogramLongTimes("Autofill.ScanCreditCard.Duration_" + suffix,
318 duration); 280 duration);
319 UMA_HISTOGRAM_BOOLEAN("Autofill.ScanCreditCard.Completed", completed); 281 UMA_HISTOGRAM_BOOLEAN("Autofill.ScanCreditCard.Completed", completed);
320 } 282 }
321 283
322 // static 284 // static
323 void AutofillMetrics::LogDialogDismissalState(DialogDismissalState state) {
324 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.DismissalState",
325 state, NUM_DIALOG_DISMISSAL_STATES);
326 }
327
328 // static
329 void AutofillMetrics::LogDialogInitialUserState(
330 DialogInitialUserStateMetric user_type) {
331 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.InitialUserState",
332 user_type, NUM_DIALOG_INITIAL_USER_STATE_METRICS);
333 }
334
335 // static
336 void AutofillMetrics::LogDialogLatencyToShow(const base::TimeDelta& duration) {
337 LogUMAHistogramTimes("RequestAutocomplete.UiLatencyToShow", duration);
338 }
339
340 // static
341 void AutofillMetrics::LogDialogPopupEvent(DialogPopupEvent event) {
342 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.PopupInDialog",
343 event, NUM_DIALOG_POPUP_EVENTS);
344 }
345
346 // static
347 void AutofillMetrics::LogDialogSecurityMetric(DialogSecurityMetric metric) {
348 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.Security",
349 metric, NUM_DIALOG_SECURITY_METRICS);
350 }
351
352 // static
353 void AutofillMetrics::LogDialogUiDuration(
354 const base::TimeDelta& duration,
355 DialogDismissalAction dismissal_action) {
356 std::string suffix;
357 switch (dismissal_action) {
358 case DIALOG_ACCEPTED:
359 suffix = "Submit";
360 break;
361
362 case DIALOG_CANCELED:
363 suffix = "Cancel";
364 break;
365 }
366
367 LogUMAHistogramLongTimes("RequestAutocomplete.UiDuration", duration);
368 LogUMAHistogramLongTimes("RequestAutocomplete.UiDuration." + suffix,
369 duration);
370 }
371
372 // static
373 void AutofillMetrics::LogDialogUiEvent(DialogUiEvent event) {
374 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.UiEvents", event,
375 NUM_DIALOG_UI_EVENTS);
376 }
377
378 // static
379 void AutofillMetrics::LogUnmaskPromptEvent(UnmaskPromptEvent event) { 285 void AutofillMetrics::LogUnmaskPromptEvent(UnmaskPromptEvent event) {
380 UMA_HISTOGRAM_ENUMERATION("Autofill.UnmaskPrompt.Events", event, 286 UMA_HISTOGRAM_ENUMERATION("Autofill.UnmaskPrompt.Events", event,
381 NUM_UNMASK_PROMPT_EVENTS); 287 NUM_UNMASK_PROMPT_EVENTS);
382 } 288 }
383 289
384 // static 290 // static
385 void AutofillMetrics::LogUnmaskPromptEventDuration( 291 void AutofillMetrics::LogUnmaskPromptEventDuration(
386 const base::TimeDelta& duration, 292 const base::TimeDelta& duration,
387 UnmaskPromptEvent close_event) { 293 UnmaskPromptEvent close_event) {
388 std::string suffix; 294 std::string suffix;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 default: 393 default:
488 NOTREACHED(); 394 NOTREACHED();
489 return; 395 return;
490 } 396 }
491 LogUMAHistogramLongTimes("Autofill.UnmaskPrompt.UnmaskingDuration", duration); 397 LogUMAHistogramLongTimes("Autofill.UnmaskPrompt.UnmaskingDuration", duration);
492 LogUMAHistogramLongTimes("Autofill.UnmaskPrompt.UnmaskingDuration." + suffix, 398 LogUMAHistogramLongTimes("Autofill.UnmaskPrompt.UnmaskingDuration." + suffix,
493 duration); 399 duration);
494 } 400 }
495 401
496 // static 402 // static
497 void AutofillMetrics::LogWalletErrorMetric(WalletErrorMetric metric) {
498 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.WalletErrors", metric,
499 NUM_WALLET_ERROR_METRICS);
500 }
501
502 // static
503 void AutofillMetrics::LogWalletApiCallDuration(
504 WalletApiCallMetric metric,
505 const base::TimeDelta& duration) {
506 LogUMAHistogramTimes("Wallet.ApiCallDuration." +
507 WalletApiMetricToString(metric), duration);
508 }
509
510 // static
511 void AutofillMetrics::LogWalletMalformedResponseMetric(
512 WalletApiCallMetric metric) {
513 UMA_HISTOGRAM_ENUMERATION("Wallet.MalformedResponse", metric,
514 NUM_WALLET_API_CALLS);
515 }
516
517 // static
518 void AutofillMetrics::LogWalletRequiredActionMetric(
519 WalletRequiredActionMetric required_action) {
520 UMA_HISTOGRAM_ENUMERATION("RequestAutocomplete.WalletRequiredActions",
521 required_action, NUM_WALLET_REQUIRED_ACTIONS);
522 }
523
524 // static
525 void AutofillMetrics::LogWalletResponseCode(int response_code) {
526 UMA_HISTOGRAM_SPARSE_SLOWLY("Wallet.ResponseCode", response_code);
527 }
528
529 // static
530 void AutofillMetrics::LogDeveloperEngagementMetric( 403 void AutofillMetrics::LogDeveloperEngagementMetric(
531 DeveloperEngagementMetric metric) { 404 DeveloperEngagementMetric metric) {
532 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS); 405 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS);
533 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric, 406 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric,
534 NUM_DEVELOPER_ENGAGEMENT_METRICS); 407 NUM_DEVELOPER_ENGAGEMENT_METRICS);
535 } 408 }
536 409
537 // static 410 // static
538 void AutofillMetrics::LogHeuristicTypePrediction(FieldTypeQualityMetric metric, 411 void AutofillMetrics::LogHeuristicTypePrediction(FieldTypeQualityMetric metric,
539 ServerFieldType field_type, 412 ServerFieldType field_type,
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 else if (is_server_data_available_ && !is_local_data_available_) 754 else if (is_server_data_available_ && !is_local_data_available_)
882 name += ".WithOnlyServerData"; 755 name += ".WithOnlyServerData";
883 else if (!is_server_data_available_ && is_local_data_available_) 756 else if (!is_server_data_available_ && is_local_data_available_)
884 name += ".WithOnlyLocalData"; 757 name += ".WithOnlyLocalData";
885 else 758 else
886 name += ".WithBothServerAndLocalData"; 759 name += ".WithBothServerAndLocalData";
887 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); 760 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
888 } 761 }
889 762
890 } // namespace autofill 763 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.h ('k') | components/autofill/core/browser/test_autofill_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698