Chromium Code Reviews| Index: components/rappor/rappor_utils.cc |
| diff --git a/components/rappor/rappor_utils.cc b/components/rappor/rappor_utils.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..441ed44bd99c94bc9dc9510ce55d6f73236bacc3 |
| --- /dev/null |
| +++ b/components/rappor/rappor_utils.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2014 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. |
| + |
| +#include "components/rappor/rappor_utils.h" |
| + |
| +#include "components/rappor/rappor_service.h" |
| +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| + |
| +namespace rappor { |
| + |
| +void SampleETLDp1FromGURL(RapporService* service, |
| + const std::string& metric, |
| + const GURL& gurl) { |
| + if (!service) |
| + return; |
| + service->RecordSample(metric, |
| + rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, |
|
Peter Kasting
2014/06/05 23:37:14
Nit: All lines of args must be indented the same.
Steven Holte
2014/06/06 01:54:25
Done.
|
| + net::registry_controlled_domains::GetDomainAndRegistry(gurl, |
| + net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); |
| +} |
| + |
| +void SampleETLDp1FromHost(RapporService* service, |
| + const std::string& metric, |
| + const std::string& host) { |
| + if (!service) |
| + return; |
| + service->RecordSample(metric, |
| + rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, |
| + net::registry_controlled_domains::GetDomainAndRegistry(host, |
| + net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); |
| +} |
| + |
| +} // namespace rappor |