Home | History | Annotate | Download | only in common
      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.
      4 
      5 #include "components/autofill/core/common/password_generation_util.h"
      6 
      7 #include "base/metrics/histogram.h"
      8 
      9 namespace autofill {
     10 namespace password_generation {
     11 
     12 PasswordGenerationActions::PasswordGenerationActions()
     13     : learn_more_visited(false),
     14       password_accepted(false),
     15       password_edited(false),
     16       password_regenerated(false) {
     17 }
     18 
     19 PasswordGenerationActions::~PasswordGenerationActions() {
     20 }
     21 
     22 void LogUserActions(PasswordGenerationActions actions) {
     23   UserAction action = IGNORE_FEATURE;
     24   if (actions.password_accepted) {
     25     if (actions.password_edited)
     26       action = ACCEPT_AFTER_EDITING;
     27     else
     28       action = ACCEPT_ORIGINAL_PASSWORD;
     29   } else if (actions.learn_more_visited) {
     30     action = LEARN_MORE;
     31   }
     32   UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.UserActions",
     33                             action, ACTION_ENUM_COUNT);
     34 }
     35 
     36 void LogPasswordGenerationEvent(PasswordGenerationEvent event) {
     37   UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.Event",
     38                             event, EVENT_ENUM_COUNT);
     39 }
     40 
     41 }  // namespace password_generation
     42 }  // namespace autofill
     43