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

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

Issue 2648713002: Add response code to the success callback of ReportSender (Closed)
Patch Set: eroman and estark comments Created 3 years, 7 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 #include "chrome/browser/safe_browsing/permission_reporter.h" 5 #include "chrome/browser/safe_browsing/permission_reporter.h"
6 6
7 #include <functional> 7 #include <functional>
8 8
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 clock_(std::move(clock)) {} 157 clock_(std::move(clock)) {}
158 158
159 PermissionReporter::~PermissionReporter() {} 159 PermissionReporter::~PermissionReporter() {}
160 160
161 void PermissionReporter::SendReport(const PermissionReportInfo& report_info) { 161 void PermissionReporter::SendReport(const PermissionReportInfo& report_info) {
162 if (IsReportThresholdExceeded(report_info.permission, report_info.origin)) 162 if (IsReportThresholdExceeded(report_info.permission, report_info.origin))
163 return; 163 return;
164 164
165 std::string serialized_report; 165 std::string serialized_report;
166 BuildReport(report_info, &serialized_report); 166 BuildReport(report_info, &serialized_report);
167 permission_report_sender_->Send(GURL(kPermissionActionReportingUploadUrl), 167 permission_report_sender_->Send(
168 "application/octet-stream", serialized_report, 168 GURL(kPermissionActionReportingUploadUrl), "application/octet-stream",
169 base::Closure(), 169 serialized_report, base::Callback<void()>(),
170 base::Callback<void(const GURL&, int)>()); 170 base::Callback<void(const GURL&, int, int)>());
171 } 171 }
172 172
173 // static 173 // static
174 bool PermissionReporter::BuildReport(const PermissionReportInfo& report_info, 174 bool PermissionReporter::BuildReport(const PermissionReportInfo& report_info,
175 std::string* output) { 175 std::string* output) {
176 PermissionReport report; 176 PermissionReport report;
177 report.set_origin(report_info.origin.spec()); 177 report.set_origin(report_info.origin.spec());
178 report.set_permission(PermissionTypeForReport(report_info.permission)); 178 report.set_permission(PermissionTypeForReport(report_info.permission));
179 report.set_action(PermissionActionForReport(report_info.action)); 179 report.set_action(PermissionActionForReport(report_info.action));
180 report.set_source_ui(SourceUIForReport(report_info.source_ui)); 180 report.set_source_ui(SourceUIForReport(report_info.source_ui));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { 218 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) {
219 log.push(current_time); 219 log.push(current_time);
220 return false; 220 return false;
221 } else { 221 } else {
222 return true; 222 return true;
223 } 223 }
224 } 224 }
225 225
226 } // namespace safe_browsing 226 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/notification_image_reporter.cc ('k') | chrome/browser/ssl/chrome_expect_ct_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698