1 // Copyright (c) 2012 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 #include "chrome/common/password_generation_util.h"
7 #include "base/metrics/histogram.h"
11 // Enumerates user actions after password generation bubble is shown.
13 // User closes the bubble without any meaningful actions (e.g. use backspace
14 // key, close the bubble, click outside the bubble, etc).
17 // User navigates to the learn more page. Note that in the current
18 // implementation this will result in closing the bubble so this action
19 // doesn't overlap with the following two actions.
22 // User accepts the generated password without manually editing it (but
23 // including changing it through the regenerate button).
24 ACCEPT_ORIGINAL_PASSWORD
,
26 // User accepts the gererated password after manually editing it.
29 // Number of enum entries, used for UMA histogram reporting macros.
33 } // anonymous namespace
35 namespace password_generation
{
37 PasswordGenerationActions::PasswordGenerationActions()
38 : learn_more_visited(false),
39 password_accepted(false),
40 password_edited(false),
41 password_regenerated(false) {
44 PasswordGenerationActions::~PasswordGenerationActions() {
47 void LogUserActions(PasswordGenerationActions actions
) {
48 UserAction action
= IGNORE_FEATURE
;
49 if (actions
.password_accepted
) {
50 if (actions
.password_edited
)
51 action
= ACCEPT_AFTER_EDITING
;
53 action
= ACCEPT_ORIGINAL_PASSWORD
;
54 } else if (actions
.learn_more_visited
) {
57 UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.UserActions",
58 action
, ACTION_ENUM_COUNT
);
61 void LogPasswordGenerationEvent(PasswordGenerationEvent event
) {
62 UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.Event",
63 event
, EVENT_ENUM_COUNT
);
66 } // namespace password_generation