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) |