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

Side by Side Diff: net/reporting/reporting_delivery_agent.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 years, 6 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 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 23 matching lines...) Expand all
34 std::string* json_out) { 34 std::string* json_out) {
35 base::ListValue reports_value; 35 base::ListValue reports_value;
36 36
37 for (const ReportingReport* report : reports) { 37 for (const ReportingReport* report : reports) {
38 std::unique_ptr<base::DictionaryValue> report_value = 38 std::unique_ptr<base::DictionaryValue> report_value =
39 base::MakeUnique<base::DictionaryValue>(); 39 base::MakeUnique<base::DictionaryValue>();
40 40
41 report_value->SetInteger("age", (now - report->queued).InMilliseconds()); 41 report_value->SetInteger("age", (now - report->queued).InMilliseconds());
42 report_value->SetString("type", report->type); 42 report_value->SetString("type", report->type);
43 report_value->SetString("url", report->url.spec()); 43 report_value->SetString("url", report->url.spec());
44 report_value->Set("report", report->body->DeepCopy()); 44 report_value->Set("report", base::MakeUnique<base::Value>(*report->body));
45 45
46 reports_value.Append(std::move(report_value)); 46 reports_value.Append(std::move(report_value));
47 } 47 }
48 48
49 bool json_written = base::JSONWriter::Write(reports_value, json_out); 49 bool json_written = base::JSONWriter::Write(reports_value, json_out);
50 DCHECK(json_written); 50 DCHECK(json_written);
51 } 51 }
52 52
53 class ReportingDeliveryAgentImpl : public ReportingDeliveryAgent, 53 class ReportingDeliveryAgentImpl : public ReportingDeliveryAgent,
54 public ReportingObserver { 54 public ReportingObserver {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 // static 216 // static
217 std::unique_ptr<ReportingDeliveryAgent> ReportingDeliveryAgent::Create( 217 std::unique_ptr<ReportingDeliveryAgent> ReportingDeliveryAgent::Create(
218 ReportingContext* context) { 218 ReportingContext* context) {
219 return base::MakeUnique<ReportingDeliveryAgentImpl>(context); 219 return base::MakeUnique<ReportingDeliveryAgentImpl>(context);
220 } 220 }
221 221
222 ReportingDeliveryAgent::~ReportingDeliveryAgent() {} 222 ReportingDeliveryAgent::~ReportingDeliveryAgent() {}
223 223
224 } // namespace net 224 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_pool.cc ('k') | net/test/spawned_test_server/base_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698