Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/rappor_recorder_impl.cc

Issue 2376403003: Convert RapporRecorder to use mojo. (Closed)
Patch Set: Convert RapporRecorder to use mojo. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/rappor_recorder_impl.h"
6
7 #include "chrome/browser/browser_process.h"
8 #include "components/rappor/rappor_utils.h"
9 #include "content/public/browser/browser_thread.h"
10 #include "mojo/public/cpp/bindings/strong_binding.h"
11
12 RapporRecorderImpl::RapporRecorderImpl() = default;
13
14 RapporRecorderImpl::~RapporRecorderImpl() = default;
15
16 // static
17 void RapporRecorderImpl::Create(mojom::RapporRecorderRequest request) {
18 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
19 mojo::MakeStrongBinding(base::MakeUnique<RapporRecorderImpl>(),
20 std::move(request));
21 }
22
23 void RapporRecorderImpl::RecordRappor(const std::string& metric,
24 const std::string& sample) {
25 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
26 if (g_browser_process != NULL) {
sky 2016/10/06 17:28:44 nullptr, or just if (g_browser_process). That said
nigeltao1 2016/10/07 03:30:51 As discussed, I've dropped this check.
27 rappor::SampleString(g_browser_process->rappor_service(), metric,
28 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, sample);
29 }
30 }
31
32 void RapporRecorderImpl::RecordRapporURL(const std::string& metric,
33 const GURL& sample) {
34 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
35 if (g_browser_process != NULL) {
36 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
37 metric, sample);
38 }
39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698