Commit 8b5968a8 authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

Remove permission RAPPOR metrics

The permission RAPPOR metrics have long been supplanted by permission
action reporting metrics (via the safebrowsing service). This patch
removes the RAPPOR logging which we no longer need.

Bug: 605836
Change-Id: Ibdbb394a074d5c1543538a2ffab44617481d2417
Reviewed-on: https://chromium-review.googlesource.com/765561Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: Timothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516104}
parent 0099e02b
......@@ -207,8 +207,8 @@ void PermissionContextBase::ContinueRequestPermission(
}
// We are going to show a prompt now.
PermissionUmaUtil::PermissionRequested(
content_settings_type_, requesting_origin, embedding_origin, profile_);
PermissionUmaUtil::PermissionRequested(content_settings_type_,
requesting_origin);
PermissionUmaUtil::RecordEmbargoPromptSuppression(
PermissionEmbargoStatus::NOT_EMBARGOED);
......
......@@ -9,7 +9,6 @@
#include "base/command_line.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
......@@ -25,8 +24,6 @@
#include "chrome/common/pref_names.h"
#include "components/browser_sync/profile_sync_service.h"
#include "components/prefs/pref_service.h"
#include "components/rappor/public/rappor_utils.h"
#include "components/rappor/rappor_service_impl.h"
#include "content/public/browser/permission_type.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/origin_util.h"
......@@ -128,87 +125,6 @@ void RecordEngagementMetric(const std::vector<PermissionRequest*>& requests,
base::UmaHistogramPercentage(name, engagement_score);
}
const std::string GetRapporMetric(ContentSettingsType permission,
PermissionAction action) {
std::string action_str;
switch (action) {
case PermissionAction::GRANTED:
action_str = "Granted";
break;
case PermissionAction::DENIED:
action_str = "Denied";
break;
case PermissionAction::DISMISSED:
action_str = "Dismissed";
break;
case PermissionAction::IGNORED:
action_str = "Ignored";
break;
case PermissionAction::REVOKED:
action_str = "Revoked";
break;
default:
NOTREACHED();
break;
}
std::string permission_str = PermissionUtil::GetPermissionString(permission);
if (permission_str.empty())
return "";
return base::StringPrintf("ContentSettings.PermissionActions_%s.%s.Url2",
permission_str.c_str(), action_str.c_str());
}
void RecordPermissionRequest(ContentSettingsType content_type,
const GURL& requesting_origin,
const GURL& embedding_origin,
Profile* profile) {
rappor::RapporServiceImpl* rappor_service =
g_browser_process->rappor_service();
if (rappor_service) {
if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
rappor_service->RecordSampleString(
"ContentSettings.PermissionRequested.Geolocation.Url2",
rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
} else if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
rappor_service->RecordSampleString(
"ContentSettings.PermissionRequested.Notifications.Url2",
rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
} else if (content_type == CONTENT_SETTINGS_TYPE_MIDI ||
content_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) {
rappor_service->RecordSampleString(
"ContentSettings.PermissionRequested.Midi.Url2",
rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
} else if (content_type ==
CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) {
rappor_service->RecordSampleString(
"ContentSettings.PermissionRequested.ProtectedMedia.Url2",
rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
}
}
PermissionType permission;
bool success = PermissionUtil::GetPermissionType(content_type, &permission);
DCHECK(success);
bool secure_origin = content::IsOriginSecure(requesting_origin);
UMA_HISTOGRAM_ENUMERATION("ContentSettings.PermissionRequested", permission,
PermissionType::NUM);
if (secure_origin) {
UMA_HISTOGRAM_ENUMERATION(
"ContentSettings.PermissionRequested_SecureOrigin", permission,
PermissionType::NUM);
} else {
UMA_HISTOGRAM_ENUMERATION(
"ContentSettings.PermissionRequested_InsecureOrigin", permission,
PermissionType::NUM);
}
}
} // anonymous namespace
// PermissionReportInfo -------------------------------------------------------
......@@ -278,11 +194,23 @@ const char
// Make sure you update histograms.xml permission histogram_suffix if you
// add new permission
void PermissionUmaUtil::PermissionRequested(ContentSettingsType content_type,
const GURL& requesting_origin,
const GURL& embedding_origin,
Profile* profile) {
RecordPermissionRequest(content_type, requesting_origin, embedding_origin,
profile);
const GURL& requesting_origin) {
PermissionType permission;
bool success = PermissionUtil::GetPermissionType(content_type, &permission);
DCHECK(success);
bool secure_origin = content::IsOriginSecure(requesting_origin);
UMA_HISTOGRAM_ENUMERATION("ContentSettings.PermissionRequested", permission,
PermissionType::NUM);
if (secure_origin) {
UMA_HISTOGRAM_ENUMERATION(
"ContentSettings.PermissionRequested_SecureOrigin", permission,
PermissionType::NUM);
} else {
UMA_HISTOGRAM_ENUMERATION(
"ContentSettings.PermissionRequested_InsecureOrigin", permission,
PermissionType::NUM);
}
}
void PermissionUmaUtil::PermissionGranted(
......@@ -724,15 +652,6 @@ void PermissionUmaUtil::RecordPermissionAction(
<< PermissionUtil::GetPermissionString(permission)
<< " not accounted for";
}
const std::string rappor_metric = GetRapporMetric(permission, action);
rappor::RapporServiceImpl* rappor_service =
g_browser_process->rappor_service();
if (!rappor_metric.empty() && rappor_service) {
rappor_service->RecordSampleString(
rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
}
}
// static
......
......@@ -7,13 +7,11 @@
#include <vector>
#include "base/logging.h"
#include "base/macros.h"
#include "base/time/time.h"
#include "chrome/browser/permissions/permission_request.h"
#include "chrome/browser/permissions/permission_result.h"
#include "chrome/browser/permissions/permission_util.h"
#include "content/public/browser/permission_type.h"
namespace content {
class WebContents;
......@@ -111,9 +109,7 @@ class PermissionUmaUtil {
static const char kPermissionsPromptIgnoredPriorIgnoreCountPrefix[];
static void PermissionRequested(ContentSettingsType permission,
const GURL& requesting_origin,
const GURL& embedding_origin,
Profile* profile);
const GURL& requesting_origin);
static void PermissionGranted(ContentSettingsType permission,
PermissionRequestGestureType gesture_type,
const GURL& requesting_origin,
......
......@@ -15,9 +15,8 @@
using content::PermissionType;
// The returned strings must match the RAPPOR metrics in rappor.xml,
// and any Field Trial configs for the Permissions kill switch e.g.
// Permissions.Action.Geolocation etc..
// The returned strings must match any Field Trial configs for the Permissions
// kill switch e.g. Permissions.Action.Geolocation etc..
std::string PermissionUtil::GetPermissionString(
ContentSettingsType content_type) {
switch (content_type) {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment