| 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 RapporService* (*g_GetDefaultService)() = nullptr; |
| 49 |
| 50 RapporService* GetDefaultService() { |
| 51 return (g_GetDefaultService != nullptr) ? g_GetDefaultService() : nullptr; |
| 52 } |
| 53 |
| 54 void SetDefaultServiceAccessor(RapporService* (*getDefaultService)()) { |
| 55 DCHECK(g_GetDefaultService == nullptr); |
| 56 g_GetDefaultService = getDefaultService; |
| 57 } |
| 58 |
| 48 } // namespace rappor | 59 } // namespace rappor |
| OLD | NEW |