By moving the call to Load() up in SearchProvider::Start(), we are giving a chance...
[chromium-blink-merge.git] / chrome / common / password_generation_util.cc
blobf6f702723dc5f4acb9425e6d335b45e3f9c86963
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"
9 namespace {
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_FEATURE,
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,
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.
27 ACCEPT_AFTER_EDITING,
29 // Number of enum entries, used for UMA histogram reporting macros.
30 ACTION_ENUM_COUNT
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;
52 else
53 action = ACCEPT_ORIGINAL_PASSWORD;
54 } else if (actions.learn_more_visited) {
55 action = LEARN_MORE;
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