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

Side by Side Diff: components/security_interstitials/core/metrics_helper.cc

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix an Android compile error Created 4 years 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
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/security_interstitials/core/metrics_helper.h" 5 #include "components/security_interstitials/core/metrics_helper.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/metrics/user_metrics.h" 11 #include "base/metrics/user_metrics.h"
12 #include "base/metrics/user_metrics_action.h" 12 #include "base/metrics/user_metrics_action.h"
13 #include "components/history/core/browser/history_service.h" 13 #include "components/history/core/browser/history_service.h"
14 #include "components/rappor/public/rappor_utils.h"
14 #include "components/rappor/rappor_service.h" 15 #include "components/rappor/rappor_service.h"
15 #include "components/rappor/rappor_utils.h"
16 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 16 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
17 17
18 using base::RecordAction; 18 using base::RecordAction;
19 using base::UserMetricsAction; 19 using base::UserMetricsAction;
20 20
21 namespace security_interstitials { 21 namespace security_interstitials {
22 22
23 namespace { 23 namespace {
24 24
25 // Used for setting bits in Rappor's "interstitial.*.flags" 25 // Used for setting bits in Rappor's "interstitial.*.flags"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 if (num_visits_ >= 0) { 187 if (num_visits_ >= 0) {
188 int flags = 0; 188 int flags = 0;
189 if (decision == PROCEED) 189 if (decision == PROCEED)
190 flags |= 1 << InterstitialFlagBits::DID_PROCEED; 190 flags |= 1 << InterstitialFlagBits::DID_PROCEED;
191 if (num_visits_ > 0) 191 if (num_visits_ > 0)
192 flags |= 1 << InterstitialFlagBits::IS_REPEAT_VISIT; 192 flags |= 1 << InterstitialFlagBits::IS_REPEAT_VISIT;
193 // e.g. "interstitial.malware.flags" 193 // e.g. "interstitial.malware.flags"
194 sample->SetFlagsField("flags", flags, 194 sample->SetFlagsField("flags", flags,
195 InterstitialFlagBits::HIGHEST_USED_BIT + 1); 195 InterstitialFlagBits::HIGHEST_USED_BIT + 1);
196 } 196 }
197 rappor_service_->RecordSampleObj("interstitial." + rappor_prefix, 197 rappor_service_->RecordSample("interstitial." + rappor_prefix,
198 std::move(sample)); 198 std::move(sample));
199 } 199 }
200 200
201 void MetricsHelper::RecordUserInteraction(Interaction interaction) { 201 void MetricsHelper::RecordUserInteraction(Interaction interaction) {
202 const std::string histogram_name( 202 const std::string histogram_name(
203 "interstitial." + settings_.metric_prefix + ".interaction"); 203 "interstitial." + settings_.metric_prefix + ".interaction");
204 RecordSingleInteractionToMetrics(interaction, histogram_name); 204 RecordSingleInteractionToMetrics(interaction, histogram_name);
205 if (!settings_.extra_suffix.empty()) { 205 if (!settings_.extra_suffix.empty()) {
206 RecordSingleInteractionToMetrics( 206 RecordSingleInteractionToMetrics(
207 interaction, histogram_name + "." + settings_.extra_suffix); 207 interaction, histogram_name + "." + settings_.extra_suffix);
208 } 208 }
(...skipping 11 matching lines...) Expand all
220 } 220 }
221 221
222 void MetricsHelper::OnGotHistoryCount(bool success, 222 void MetricsHelper::OnGotHistoryCount(bool success,
223 int num_visits, 223 int num_visits,
224 base::Time /*first_visit*/) { 224 base::Time /*first_visit*/) {
225 if (success) 225 if (success)
226 num_visits_ = num_visits; 226 num_visits_ = num_visits;
227 } 227 }
228 228
229 } // namespace security_interstitials 229 } // namespace security_interstitials
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698