Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / password_manager / password_manager_metrics_util.h
blob6f336dce3be10c5952391ccbc381ef23a9ad69eb
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.
5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_METRICS_UTIL_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_METRICS_UTIL_H_
8 #include <string>
10 class PrefService;
12 namespace password_manager_metrics_util {
14 // We monitor the performance of the save password heuristic for a handful of
15 // domains. For privacy reasons we are not reporting UMA signals by domain, but
16 // by a domain group. A domain group can contain multiple domains, and a domain
17 // can be contained in multiple groups.
18 // For more information see http://goo.gl/vUuFd5.
20 // The number of groups in which each monitored website appears.
21 // It is a half of the total number of groups.
22 const size_t kGroupsPerDomain = 10u;
24 // Check whether the |url_host| is monitored or not. If yes, we return
25 // the id of the group which contains the domain name otherwise
26 // returns 0. |pref_service| needs to be the profile preference service.
27 size_t MonitoredDomainGroupId(const std::string& url_host,
28 PrefService* pref_service);
30 // A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name|
31 // to vary over the program's runtime.
32 void LogUMAHistogramEnumeration(const std::string& name,
33 int sample,
34 int boundary_value);
36 // A version of the UMA_HISTOGRAM_BOOLEAN macro that allows the |name|
37 // to vary over the program's runtime.
38 void LogUMAHistogramBoolean(const std::string& name, bool sample);
40 // Returns a string which contains group_|group_id|. If the
41 // |group_id| corresponds to an unmonitored domain returns an empty string.
42 std::string GroupIdToString(size_t group_id);
44 } // namespace password_manager_metrics_util
46 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_METRICS_UTIL_H_