Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: chrome/browser/safe_browsing/permission_reporter.h

Issue 2075523002: Add SourceUI field to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment + TODO Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 8 #include <string>
9 9
10 #include "chrome/browser/permissions/permission_uma_util.h" 10 #include "chrome/browser/permissions/permission_uma_util.h"
(...skipping 18 matching lines...) Expand all
29 ~PermissionReporter(); 29 ~PermissionReporter();
30 30
31 // Sends a serialized permission report to the report collection server. 31 // Sends a serialized permission report to the report collection server.
32 // The permission report includes |origin| as the origin of 32 // The permission report includes |origin| as the origin of
33 // the site requesting permission, |permission| as the type of permission 33 // the site requesting permission, |permission| as the type of permission
34 // requested, and |action| as the action taken. The report will be serialized 34 // requested, and |action| as the action taken. The report will be serialized
35 // using protobuf defined in 35 // using protobuf defined in
36 // //src/chrome/common/safe_browsing/permission_report.proto 36 // //src/chrome/common/safe_browsing/permission_report.proto
37 void SendReport(const GURL& origin, 37 void SendReport(const GURL& origin,
38 content::PermissionType permission, 38 content::PermissionType permission,
39 PermissionAction action); 39 PermissionAction action,
40 SourceUI source_ui);
40 41
41 private: 42 private:
42 friend class PermissionReporterTest; 43 friend class PermissionReporterTest;
43 44
44 // Used by tests. This constructor allows tests to have access to the 45 // Used by tests. This constructor allows tests to have access to the
45 // ReportSender. 46 // ReportSender.
46 explicit PermissionReporter(std::unique_ptr<net::ReportSender> report_sender); 47 explicit PermissionReporter(std::unique_ptr<net::ReportSender> report_sender);
47 48
48 // Builds and serializes a permission report with |origin| as the origin of 49 // Builds and serializes a permission report with |origin| as the origin of
49 // the site requesting permission, |permission| as the type of permission 50 // the site requesting permission, |permission| as the type of permission
50 // requested, and |action| as the action taken. The serialized report is 51 // requested, and |action| as the action taken. The serialized report is
51 // written into |output|. Returns true if the serialization was successful and 52 // written into |output|. Returns true if the serialization was successful and
52 // false otherwise. 53 // false otherwise.
53 static bool BuildReport(const GURL& origin, 54 static bool BuildReport(const GURL& origin,
54 content::PermissionType permission, 55 content::PermissionType permission,
55 PermissionAction action, 56 PermissionAction action,
57 SourceUI source_ui,
56 std::string* output); 58 std::string* output);
57 59
58 std::unique_ptr<net::ReportSender> permission_report_sender_; 60 std::unique_ptr<net::ReportSender> permission_report_sender_;
59 61
60 DISALLOW_COPY_AND_ASSIGN(PermissionReporter); 62 DISALLOW_COPY_AND_ASSIGN(PermissionReporter);
61 }; 63 };
62 64
63 } // namespace safe_browsing 65 } // namespace safe_browsing
64 66
65 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_ 67 #endif // CHROME_BROWSER_SAFE_BROWSING_PERMISSION_REPORTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698