Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/rappor/rappor_utils.h" | 5 #include "components/rappor/rappor_utils.h" |
| 6 | 6 |
| 7 #include "components/rappor/rappor_service.h" | 7 #include "components/rappor/rappor_service.h" |
| 8 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 8 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 9 #include "net/base/url_util.h" | 9 #include "net/base/url_util.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 const std::string& metric, | 38 const std::string& metric, |
| 39 const GURL& gurl) { | 39 const GURL& gurl) { |
| 40 if (!rappor_service) | 40 if (!rappor_service) |
| 41 return; | 41 return; |
| 42 rappor_service->RecordSample( | 42 rappor_service->RecordSample( |
| 43 metric, | 43 metric, |
| 44 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, | 44 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 45 GetDomainAndRegistrySampleFromGURL(gurl)); | 45 GetDomainAndRegistrySampleFromGURL(gurl)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void TrySampleDomainAndRegistryWithDefaultService(const std::string& metric, | |
|
ddorwin
2016/11/28 21:45:42
Since we don't even check whether there is a defau
billorr
2016/11/28 23:13:03
Done.
| |
| 49 const GURL& gurl) { | |
| 50 RapporService* defaultService = TryGetDefaultService(); | |
| 51 SampleDomainAndRegistryFromGURL(defaultService, metric, gurl); | |
| 52 } | |
| 53 | |
| 54 RapporService* TryGetDefaultService() { | |
| 55 return (GetDefaultService != nullptr) ? GetDefaultService() : nullptr; | |
| 56 } | |
| 57 | |
| 58 RapporService* (*GetDefaultService)() = nullptr; | |
| 59 | |
| 48 } // namespace rappor | 60 } // namespace rappor |
| OLD | NEW |