| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 namespace autofill_metrics { | 9 #include "base/basictypes.h" |
| 10 | 10 |
| 11 // Each of these should be logged at most once per query to the server, which in | 11 class AutoFillMetrics { |
| 12 // turn should occur at most once per page load. | 12 public: |
| 13 enum ServerQueryMetricType { | 13 // Each of these is logged at most once per query to the server, which in turn |
| 14 // Logged for each query sent to the server | 14 // occurs at most once per page load. |
| 15 QUERY_SENT = 0, | 15 enum ServerQueryMetric { |
| 16 // Logged for each query response received from the server | 16 // Logged for each query sent to the server. |
| 17 QUERY_RESPONSE_RECEIVED, | 17 QUERY_SENT = 0, |
| 18 // Logged for each parsable response received from the server | 18 // Logged for each query response received from the server. |
| 19 QUERY_RESPONSE_PARSED, | 19 QUERY_RESPONSE_RECEIVED, |
| 20 // Logged for each parsable response that provided no improvements relative to | 20 // Logged for each parsable response received from the server. |
| 21 // our heuristics. | 21 QUERY_RESPONSE_PARSED, |
| 22 QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS, | 22 // Logged for each parsable response that provided no improvements relative |
| 23 // Logged for each page for which our heuristics detected at least one | 23 // to our heuristics. |
| 24 // auto-fillable field, but the server response overrode the type of at least | 24 QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS, |
| 25 // one field | 25 // Logged for each page for which our heuristics detected at least one |
| 26 QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS, | 26 // auto-fillable field, but the server response overrode the type of at |
| 27 // Logged for each page for which our heuristics did not detect any | 27 // least one field. |
| 28 // auto-fillable fields, but the server response did detect some. | 28 QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS, |
| 29 QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS, | 29 // Logged for each page for which our heuristics did not detect any |
| 30 NUM_SERVER_QUERY_METRICS | 30 // auto-fillable fields, but the server response did detect some. |
| 31 QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS, |
| 32 NUM_SERVER_QUERY_METRICS |
| 33 }; |
| 34 |
| 35 // Each of these is logged at most once per form submission. |
| 36 enum QualityMetric { |
| 37 // Logged for each field in a submitted form. |
| 38 FIELD_SUBMITTED = 0, |
| 39 // A simple successs metric, logged for each field that returns true for |
| 40 // |is_autofilled()| and has a value that is present in the personal data |
| 41 // manager. There is a small chance of false positives from filling via |
| 42 // autocomplete rather than autofill. |
| 43 FIELD_AUTOFILLED, |
| 44 // A simple failure metric, logged for each field that returns false for |
| 45 // |is_autofilled()| but as a value that is present in the personal data |
| 46 // manager. |
| 47 FIELD_AUTOFILL_FAILED, |
| 48 NUM_QUALITY_METRICS |
| 49 }; |
| 50 |
| 51 AutoFillMetrics(); |
| 52 virtual ~AutoFillMetrics(); |
| 53 |
| 54 virtual void Log(ServerQueryMetric metric) const; |
| 55 virtual void Log(QualityMetric metric) const; |
| 56 |
| 57 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(AutoFillMetrics); |
| 31 }; | 59 }; |
| 32 | 60 |
| 33 void LogServerQueryMetric(ServerQueryMetricType type); | |
| 34 | |
| 35 } // namespace autofill_metrics | |
| 36 | |
| 37 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 61 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
| OLD | NEW |