OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "net/url_request/report_sender.h" | 5 #include "net/url_request/report_sender.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/base/elements_upload_data_stream.h" | 10 #include "net/base/elements_upload_data_stream.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 ReportSender::ReportSender(URLRequestContext* request_context, | 23 ReportSender::ReportSender(URLRequestContext* request_context, |
24 CookiesPreference cookies_preference, | 24 CookiesPreference cookies_preference, |
25 const ErrorCallback& error_callback) | 25 const ErrorCallback& error_callback) |
26 : request_context_(request_context), | 26 : request_context_(request_context), |
27 cookies_preference_(cookies_preference), | 27 cookies_preference_(cookies_preference), |
28 error_callback_(error_callback) {} | 28 error_callback_(error_callback) {} |
29 | 29 |
30 ReportSender::~ReportSender() { | 30 ReportSender::~ReportSender() { |
31 // Cancel all of the uncompleted requests. | 31 // Cancel all of the uncompleted requests. |
32 STLDeleteElements(&inflight_requests_); | 32 base::STLDeleteElements(&inflight_requests_); |
33 } | 33 } |
34 | 34 |
35 void ReportSender::Send(const GURL& report_uri, const std::string& report) { | 35 void ReportSender::Send(const GURL& report_uri, const std::string& report) { |
36 std::unique_ptr<URLRequest> url_request = | 36 std::unique_ptr<URLRequest> url_request = |
37 request_context_->CreateRequest(report_uri, DEFAULT_PRIORITY, this); | 37 request_context_->CreateRequest(report_uri, DEFAULT_PRIORITY, this); |
38 | 38 |
39 int load_flags = | 39 int load_flags = |
40 LOAD_BYPASS_CACHE | LOAD_DISABLE_CACHE | LOAD_DO_NOT_SEND_AUTH_DATA; | 40 LOAD_BYPASS_CACHE | LOAD_DISABLE_CACHE | LOAD_DO_NOT_SEND_AUTH_DATA; |
41 if (cookies_preference_ != SEND_COOKIES) { | 41 if (cookies_preference_ != SEND_COOKIES) { |
42 load_flags |= LOAD_DO_NOT_SEND_COOKIES | LOAD_DO_NOT_SAVE_COOKIES; | 42 load_flags |= LOAD_DO_NOT_SEND_COOKIES | LOAD_DO_NOT_SAVE_COOKIES; |
(...skipping 26 matching lines...) Expand all Loading... |
69 CHECK_GT(inflight_requests_.erase(request), 0u); | 69 CHECK_GT(inflight_requests_.erase(request), 0u); |
70 // Clean up the request, which cancels it. | 70 // Clean up the request, which cancels it. |
71 delete request; | 71 delete request; |
72 } | 72 } |
73 | 73 |
74 void ReportSender::OnReadCompleted(URLRequest* request, int bytes_read) { | 74 void ReportSender::OnReadCompleted(URLRequest* request, int bytes_read) { |
75 NOTREACHED(); | 75 NOTREACHED(); |
76 } | 76 } |
77 | 77 |
78 } // namespace net | 78 } // namespace net |
OLD | NEW |