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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_GENERATION_UTIL_H_
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_GENERATION_UTIL_H_
9 namespace password_generation
{
11 // Enumerates various events related to the password generation process.
12 // Do not remove items from this enum as they are used for UMA stats logging.
13 enum PasswordGenerationEvent
{
14 // No Account creation form is detected.
17 // Account creation form is detected.
20 // DEPRECATED: Password generation icon shown (old UI).
21 DEPRECATED_ICON_SHOWN
,
23 // DEPRECATED: Password generation bubble shown (old UI).
24 DEPRECATED_BUBBLE_SHOWN
,
26 // Password generation could be triggered if the user selects the appropriate
30 // Password generation popup is shown after user focuses the appropriate
32 // DEPRECATED: These reports were triggered when the popup could have shown
33 // not when it did show so they paint an unreliable picture. Newer stats
34 // are only incremented per page, which is more useful to judge the
35 // effectiveness of the UI.
36 DEPRECATED_GENERATION_POPUP_SHOWN
,
38 // Generated password was accepted by the user.
41 // User focused the password field containing the generated password.
42 // DEPRECATED: These reports were triggered when the popup could have shown
43 // not when it did show so they paint an unreliable picture. Newer stats
44 // are only incremented per page, which is more useful to judge the
45 // effectiveness of the UI.
46 DEPRECATED_EDITING_POPUP_SHOWN
,
48 // Password was changed after generation.
51 // Generated password was deleted by the user
54 // Password generation popup is shown after user focuses the appropriate
56 GENERATION_POPUP_SHOWN
,
58 // User focused the password field containing the generated password.
61 // Number of enum entries, used for UMA histogram reporting macros.
65 // Wrapper to store the user interactions with the password generation bubble.
66 struct PasswordGenerationActions
{
67 // Whether the user has clicked on the learn more link.
68 bool learn_more_visited
;
70 // Whether the user has accepted the generated password.
71 bool password_accepted
;
73 // Whether the user has manually edited password entry.
76 // Whether the user has clicked on the regenerate button.
77 bool password_regenerated
;
79 PasswordGenerationActions();
80 ~PasswordGenerationActions();
83 void LogUserActions(PasswordGenerationActions actions
);
85 void LogPasswordGenerationEvent(PasswordGenerationEvent event
);
87 // Enumerates user actions after password generation bubble is shown.
88 // These are visible for testing purposes.
90 // User closes the bubble without any meaningful actions (e.g. use backspace
91 // key, close the bubble, click outside the bubble, etc).
94 // User navigates to the learn more page. Note that in the current
95 // implementation this will result in closing the bubble so this action
96 // doesn't overlap with the following two actions.
99 // User accepts the generated password without manually editing it (but
100 // including changing it through the regenerate button).
101 ACCEPT_ORIGINAL_PASSWORD
,
103 // User accepts the gererated password after manually editing it.
104 ACCEPT_AFTER_EDITING
,
106 // Number of enum entries, used for UMA histogram reporting macros.
110 // Returns true if Password Generation is enabled according to the field
111 // trial result and the flags.
112 bool IsPasswordGenerationEnabled();
114 } // namespace password_generation
115 } // namespace autofill
117 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_GENERATION_UTIL_H_