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

Unified Diff: components/security_interstitials/core/metrics_helper.cc

Issue 2575623002: Componentizing SafeBrowsingBlockingPage Part 1 (Closed)
Patch Set: address comments from nparker@ 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 side-by-side diff with in-line comments
Download patch
Index: components/security_interstitials/core/metrics_helper.cc
diff --git a/components/security_interstitials/core/metrics_helper.cc b/components/security_interstitials/core/metrics_helper.cc
index 6ec4ce0c21d2075a3fdaed640295a5f11514c66a..2b9f51cf1c0d0c48833e12d90fa9d4ba4d74ccb0 100644
--- a/components/security_interstitials/core/metrics_helper.cc
+++ b/components/security_interstitials/core/metrics_helper.cc
@@ -11,8 +11,6 @@
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "components/history/core/browser/history_service.h"
-#include "components/rappor/public/rappor_utils.h"
-#include "components/rappor/rappor_service_impl.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
using base::RecordAction;
@@ -22,13 +20,6 @@ namespace security_interstitials {
namespace {
-// Used for setting bits in Rappor's "interstitial.*.flags"
-enum InterstitialFlagBits {
- DID_PROCEED = 0,
- IS_REPEAT_VISIT = 1,
- HIGHEST_USED_BIT = 1
-};
-
// Directly adds to the UMA histograms, using the same properties as
// UMA_HISTOGRAM_ENUMERATION, because the macro doesn't allow non-constant
// histogram names.
@@ -108,27 +99,18 @@ void MaybeRecordInteractionAsAction(MetricsHelper::Interaction interaction,
MetricsHelper::~MetricsHelper() {}
-MetricsHelper::ReportDetails::ReportDetails()
- : rappor_report_type(rappor::NUM_RAPPOR_TYPES) {}
+MetricsHelper::ReportDetails::ReportDetails() {}
MetricsHelper::ReportDetails::ReportDetails(const ReportDetails& other) =
default;
MetricsHelper::ReportDetails::~ReportDetails() {}
-MetricsHelper::MetricsHelper(
- const GURL& request_url,
- const ReportDetails settings,
- history::HistoryService* history_service,
- const base::WeakPtr<rappor::RapporService>& rappor_service)
- : request_url_(request_url),
- settings_(settings),
- rappor_service_(rappor_service),
- num_visits_(-1) {
+MetricsHelper::MetricsHelper(const GURL& request_url,
+ const ReportDetails settings,
+ history::HistoryService* history_service)
+ : request_url_(request_url), settings_(settings), num_visits_(-1) {
DCHECK(!settings_.metric_prefix.empty());
- if (settings_.rappor_report_type == rappor::NUM_RAPPOR_TYPES) // Default.
- rappor_service_.reset();
- DCHECK(!rappor_service_ || !settings_.rappor_prefix.empty());
if (history_service) {
history_service->GetVisibleVisitCountToHost(
request_url_,
@@ -150,10 +132,6 @@ void MetricsHelper::RecordUserDecision(Decision decision) {
}
MaybeRecordDecisionAsAction(decision, settings_.metric_prefix);
- RecordUserDecisionToRappor(decision, settings_.rappor_report_type,
- settings_.rappor_prefix);
- RecordUserDecisionToRappor(decision, settings_.deprecated_rappor_report_type,
- settings_.deprecated_rappor_prefix);
RecordExtraUserDecisionMetrics(decision);
}
@@ -168,36 +146,6 @@ void MetricsHelper::RecordUserDecisionToMetrics(
}
}
-void MetricsHelper::RecordUserDecisionToRappor(
- Decision decision,
- const rappor::RapporType rappor_report_type,
- const std::string& rappor_prefix) {
- if (!rappor_service_ || (decision != PROCEED && decision != DONT_PROCEED))
- return;
-
- std::unique_ptr<rappor::Sample> sample =
- rappor_service_->CreateSample(rappor_report_type);
-
- // This will populate, for example, "intersitial.malware2.domain" or
- // "interstitial.ssl3.domain". The domain will be empty for hosts w/o TLDs.
- sample->SetStringField(
- "domain", rappor::GetDomainAndRegistrySampleFromGURL(request_url_));
-
- // Only report history and decision if we have history data.
- if (num_visits_ >= 0) {
- int flags = 0;
- if (decision == PROCEED)
- flags |= 1 << InterstitialFlagBits::DID_PROCEED;
- if (num_visits_ > 0)
- flags |= 1 << InterstitialFlagBits::IS_REPEAT_VISIT;
- // e.g. "interstitial.malware.flags"
- sample->SetFlagsField("flags", flags,
- InterstitialFlagBits::HIGHEST_USED_BIT + 1);
- }
- rappor_service_->RecordSample("interstitial." + rappor_prefix,
- std::move(sample));
-}
-
void MetricsHelper::RecordUserInteraction(Interaction interaction) {
const std::string histogram_name(
"interstitial." + settings_.metric_prefix + ".interaction");

Powered by Google App Engine
This is Rietveld 408576698