1 // Copyright 2014 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 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_METRICS_UTIL_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_METRICS_UTIL_H_
12 namespace password_manager {
14 namespace metrics_util {
16 // Metrics: "PasswordManager.InfoBarResponse"
20 NEVER_REMEMBER_PASSWORD,
25 // Metrics: "PasswordBubble.DisplayDisposition"
26 enum UIDisplayDisposition {
27 AUTOMATIC_WITH_PASSWORD_PENDING = 0,
28 MANUAL_WITH_PASSWORD_PENDING,
29 MANUAL_MANAGE_PASSWORDS,
31 AUTOMATIC_GENERATED_PASSWORD_CONFIRMATION,
32 NUM_DISPLAY_DISPOSITIONS
35 // Metrics: "PasswordManager.UIDismissalReason"
36 enum UIDismissalReason {
37 // We use this to mean both "Bubble lost focus" and "No interaction with the
38 // infobar", depending on which experiment is active.
39 NO_DIRECT_INTERACTION = 0,
49 // If we add the omnibox icon _without_ intending to display the bubble,
50 // we actually call Close() after creating the bubble view. We don't want
51 // that to count in the metrics, so we need this placeholder value.
55 // We monitor the performance of the save password heuristic for a handful of
56 // domains. For privacy reasons we are not reporting UMA signals by domain, but
57 // by a domain group. A domain group can contain multiple domains, and a domain
58 // can be contained in multiple groups.
59 // For more information see http://goo.gl/vUuFd5.
61 // The number of groups in which each monitored website appears.
62 // It is a half of the total number of groups.
63 const size_t kGroupsPerDomain = 10u;
65 // Check whether the |url_host| is monitored or not. If yes, we return
66 // the id of the group which contains the domain name otherwise
67 // returns 0. |pref_service| needs to be the profile preference service.
68 size_t MonitoredDomainGroupId(const std::string& url_host,
69 PrefService* pref_service);
71 // A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name|
72 // to vary over the program's runtime.
73 void LogUMAHistogramEnumeration(const std::string& name,
77 // A version of the UMA_HISTOGRAM_BOOLEAN macro that allows the |name|
78 // to vary over the program's runtime.
79 void LogUMAHistogramBoolean(const std::string& name, bool sample);
81 // Returns a string which contains group_|group_id|. If the
82 // |group_id| corresponds to an unmonitored domain returns an empty string.
83 std::string GroupIdToString(size_t group_id);
85 // Log the |reason| a user dismissed the password manager UI.
86 void LogUIDismissalReason(UIDismissalReason reason);
88 // Given a ResponseType, log the appropriate UIResponse. We'll use this
89 // mapping to migrate from "PasswordManager.InfoBarResponse" to
90 // "PasswordManager.UIDismissalReason" so we can accurately evaluate the
91 // impact of the bubble UI.
93 // TODO(mkwst): Drop this (and the infobar metric itself) once the new metric
94 // has rolled out to stable.
95 void LogUIDismissalReason(ResponseType type);
97 // Log the appropriate display disposition.
98 void LogUIDisplayDisposition(UIDisplayDisposition disposition);
100 } // namespace metrics_util
102 } // namespace password_manager
104 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_METRICS_UTIL_H_