Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "chrome/browser/permissions/permission_uma_util.h" | |
| 11 #include "chrome/common/safe_browsing/permission_report.pb.h" | |
| 12 #include "net/url_request/certificate_report_sender.h" | |
| 13 #include "url/gurl.h" | |
| 14 | |
| 15 namespace net { | |
| 16 class URLRequestContext; | |
| 17 } // namespace net | |
| 18 | |
| 19 namespace safe_browsing { | |
| 20 | |
| 21 // Provides functionality for building and serializing reports about permissions | |
| 22 // to a report collection server. | |
| 23 class PermissionReporter { | |
| 24 public: | |
| 25 // Creates a permission reporter that will send permission reports to | |
| 26 // |upload_url|, using |request_context| as the context for the reports. | |
| 27 PermissionReporter(net::URLRequestContext* request_context, | |
| 28 const GURL& upload_url); | |
| 29 | |
| 30 virtual ~PermissionReporter(); | |
| 31 | |
| 32 // Sends a permission report to the report collection server. The | |
| 33 // |serialized_report| is expected to be a serialized protobuf of type | |
| 34 // PermissionReport defined in | |
| 35 // //src/chrome/common/safe_browsing/permission_report.proto | |
| 36 virtual void SendReport(const std::string& serialized_report); | |
| 37 | |
| 38 // Builds a permission report with |origin| as the origin of the site | |
| 39 // requesting permission, |permission| as the type of permission requested, | |
| 40 // and |action| as the action taken. | |
| 41 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.
| |
| 42 content::PermissionType permission, | |
| 43 PermissionAction action); | |
| 44 | |
| 45 private: | |
| 46 std::unique_ptr<net::CertificateReportSender> permission_report_sender_; | |
| 47 | |
| 48 const GURL upload_url_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(PermissionReporter); | |
| 51 }; | |
| 52 | |
| 53 } // namespace safe_browsing | |
| 54 | |
| 55 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | |
| OLD | NEW |