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 GENERATION_POPUP_SHOWN
,
34 // Generated password was accepted by the user.
37 // User focused the password field containing the generated password.
40 // Password was changed after generation.
43 // Generated password was deleted by the user
46 // Number of enum entries, used for UMA histogram reporting macros.
50 // Wrapper to store the user interactions with the password generation bubble.
51 struct PasswordGenerationActions
{
52 // Whether the user has clicked on the learn more link.
53 bool learn_more_visited
;
55 // Whether the user has accepted the generated password.
56 bool password_accepted
;
58 // Whether the user has manually edited password entry.
61 // Whether the user has clicked on the regenerate button.
62 bool password_regenerated
;
64 PasswordGenerationActions();
65 ~PasswordGenerationActions();
68 void LogUserActions(PasswordGenerationActions actions
);
70 void LogPasswordGenerationEvent(PasswordGenerationEvent event
);
72 // Enumerates user actions after password generation bubble is shown.
73 // These are visible for testing purposes.
75 // User closes the bubble without any meaningful actions (e.g. use backspace
76 // key, close the bubble, click outside the bubble, etc).
79 // User navigates to the learn more page. Note that in the current
80 // implementation this will result in closing the bubble so this action
81 // doesn't overlap with the following two actions.
84 // User accepts the generated password without manually editing it (but
85 // including changing it through the regenerate button).
86 ACCEPT_ORIGINAL_PASSWORD
,
88 // User accepts the gererated password after manually editing it.
91 // Number of enum entries, used for UMA histogram reporting macros.
95 // Returns true if Password Generation is enabled according to the field
96 // trial result and the flags.
97 bool IsPasswordGenerationEnabled();
99 } // namespace password_generation
100 } // namespace autofill
102 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_GENERATION_UTIL_H_