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 "net/reporting/reporting_delivery_agent.h" | 5 #include "net/reporting/reporting_delivery_agent.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 endpoint, json, | 163 endpoint, json, |
164 base::Bind(&ReportingDeliveryAgentImpl::OnUploadComplete, | 164 base::Bind(&ReportingDeliveryAgentImpl::OnUploadComplete, |
165 weak_factory_.GetWeakPtr(), | 165 weak_factory_.GetWeakPtr(), |
166 base::MakeUnique<Delivery>(endpoint, reports))); | 166 base::MakeUnique<Delivery>(endpoint, reports))); |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 void OnUploadComplete(const std::unique_ptr<Delivery>& delivery, | 170 void OnUploadComplete(const std::unique_ptr<Delivery>& delivery, |
171 ReportingUploader::Outcome outcome) { | 171 ReportingUploader::Outcome outcome) { |
172 if (outcome == ReportingUploader::Outcome::SUCCESS) { | 172 if (outcome == ReportingUploader::Outcome::SUCCESS) { |
173 cache()->RemoveReports(delivery->reports); | 173 cache()->RemoveReports(delivery->reports, |
| 174 ReportingReport::Outcome::DELIVERED); |
174 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, true); | 175 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, true); |
175 } else { | 176 } else { |
176 cache()->IncrementReportsAttempts(delivery->reports); | 177 cache()->IncrementReportsAttempts(delivery->reports); |
177 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, false); | 178 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, false); |
178 } | 179 } |
179 | 180 |
180 if (outcome == ReportingUploader::Outcome::REMOVE_ENDPOINT) | 181 if (outcome == ReportingUploader::Outcome::REMOVE_ENDPOINT) |
181 cache()->RemoveClientsForEndpoint(delivery->endpoint); | 182 cache()->RemoveClientsForEndpoint(delivery->endpoint); |
182 | 183 |
183 for (const ReportingReport* report : delivery->reports) { | 184 for (const ReportingReport* report : delivery->reports) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 216 |
216 // static | 217 // static |
217 std::unique_ptr<ReportingDeliveryAgent> ReportingDeliveryAgent::Create( | 218 std::unique_ptr<ReportingDeliveryAgent> ReportingDeliveryAgent::Create( |
218 ReportingContext* context) { | 219 ReportingContext* context) { |
219 return base::MakeUnique<ReportingDeliveryAgentImpl>(context); | 220 return base::MakeUnique<ReportingDeliveryAgentImpl>(context); |
220 } | 221 } |
221 | 222 |
222 ReportingDeliveryAgent::~ReportingDeliveryAgent() {} | 223 ReportingDeliveryAgent::~ReportingDeliveryAgent() {} |
223 | 224 |
224 } // namespace net | 225 } // namespace net |
OLD | NEW |