| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // request triggers if the action occurred after a user gesture. The report | 54 // request triggers if the action occurred after a user gesture. The report |
| 55 // will be serialized using protobuf defined in | 55 // will be serialized using protobuf defined in |
| 56 // //src/chrome/common/safe_browsing/permission_report.proto | 56 // //src/chrome/common/safe_browsing/permission_report.proto |
| 57 void SendReport(const GURL& origin, | 57 void SendReport(const GURL& origin, |
| 58 content::PermissionType permission, | 58 content::PermissionType permission, |
| 59 PermissionAction action, | 59 PermissionAction action, |
| 60 PermissionSourceUI source_ui, | 60 PermissionSourceUI source_ui, |
| 61 bool user_gesture); | 61 bool user_gesture); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 friend class PermissionReporterBrowserTest; |
| 64 friend class PermissionReporterTest; | 65 friend class PermissionReporterTest; |
| 65 | 66 |
| 66 // Used by tests. This constructor allows tests to have access to the | 67 // Used by tests. This constructor allows tests to have access to the |
| 67 // ReportSender and use a test Clock. | 68 // ReportSender and use a test Clock. |
| 68 PermissionReporter(std::unique_ptr<net::ReportSender> report_sender, | 69 PermissionReporter(std::unique_ptr<net::ReportSender> report_sender, |
| 69 std::unique_ptr<base::Clock> clock); | 70 std::unique_ptr<base::Clock> clock); |
| 70 | 71 |
| 71 // Builds and serializes a permission report with |origin| as the origin of | 72 // Builds and serializes a permission report with |origin| as the origin of |
| 72 // the site requesting permission, |permission| as the type of permission | 73 // the site requesting permission, |permission| as the type of permission |
| 73 // requested, and |action| as the action taken. The serialized report is | 74 // requested, and |action| as the action taken. The serialized report is |
| (...skipping 22 matching lines...) Expand all Loading... |
| 96 report_logs_; | 97 report_logs_; |
| 97 | 98 |
| 98 std::unique_ptr<base::Clock> clock_; | 99 std::unique_ptr<base::Clock> clock_; |
| 99 | 100 |
| 100 DISALLOW_COPY_AND_ASSIGN(PermissionReporter); | 101 DISALLOW_COPY_AND_ASSIGN(PermissionReporter); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace safe_browsing | 104 } // namespace safe_browsing |
| 104 | 105 |
| 105 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ | 106 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ |
| OLD | NEW |