| 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 d0364bcda25efd32910ce1bd1c9ab355edb9ced8..29223c0ef9d26626762da7c717c9292c2be3156e 100644
|
| --- a/chrome/browser/safe_browsing/permission_reporter.cc
|
| +++ b/chrome/browser/safe_browsing/permission_reporter.cc
|
| @@ -72,6 +72,25 @@ PermissionReport::Action PermissionActionToPermissionReportAction(
|
| 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)
|
| @@ -87,9 +106,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);
|
| }
|
| @@ -98,11 +118,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(PermissionTypeToPermissionReportPermission(permission));
|
| report.set_action(PermissionActionToPermissionReportAction(action));
|
| + report.set_source_ui(SourceUIToPermissionReportSourceUI(source_ui));
|
| // TODO(stefanocs): Collect other data for the report from global variables.
|
| return report.SerializeToString(output);
|
| }
|
|
|