Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| OLD | NEW |