| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/notification_image_reporter.h" | 5 #include "chrome/browser/safe_browsing/notification_image_reporter.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 const char NotificationImageReporter::kReportingUploadUrl[] = | 55 const char NotificationImageReporter::kReportingUploadUrl[] = |
| 56 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" | 56 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" |
| 57 "notification-image"; | 57 "notification-image"; |
| 58 | 58 |
| 59 NotificationImageReporter::NotificationImageReporter( | 59 NotificationImageReporter::NotificationImageReporter( |
| 60 net::URLRequestContext* request_context) | 60 net::URLRequestContext* request_context) |
| 61 : NotificationImageReporter(base::MakeUnique<net::ReportSender>( | 61 : NotificationImageReporter( |
| 62 request_context, | 62 base::MakeUnique<net::ReportSender>(request_context)) {} |
| 63 net::ReportSender::CookiesPreference::DO_NOT_SEND_COOKIES)) {} | |
| 64 | 63 |
| 65 NotificationImageReporter::NotificationImageReporter( | 64 NotificationImageReporter::NotificationImageReporter( |
| 66 std::unique_ptr<net::ReportSender> report_sender) | 65 std::unique_ptr<net::ReportSender> report_sender) |
| 67 : report_sender_(std::move(report_sender)), weak_factory_on_io_(this) { | 66 : report_sender_(std::move(report_sender)), weak_factory_on_io_(this) { |
| 68 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 67 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 69 } | 68 } |
| 70 | 69 |
| 71 NotificationImageReporter::~NotificationImageReporter() { | 70 NotificationImageReporter::~NotificationImageReporter() { |
| 72 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 71 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 73 } | 72 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 std::string serialized_report; | 216 std::string serialized_report; |
| 218 report.SerializeToString(&serialized_report); | 217 report.SerializeToString(&serialized_report); |
| 219 report_sender_->Send( | 218 report_sender_->Send( |
| 220 GURL(kReportingUploadUrl), "application/octet-stream", serialized_report, | 219 GURL(kReportingUploadUrl), "application/octet-stream", serialized_report, |
| 221 base::Bind(&LogReportResult, GURL(kReportingUploadUrl), net::OK), | 220 base::Bind(&LogReportResult, GURL(kReportingUploadUrl), net::OK), |
| 222 base::Bind(&LogReportResult)); | 221 base::Bind(&LogReportResult)); |
| 223 // TODO(johnme): Consider logging bandwidth and/or duration to UMA. | 222 // TODO(johnme): Consider logging bandwidth and/or duration to UMA. |
| 224 } | 223 } |
| 225 | 224 |
| 226 } // namespace safe_browsing | 225 } // namespace safe_browsing |
| OLD | NEW |