| OLD | NEW |
| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 ADDRESS_ZIP, | 27 ADDRESS_ZIP, |
| 28 ADDRESS_COUNTRY, | 28 ADDRESS_COUNTRY, |
| 29 PHONE, | 29 PHONE, |
| 30 FAX, // Deprecated. | 30 FAX, // Deprecated. |
| 31 EMAIL, | 31 EMAIL, |
| 32 CREDIT_CARD_NAME, | 32 CREDIT_CARD_NAME, |
| 33 CREDIT_CARD_NUMBER, | 33 CREDIT_CARD_NUMBER, |
| 34 CREDIT_CARD_DATE, | 34 CREDIT_CARD_DATE, |
| 35 CREDIT_CARD_TYPE, | 35 CREDIT_CARD_TYPE, |
| 36 PASSWORD, | 36 PASSWORD, |
| 37 ADDRESS_LINE_3, |
| 37 NUM_FIELD_TYPE_GROUPS_FOR_METRICS | 38 NUM_FIELD_TYPE_GROUPS_FOR_METRICS |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 // First, translates |field_type| to the corresponding logical |group| from | 41 // First, translates |field_type| to the corresponding logical |group| from |
| 41 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|, | 42 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|, |
| 42 // which should be in the range [0, |num_possible_metrics|). | 43 // which should be in the range [0, |num_possible_metrics|). |
| 43 // Returns the interpolated index. | 44 // Returns the interpolated index. |
| 44 // | 45 // |
| 45 // The interpolation maps the pair (|group|, |metric|) to a single index, so | 46 // The interpolation maps the pair (|group|, |metric|) to a single index, so |
| 46 // that all the indicies for a given group are adjacent. In particular, with | 47 // that all the indicies for a given group are adjacent. In particular, with |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 81 |
| 81 case ::autofill::ADDRESS_HOME: | 82 case ::autofill::ADDRESS_HOME: |
| 82 case ::autofill::ADDRESS_BILLING: | 83 case ::autofill::ADDRESS_BILLING: |
| 83 switch (AutofillType(field_type).GetStorableType()) { | 84 switch (AutofillType(field_type).GetStorableType()) { |
| 84 case ADDRESS_HOME_LINE1: | 85 case ADDRESS_HOME_LINE1: |
| 85 group = ADDRESS_LINE_1; | 86 group = ADDRESS_LINE_1; |
| 86 break; | 87 break; |
| 87 case ADDRESS_HOME_LINE2: | 88 case ADDRESS_HOME_LINE2: |
| 88 group = ADDRESS_LINE_2; | 89 group = ADDRESS_LINE_2; |
| 89 break; | 90 break; |
| 91 case ADDRESS_HOME_LINE3: |
| 92 group = ADDRESS_LINE_3; |
| 93 break; |
| 90 case ADDRESS_HOME_CITY: | 94 case ADDRESS_HOME_CITY: |
| 91 group = ADDRESS_CITY; | 95 group = ADDRESS_CITY; |
| 92 break; | 96 break; |
| 93 case ADDRESS_HOME_STATE: | 97 case ADDRESS_HOME_STATE: |
| 94 group = ADDRESS_STATE; | 98 group = ADDRESS_STATE; |
| 95 break; | 99 break; |
| 96 case ADDRESS_HOME_ZIP: | 100 case ADDRESS_HOME_ZIP: |
| 97 group = ADDRESS_ZIP; | 101 group = ADDRESS_ZIP; |
| 98 break; | 102 break; |
| 99 case ADDRESS_HOME_COUNTRY: | 103 case ADDRESS_HOME_COUNTRY: |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 434 |
| 431 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) const { | 435 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) const { |
| 432 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles); | 436 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles); |
| 433 } | 437 } |
| 434 | 438 |
| 435 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) const { | 439 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) const { |
| 436 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); | 440 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); |
| 437 } | 441 } |
| 438 | 442 |
| 439 } // namespace autofill | 443 } // namespace autofill |
| OLD | NEW |