OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // the action occurred after a user gesture. The report will be serialized | 55 // the action occurred after a user gesture. The report will be serialized |
56 // using protobuf defined in | 56 // using protobuf defined in |
57 // //src/chrome/common/safe_browsing/permission_report.proto | 57 // //src/chrome/common/safe_browsing/permission_report.proto |
58 void SendReport(const GURL& origin, | 58 void SendReport(const GURL& origin, |
59 content::PermissionType permission, | 59 content::PermissionType permission, |
60 PermissionAction action, | 60 PermissionAction action, |
61 PermissionSourceUI source_ui, | 61 PermissionSourceUI source_ui, |
62 PermissionRequestGestureType gesture_type); | 62 PermissionRequestGestureType gesture_type); |
63 | 63 |
64 private: | 64 private: |
| 65 friend class PermissionReporterBrowserTest; |
65 friend class PermissionReporterTest; | 66 friend class PermissionReporterTest; |
66 | 67 |
67 // Used by tests. This constructor allows tests to have access to the | 68 // Used by tests. This constructor allows tests to have access to the |
68 // ReportSender and use a test Clock. | 69 // ReportSender and use a test Clock. |
69 PermissionReporter(std::unique_ptr<net::ReportSender> report_sender, | 70 PermissionReporter(std::unique_ptr<net::ReportSender> report_sender, |
70 std::unique_ptr<base::Clock> clock); | 71 std::unique_ptr<base::Clock> clock); |
71 | 72 |
72 // Builds and serializes a permission report with |origin| as the origin of | 73 // Builds and serializes a permission report with |origin| as the origin of |
73 // the site requesting permission, |permission| as the type of permission | 74 // the site requesting permission, |permission| as the type of permission |
74 // requested, and |action| as the action taken. The serialized report is | 75 // requested, and |action| as the action taken. The serialized report is |
(...skipping 22 matching lines...) Expand all Loading... |
97 report_logs_; | 98 report_logs_; |
98 | 99 |
99 std::unique_ptr<base::Clock> clock_; | 100 std::unique_ptr<base::Clock> clock_; |
100 | 101 |
101 DISALLOW_COPY_AND_ASSIGN(PermissionReporter); | 102 DISALLOW_COPY_AND_ASSIGN(PermissionReporter); |
102 }; | 103 }; |
103 | 104 |
104 } // namespace safe_browsing | 105 } // namespace safe_browsing |
105 | 106 |
106 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | 107 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |
OLD | NEW |