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

Unified Diff: chrome/browser/safe_browsing/permission_reporter.cc

Issue 2075523002: Add SourceUI field to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove sourceui except from PermissionRevoked Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/permission_reporter.cc
diff --git a/chrome/browser/safe_browsing/permission_reporter.cc b/chrome/browser/safe_browsing/permission_reporter.cc
index 944411149f1a9480811bc0dee25489cde61da453..df0568385e27ca4742ac34775db52c30c1ce0685 100644
--- a/chrome/browser/safe_browsing/permission_reporter.cc
+++ b/chrome/browser/safe_browsing/permission_reporter.cc
@@ -73,6 +73,25 @@ PermissionReport::Action PermissionActionForReport(PermissionAction action) {
return PermissionReport::ACTION_UNSPECIFIED;
}
+PermissionReport::SourceUI SourceUIToPermissionReportSourceUI(
+ SourceUI source_ui) {
+ switch (source_ui) {
+ case PROMPT:
+ return PermissionReport::PROMPT;
+ case OIB:
+ return PermissionReport::OIB;
+ case SITE_SETTINGS:
+ return PermissionReport::SITE_SETTINGS;
+ case PAGE_ACTION:
+ return PermissionReport::PAGE_ACTION;
+ case SOURCE_UI_NUM:
+ break;
+ }
+
+ NOTREACHED();
+ return PermissionReport::SOURCE_UI_UNSPECIFIED;
+}
+
} // namespace
PermissionReporter::PermissionReporter(net::URLRequestContext* request_context)
@@ -88,9 +107,10 @@ PermissionReporter::~PermissionReporter() {}
void PermissionReporter::SendReport(const GURL& origin,
content::PermissionType permission,
- PermissionAction action) {
+ PermissionAction action,
+ SourceUI source_ui) {
std::string serialized_report;
- BuildReport(origin, permission, action, &serialized_report);
+ BuildReport(origin, permission, action, source_ui, &serialized_report);
permission_report_sender_->Send(GURL(kPermissionActionReportingUploadUrl),
serialized_report);
}
@@ -99,11 +119,13 @@ void PermissionReporter::SendReport(const GURL& origin,
bool PermissionReporter::BuildReport(const GURL& origin,
PermissionType permission,
PermissionAction action,
+ SourceUI source_ui,
std::string* output) {
PermissionReport report;
report.set_origin(origin.spec());
report.set_permission(PermissionTypeForReport(permission));
report.set_action(PermissionActionForReport(action));
+ report.set_source_ui(SourceUIToPermissionReportSourceUI(source_ui));
// Collect platform data.
#if defined(OS_ANDROID)

Powered by Google App Engine
This is Rietveld 408576698