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

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

Issue 2024753002: Add permission reporter skeleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@protocol-buffer-for-permission-reports
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/permission_reporter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/permission_reporter.h
diff --git a/chrome/browser/safe_browsing/permission_reporter.h b/chrome/browser/safe_browsing/permission_reporter.h
new file mode 100644
index 0000000000000000000000000000000000000000..34d916ae82035535020f6cf17f1f1fa423c262e0
--- /dev/null
+++ b/chrome/browser/safe_browsing/permission_reporter.h
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_
+#define CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_
+
+#include <string>
+
+#include "chrome/browser/permissions/permission_uma_util.h"
+#include "chrome/common/safe_browsing/permission_report.pb.h"
+#include "net/url_request/certificate_report_sender.h"
+#include "url/gurl.h"
+
+namespace net {
+class URLRequestContext;
+} // namespace net
+
+namespace safe_browsing {
+
+// Provides functionality for building and serializing reports about permissions
+// to a report collection server.
+class PermissionReporter {
+ public:
+ // Creates a permission reporter that will send permission reports to
+ // |upload_url|, using |request_context| as the context for the reports.
+ PermissionReporter(net::URLRequestContext* request_context,
+ const GURL& upload_url);
+
+ virtual ~PermissionReporter();
+
+ // Sends a permission report to the report collection server. The
+ // |serialized_report| is expected to be a serialized protobuf of type
+ // PermissionReport defined in
+ // //src/chrome/common/safe_browsing/permission_report.proto
+ virtual void SendReport(const std::string& serialized_report);
+
+ // Builds a permission report with |origin| as the origin of the site
+ // requesting permission, |permission| as the type of permission requested,
+ // and |action| as the action taken.
+ static PermissionReport BuildReport(const GURL& origin,
stefanocs 2016/05/31 04:17:56 Would it be better for this function to return a s
kcarattini 2016/05/31 04:27:34 Yes, good call.
stefanocs 2016/05/31 04:43:38 Done.
+ content::PermissionType permission,
+ PermissionAction action);
+
+ private:
+ std::unique_ptr<net::CertificateReportSender> permission_report_sender_;
+
+ const GURL upload_url_;
+
+ DISALLOW_COPY_AND_ASSIGN(PermissionReporter);
+};
+
+} // namespace safe_browsing
+
+#endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/permission_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698