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 "url/gurl.h" | |
12 | |
13 namespace net { | |
14 class URLRequestContext; | |
15 } // namespace net | |
16 | |
17 namespace safe_browsing { | |
18 | |
19 // Provides functionality for building and serializing reports about permissions | |
20 // to a report collection server. | |
21 class PermissionReporter { | |
22 public: | |
23 // Creates a permission reporter that will send permission reports to | |
24 // the SafeBrowsing permission action server, using |request_context| as the | |
25 // context for the reports. | |
26 explicit PermissionReporter(net::URLRequestContext* request_context); | |
27 | |
28 ~PermissionReporter(); | |
29 | |
30 // Sends a permission report to the report collection server. The | |
31 // |serialized_report| is expected to be a serialized protobuf of type | |
32 // PermissionReport defined in | |
33 // //src/chrome/common/safe_browsing/permission_report.proto | |
34 void SendReport(const std::string& serialized_report); | |
raymes
2016/06/01 06:45:45
nit: I wonder if SendReport should just call Build
kcarattini
2016/06/01 12:25:49
Yup, that could work. BuildReport should remain a
stefanocs
2016/06/02 00:24:32
Then SendReport signature should be modified to ha
stefanocs
2016/06/02 04:31:04
Done.
| |
35 | |
36 // Builds and serializes a permission report with |origin| as the origin of | |
37 // the site requesting permission, |permission| as the type of permission | |
38 // requested, and |action| as the action taken. The serialized report is | |
39 // written into |output|. Returns true if the serialization was successful and | |
40 // false otherwise. | |
41 static bool BuildReport(const GURL& origin, | |
42 content::PermissionType permission, | |
raymes
2016/06/01 06:45:44
nit: #include permission_type.h
stefanocs
2016/06/01 07:25:02
Done.
| |
43 PermissionAction action, | |
44 std::string* output); | |
45 | |
46 private: | |
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 |