| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 const char NotificationImageReporter::kReportingUploadUrl[] = | 56 const char NotificationImageReporter::kReportingUploadUrl[] = |
| 57 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" | 57 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" |
| 58 "notification-image"; | 58 "notification-image"; |
| 59 | 59 |
| 60 NotificationImageReporter::NotificationImageReporter( | 60 NotificationImageReporter::NotificationImageReporter( |
| 61 net::URLRequestContext* request_context) | 61 net::URLRequestContext* request_context) |
| 62 : NotificationImageReporter(base::MakeUnique<net::ReportSender>( | 62 : NotificationImageReporter( |
| 63 request_context, | 63 base::MakeUnique<net::ReportSender>(request_context)) {} |
| 64 net::ReportSender::CookiesPreference::DO_NOT_SEND_COOKIES)) {} | |
| 65 | 64 |
| 66 NotificationImageReporter::NotificationImageReporter( | 65 NotificationImageReporter::NotificationImageReporter( |
| 67 std::unique_ptr<net::ReportSender> report_sender) | 66 std::unique_ptr<net::ReportSender> report_sender) |
| 68 : report_sender_(std::move(report_sender)), weak_factory_on_io_(this) { | 67 : report_sender_(std::move(report_sender)), weak_factory_on_io_(this) { |
| 69 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 68 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 70 } | 69 } |
| 71 | 70 |
| 72 NotificationImageReporter::~NotificationImageReporter() { | 71 NotificationImageReporter::~NotificationImageReporter() { |
| 73 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 72 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 74 } | 73 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 report.SerializeToString(&serialized_report); | 218 report.SerializeToString(&serialized_report); |
| 220 report_sender_->Send(GURL(kReportingUploadUrl), "application/octet-stream", | 219 report_sender_->Send(GURL(kReportingUploadUrl), "application/octet-stream", |
| 221 serialized_report, | 220 serialized_report, |
| 222 base::Bind(&LogReportResult, GURL(kReportingUploadUrl), | 221 base::Bind(&LogReportResult, GURL(kReportingUploadUrl), |
| 223 net::OK, net::HTTP_OK), | 222 net::OK, net::HTTP_OK), |
| 224 base::Bind(&LogReportResult)); | 223 base::Bind(&LogReportResult)); |
| 225 // TODO(johnme): Consider logging bandwidth and/or duration to UMA. | 224 // TODO(johnme): Consider logging bandwidth and/or duration to UMA. |
| 226 } | 225 } |
| 227 | 226 |
| 228 } // namespace safe_browsing | 227 } // namespace safe_browsing |
| OLD | NEW |