Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/common/password_generation_util.cc

Issue 10787023: Adding UMA stats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More comments. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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.
4
5 #include "chrome/common/password_generation_util.h"
6
7 #include "base/metrics/histogram.h"
8
9 namespace {
10
11 // Enumerates user actions after password generation bubble is shown.
12 enum UserAction {
13 // User closes the bubble without any meaningful actions (e.g. use backspace
14 // key, close the bubble, click outside the bubble, etc).
15 IGNORE,
16
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.
20 LEARN_MORE,
21
22 // User accepts the generated password without manually editing it (but
23 // including changing it through the regenerate button).
24 ACCEPT_ORIGINAL_PASSWORD,
25
26 // User accepts the gererated password after manually editing it.
27 ACCEPT_AFTER_EDITING,
28
29 // Number of enum entries, used for UMA histogram reporting macros.
30 ACTION_ENUM_COUNT,
31 };
32
33 }
34
35 namespace password_generation {
36
37 PasswordGenerationActions::PasswordGenerationActions()
38 : learn_more_visited(false),
39 password_accepted(false),
40 password_edited(false),
41 password_regenerated(false) {
42 }
43
44 PasswordGenerationActions::~PasswordGenerationActions() {
45 }
46
47 void LogUserActions(PasswordGenerationActions actions) {
48 UserAction action;
jar (doing other things) 2012/07/19 00:05:42 personal nit: I'd rather see this initialized to I
zysxqn 2012/07/19 18:49:29 Done.
49 if (actions.password_accepted) {
50 if (actions.password_edited)
51 action = ACCEPT_AFTER_EDITING;
52 else
53 action = ACCEPT_ORIGINAL_PASSWORD;
54 } else if (actions.learn_more_visited) {
55 action = LEARN_MORE;
56 } else {
57 action = IGNORE;
58 }
59 UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.UserActions",
60 action, ACTION_ENUM_COUNT);
61 }
62
63 void LogPasswordGenerationEvent(PasswordGenerationEvent event) {
64 UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.Events",
65 event, EVENT_ENUM_COUNT);
66 }
67
68 } // namespace password_generation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698