Move StartsWith[ASCII] to base namespace.
[chromium-blink-merge.git] / components / autofill / core / common / password_generation_util.h
blobaf37a9e29bafb10c498e718ae6a5c6745d60dfe5
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 // Generation enabled because autocomplete attributes for username and
62 // new-password are set.
63 AUTOCOMPLETE_ATTRIBUTES_ENABLED_GENERATION,
65 // Number of enum entries, used for UMA histogram reporting macros.
66 EVENT_ENUM_COUNT
69 // Wrapper to store the user interactions with the password generation bubble.
70 struct PasswordGenerationActions {
71 // Whether the user has clicked on the learn more link.
72 bool learn_more_visited;
74 // Whether the user has accepted the generated password.
75 bool password_accepted;
77 // Whether the user has manually edited password entry.
78 bool password_edited;
80 // Whether the user has clicked on the regenerate button.
81 bool password_regenerated;
83 PasswordGenerationActions();
84 ~PasswordGenerationActions();
87 void LogUserActions(PasswordGenerationActions actions);
89 void LogPasswordGenerationEvent(PasswordGenerationEvent event);
91 // Enumerates user actions after password generation bubble is shown.
92 // These are visible for testing purposes.
93 enum UserAction {
94 // User closes the bubble without any meaningful actions (e.g. use backspace
95 // key, close the bubble, click outside the bubble, etc).
96 IGNORE_FEATURE,
98 // User navigates to the learn more page. Note that in the current
99 // implementation this will result in closing the bubble so this action
100 // doesn't overlap with the following two actions.
101 LEARN_MORE,
103 // User accepts the generated password without manually editing it (but
104 // including changing it through the regenerate button).
105 ACCEPT_ORIGINAL_PASSWORD,
107 // User accepts the gererated password after manually editing it.
108 ACCEPT_AFTER_EDITING,
110 // Number of enum entries, used for UMA histogram reporting macros.
111 ACTION_ENUM_COUNT
114 // Returns true if Password Generation is enabled according to the field
115 // trial result and the flags.
116 bool IsPasswordGenerationEnabled();
118 } // namespace password_generation
119 } // namespace autofill
121 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_GENERATION_UTIL_H_