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 #import "components/autofill/ios/browser/keyboard_accessory_metrics_logger.h" | |
6 | |
7 #import <UIKit/UIKit.h> | |
8 | |
9 #include "base/logging.h" | |
10 #include "base/metrics/histogram_macros.h" | |
11 | |
12 namespace autofill { | |
13 | |
14 namespace { | |
15 | |
16 void Log(KeyboardAccessoryMetricsLogger::ButtonMetric metric) { | |
17 DCHECK_LT(metric, KeyboardAccessoryMetricsLogger::NUM_BUTTON_METRICS); | |
18 if (UIAccessibilityIsVoiceOverRunning()) { | |
19 UMA_HISTOGRAM_ENUMERATION( | |
20 "Autofill.KeyboardAccessoryButtonsIOS_ScreenReaderOn", metric, | |
21 KeyboardAccessoryMetricsLogger::NUM_BUTTON_METRICS); | |
22 } else { | |
23 UMA_HISTOGRAM_ENUMERATION( | |
24 "Autofill.KeyboardAccessoryButtonsIOS_ScreenReaderOff", metric, | |
25 KeyboardAccessoryMetricsLogger::NUM_BUTTON_METRICS); | |
26 } | |
27 } | |
28 | |
29 } // namespace | |
30 | |
31 KeyboardAccessoryMetricsLogger::KeyboardAccessoryMetricsLogger() | |
32 : has_logged_close_button_(false), | |
33 has_logged_next_button_(false), | |
34 has_logged_previous_button_(false) {} | |
35 | |
36 // static | |
37 void KeyboardAccessoryMetricsLogger::OnFormsLoaded() { | |
38 Log(FORMS_LOADED); | |
39 } | |
40 | |
41 // static | |
42 void KeyboardAccessoryMetricsLogger::OnFormSubmitted() { | |
43 Log(SUBMITTED_FORM); | |
44 } | |
45 | |
46 void KeyboardAccessoryMetricsLogger::OnCloseButtonPressed() { | |
47 Log(CLOSE_BUTTON_PRESSED); | |
48 if (!has_logged_close_button_) { | |
49 has_logged_close_button_ = true; | |
50 Log(CLOSE_BUTTON_PRESSED_ONCE); | |
51 } | |
52 } | |
53 | |
54 void KeyboardAccessoryMetricsLogger::OnNextButtonPressed() { | |
55 Log(NEXT_BUTTON_PRESSED); | |
56 if (!has_logged_next_button_) { | |
57 has_logged_next_button_ = true; | |
58 Log(NEXT_BUTTON_PRESSED_ONCE); | |
59 } | |
60 } | |
61 | |
62 void KeyboardAccessoryMetricsLogger::OnPreviousButtonPressed() { | |
63 Log(PREVIOUS_BUTTON_PRESSED); | |
64 if (!has_logged_previous_button_) { | |
65 has_logged_previous_button_ = true; | |
66 Log(PREVIOUS_BUTTON_PRESSED_ONCE); | |
67 } | |
68 } | |
69 | |
70 } // namespace autofill | |
OLD | NEW |