| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_AUTOFILL_IOS_BROWSER_KEYBOARD_ACCESSORY_METRICS_LOGGER_H_ | |
| 6 #define COMPONENTS_AUTOFILL_IOS_BROWSER_KEYBOARD_ACCESSORY_METRICS_LOGGER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 | |
| 10 namespace autofill { | |
| 11 | |
| 12 class KeyboardAccessoryMetricsLogger { | |
| 13 public: | |
| 14 // Each of these metrics is logged only for potentially autofillable forms, | |
| 15 // i.e. forms with at least three fields, etc. | |
| 16 // These are used to derive how often the keyboard accessory buttons are used. | |
| 17 // For example, (NEXT_BUTTON_PRESSED_ONCE / SUBMITTED_FORM) gives the fraction | |
| 18 // of submitted forms where the user pressed the "next field" keyboard | |
| 19 // accessory button to navigate the form. | |
| 20 enum ButtonMetric { | |
| 21 // Loaded a page containing forms. | |
| 22 // Should be logged under exact same conditions as | |
| 23 // UserHappinessMetric.FORMS_LOADED to make this data as directly | |
| 24 // comparable as possible with UserHappinessMetric. | |
| 25 FORMS_LOADED = 0, | |
| 26 // Submitted a form. | |
| 27 // Should be logged under same conditions as UserHappiness.SUBMITTED_*, for | |
| 28 // same reason as FORMS_LOADED above. | |
| 29 SUBMITTED_FORM, | |
| 30 // User pressed the "Close" button on the keyboard accessory. | |
| 31 CLOSE_BUTTON_PRESSED, | |
| 32 // Same as above, but only logged once per page load. | |
| 33 CLOSE_BUTTON_PRESSED_ONCE, | |
| 34 // User pressed the "Next" button on the keyboard accessory. | |
| 35 NEXT_BUTTON_PRESSED, | |
| 36 // Same as above, but only logged once per page load. | |
| 37 NEXT_BUTTON_PRESSED_ONCE, | |
| 38 // User pressed the "Previous" button on the keyboard accessory. | |
| 39 PREVIOUS_BUTTON_PRESSED, | |
| 40 // Same as above, but only logged once per page load. | |
| 41 PREVIOUS_BUTTON_PRESSED_ONCE, | |
| 42 NUM_BUTTON_METRICS, | |
| 43 }; | |
| 44 | |
| 45 KeyboardAccessoryMetricsLogger(); | |
| 46 | |
| 47 // Called when a page with potentially autofillable forms is loaded, | |
| 48 // i.e. forms with at least three fields, etc. | |
| 49 static void OnFormsLoaded(); | |
| 50 | |
| 51 // Called when a potentially autofillable form is submitted. | |
| 52 static void OnFormSubmitted(); | |
| 53 | |
| 54 // Called when the user presses the "close keyboard" keyboard accessory | |
| 55 // button. | |
| 56 void OnCloseButtonPressed(); | |
| 57 | |
| 58 // Called when the user presses the "next field" keyboard accessory button. | |
| 59 void OnNextButtonPressed(); | |
| 60 | |
| 61 // Called when the user presses the "previous field" keyboard accessory | |
| 62 // button. | |
| 63 void OnPreviousButtonPressed(); | |
| 64 | |
| 65 private: | |
| 66 bool has_logged_close_button_; | |
| 67 bool has_logged_next_button_; | |
| 68 bool has_logged_previous_button_; | |
| 69 }; | |
| 70 | |
| 71 } // namespace autofill | |
| 72 | |
| 73 #endif // COMPONENTS_AUTOFILL_IOS_BROWSER_KEYBOARD_ACCESSORY_METRICS_LOGGER_H_ | |
| OLD | NEW |