Roll src/third_party/skia de7665a:76033be
[chromium-blink-merge.git] / components / autofill / core / common / password_generation_util.h
blobda64580ec7820ce565c602734fc6d79dcea991ec
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_
8 namespace autofill {
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.
15 NO_SIGN_UP_DETECTED,
17 // Account creation form is detected.
18 SIGN_UP_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
27 // element.
28 GENERATION_AVAILABLE,
30 // Password generation popup is shown after user focuses the appropriate
31 // password field.
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.
39 PASSWORD_ACCEPTED,
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.
49 PASSWORD_EDITED,
51 // Generated password was deleted by the user
52 PASSWORD_DELETED,
54 // Password generation popup is shown after user focuses the appropriate
55 // password field.
56 GENERATION_POPUP_SHOWN,
58 // User focused the password field containing the generated password.
59 EDITING_POPUP_SHOWN,
61 // Number of enum entries, used for UMA histogram reporting macros.
62 EVENT_ENUM_COUNT
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.
74 bool password_edited;
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.
89 enum UserAction {
90 // User closes the bubble without any meaningful actions (e.g. use backspace
91 // key, close the bubble, click outside the bubble, etc).
92 IGNORE_FEATURE,
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.
97 LEARN_MORE,
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.
107 ACTION_ENUM_COUNT
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_