| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_recorder_impl.h" | 5 #include "components/rappor/rappor_recorder_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/rappor/public/rappor_utils.h" | 8 #include "components/rappor/public/rappor_utils.h" |
| 9 #include "components/rappor/rappor_service_impl.h" | 9 #include "components/rappor/rappor_service_impl.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 | 11 |
| 12 namespace rappor { | 12 namespace rappor { |
| 13 | 13 |
| 14 RapporRecorderImpl::RapporRecorderImpl(RapporServiceImpl* rappor_service) | 14 RapporRecorderImpl::RapporRecorderImpl(RapporServiceImpl* rappor_service) |
| 15 : rappor_service_(rappor_service) {} | 15 : rappor_service_(rappor_service) {} |
| 16 | 16 |
| 17 RapporRecorderImpl::~RapporRecorderImpl() = default; | 17 RapporRecorderImpl::~RapporRecorderImpl() = default; |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 void RapporRecorderImpl::Create(RapporServiceImpl* rappor_service, | 20 void RapporRecorderImpl::Create( |
| 21 mojom::RapporRecorderRequest request) { | 21 RapporServiceImpl* rappor_service, |
| 22 const service_manager::BindSourceInfo& source_info, |
| 23 mojom::RapporRecorderRequest request) { |
| 22 mojo::MakeStrongBinding(base::MakeUnique<RapporRecorderImpl>(rappor_service), | 24 mojo::MakeStrongBinding(base::MakeUnique<RapporRecorderImpl>(rappor_service), |
| 23 std::move(request)); | 25 std::move(request)); |
| 24 } | 26 } |
| 25 | 27 |
| 26 void RapporRecorderImpl::RecordRappor(const std::string& metric, | 28 void RapporRecorderImpl::RecordRappor(const std::string& metric, |
| 27 const std::string& sample) { | 29 const std::string& sample) { |
| 28 DCHECK(thread_checker_.CalledOnValidThread()); | 30 DCHECK(thread_checker_.CalledOnValidThread()); |
| 29 SampleString(rappor_service_, metric, ETLD_PLUS_ONE_RAPPOR_TYPE, sample); | 31 SampleString(rappor_service_, metric, ETLD_PLUS_ONE_RAPPOR_TYPE, sample); |
| 30 } | 32 } |
| 31 | 33 |
| 32 void RapporRecorderImpl::RecordRapporURL(const std::string& metric, | 34 void RapporRecorderImpl::RecordRapporURL(const std::string& metric, |
| 33 const GURL& sample) { | 35 const GURL& sample) { |
| 34 DCHECK(thread_checker_.CalledOnValidThread()); | 36 DCHECK(thread_checker_.CalledOnValidThread()); |
| 35 SampleDomainAndRegistryFromGURL(rappor_service_, metric, sample); | 37 SampleDomainAndRegistryFromGURL(rappor_service_, metric, sample); |
| 36 } | 38 } |
| 37 | 39 |
| 38 } // namespace rappor | 40 } // namespace rappor |
| OLD | NEW |