Chromium Code Reviews| Index: chrome/browser/password_manager/password_manager_metrics_util.h |
| diff --git a/chrome/browser/password_manager/password_manager_metrics_util.h b/chrome/browser/password_manager/password_manager_metrics_util.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c504b2562f4082d8f0347e0d083153d472329033 |
| --- /dev/null |
| +++ b/chrome/browser/password_manager/password_manager_metrics_util.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_METRICS_UTIL_H_ |
| +#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_METRICS_UTIL_H_ |
| + |
| +#include <string> |
| + |
| +namespace password_manager_metrics_util { |
| + |
| +// We monitor the performance of the save password heuristic for a handful of |
| +// domains. For privacy reasons we are not reporting UMA signals by domain, but |
| +// by a domain group. A domain group can contain multiple domains, and a domain |
| +// can be contained in multiple groups. |
| +// For more information see http://goo.gl/vUuFd5. |
| + |
| +// The number of group in which each monitored website appears. |
|
vabr (Chromium)
2013/09/12 13:40:02
group -> groups
|
| +// It is a half of the total number of groups. |
| +const size_t kGroupsPerDomain = 10u; |
| + |
| +// Check whether the |url_host| is monitored or not. If yes, we return |
| +// the id of the group which contains the domain name otherwise |
| +// returns 0. |
| +unsigned int MonitoredDomainGroupId(const std::string& url_host); |
|
vabr (Chromium)
2013/09/12 13:40:02
As Ilya pointed out, please use size_t, or some un
jdomingos
2013/09/12 16:33:52
Done.
|
| + |
| +// A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name| |
| +// to vary over the program's runtime. |
| +void LogUMAHistogramEnumeration(const std::string& name, |
| + int sample, |
| + int boundary_value); |
| + |
| +// A version of the UMA_HISTOGRAM_COUNTS macro that allows the |name| |
| +// to vary over the program's runtime. |
| +void LogUMAHistogramCounts(const std::string& name, int sample); |
|
vabr (Chromium)
2013/09/12 13:40:02
You don't use this any more. Please remove.
jdomingos
2013/09/12 16:33:52
Done.
|
| + |
| +// A version of the UMA_HISTOGRAM_BOOLEAN macro that allows the |name| |
| +// to vary over the program's runtime. |
| +void LogUMAHistogramBoolean(const std::string& name, bool sample); |
| + |
| +// Generate an id in range [0, |kGroupsPerDomain|). |
| +// If the |g_random_group_id| is equal to its initial value |
| +// (|kGroupsPerDomain|), the value of |g_random_group_id| is changed. |
| +void GenerateRandomId(); |
| + |
| +void SetRandomIdForTesting(unsigned int value); |
|
vabr (Chromium)
2013/09/12 13:40:02
Also please change to a fixed-width unsigned type.
jdomingos
2013/09/12 16:33:52
Done.
|
| + |
| +// Returns a string which contains group_|group_id|. If the |
| +// group_id corresponds to an unmonitored domain returns an empty string. |
| +std::string GroupIdToString(unsigned int group_id); |
|
vabr (Chromium)
2013/09/12 13:40:02
Ditto.
jdomingos
2013/09/12 16:33:52
Done.
|
| + |
| +} // namespace password_manager_metrics_util |
| + |
| +#endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_METRICS_UTIL_H_ |