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 "net/url_request/certificate_report_sender.h" | |
| 12 #include "url/gurl.h" | |
| 13 | |
| 14 namespace net { | |
| 15 class URLRequestContext; | |
| 16 } // namespace net | |
| 17 | |
| 18 namespace safe_browsing { | |
| 19 | |
| 20 // Provides functionality for building and serializing reports about permissions | |
| 21 // to a report collection server. | |
| 22 class PermissionReporter { | |
| 23 public: | |
| 24 // Creates a permission reporter that will send permission reports to | |
| 25 // |upload_url|, using |request_context| as the context for the reports. | |
| 26 PermissionReporter(net::URLRequestContext* request_context, | |
| 27 const GURL& upload_url); | |
| 28 | |
| 29 virtual ~PermissionReporter(); | |
| 30 | |
| 31 // Sends a permission report to the report collection server. The | |
| 32 // |serialized_report| is expected to be a serialized protobuf of type | |
| 33 // PermissionReport defined in | |
| 34 // //src/chrome/common/safe_browsing/permission_report.proto | |
| 35 virtual void SendReport(const std::string& serialized_report); | |
| 36 | |
| 37 // Builds and serializes a permission report with |origin| as the origin of | |
| 38 // the site requesting permission, |permission| as the type of permission | |
| 39 // requested, and |action| as the action taken. | |
| 40 static std::string BuildReport(const GURL& origin, | |
| 41 content::PermissionType permission, | |
| 42 PermissionAction action); | |
|
kcarattini
2016/05/31 04:56:22
Actually, you can add a final argument which is a
stefanocs
2016/05/31 05:05:26
Yes, I can do that. Do you think it should returns
kcarattini
2016/05/31 07:02:28
Sure you can return the return value of SerializeT
stefanocs
2016/05/31 07:06:07
Done.
| |
| 43 | |
| 44 private: | |
| 45 std::unique_ptr<net::CertificateReportSender> permission_report_sender_; | |
| 46 | |
| 47 const GURL upload_url_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(PermissionReporter); | |
| 50 }; | |
| 51 | |
| 52 } // namespace safe_browsing | |
| 53 | |
| 54 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | |
| OLD | NEW |