OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/log/net_log_util.h" | 5 #include "net/log/net_log_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (request1->creation_time() > request2->creation_time()) | 122 if (request1->creation_time() > request2->creation_time()) |
123 return false; | 123 return false; |
124 // If requests were created at the same time, sort by ID. Mostly matters for | 124 // If requests were created at the same time, sort by ID. Mostly matters for |
125 // testing purposes. | 125 // testing purposes. |
126 return request1->identifier() < request2->identifier(); | 126 return request1->identifier() < request2->identifier(); |
127 } | 127 } |
128 | 128 |
129 // Returns a Value representing the state of a pre-existing URLRequest when | 129 // Returns a Value representing the state of a pre-existing URLRequest when |
130 // net-internals was opened. | 130 // net-internals was opened. |
131 base::Value* GetRequestStateAsValue(const net::URLRequest* request, | 131 base::Value* GetRequestStateAsValue(const net::URLRequest* request, |
132 net::NetLog::LogLevel log_level) { | 132 net::NetLogCaptureMode capture_mode) { |
133 return request->GetStateAsValue(); | 133 return request->GetStateAsValue(); |
134 } | 134 } |
135 | 135 |
136 } // namespace | 136 } // namespace |
137 | 137 |
138 scoped_ptr<base::DictionaryValue> GetNetConstants() { | 138 scoped_ptr<base::DictionaryValue> GetNetConstants() { |
139 scoped_ptr<base::DictionaryValue> constants_dict(new base::DictionaryValue()); | 139 scoped_ptr<base::DictionaryValue> constants_dict(new base::DictionaryValue()); |
140 | 140 |
141 // Version of the file format. | 141 // Version of the file format. |
142 constants_dict->SetInteger("logFormatVersion", kLogFormatVersion); | 142 constants_dict->SetInteger("logFormatVersion", kLogFormatVersion); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 // Information about the relationship between source type enums and | 254 // Information about the relationship between source type enums and |
255 // their symbolic names. | 255 // their symbolic names. |
256 constants_dict->Set("logSourceType", net::NetLog::GetSourceTypesAsValue()); | 256 constants_dict->Set("logSourceType", net::NetLog::GetSourceTypesAsValue()); |
257 | 257 |
258 // Information about the relationship between LogLevel enums and their | 258 // Information about the relationship between LogLevel enums and their |
259 // symbolic names. | 259 // symbolic names. |
260 { | 260 { |
261 base::DictionaryValue* dict = new base::DictionaryValue(); | 261 base::DictionaryValue* dict = new base::DictionaryValue(); |
262 | 262 |
263 dict->SetInteger("LOG_ALL", net::NetLog::LOG_ALL); | 263 dict->SetInteger("LOG_ALL", NetLogCaptureMode::ALL); |
264 dict->SetInteger("LOG_ALL_BUT_BYTES", net::NetLog::LOG_ALL_BUT_BYTES); | 264 dict->SetInteger("LOG_ALL_BUT_BYTES", NetLogCaptureMode::ALL_BUT_BYTES); |
265 dict->SetInteger("LOG_STRIP_PRIVATE_DATA", | 265 dict->SetInteger("LOG_STRIP_PRIVATE_DATA", |
266 net::NetLog::LOG_STRIP_PRIVATE_DATA); | 266 NetLogCaptureMode::STRIP_PRIVATE_DATA); |
267 | 267 |
268 constants_dict->Set("logLevelType", dict); | 268 constants_dict->Set("logLevelType", dict); |
269 } | 269 } |
270 | 270 |
271 // Information about the relationship between address family enums and | 271 // Information about the relationship between address family enums and |
272 // their symbolic names. | 272 // their symbolic names. |
273 { | 273 { |
274 base::DictionaryValue* dict = new base::DictionaryValue(); | 274 base::DictionaryValue* dict = new base::DictionaryValue(); |
275 | 275 |
276 dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", | 276 dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 548 |
549 // Create fake events. | 549 // Create fake events. |
550 ScopedVector<NetLog::Entry> entries; | 550 ScopedVector<NetLog::Entry> entries; |
551 for (const auto& request : requests) { | 551 for (const auto& request : requests) { |
552 net::NetLog::ParametersCallback callback = | 552 net::NetLog::ParametersCallback callback = |
553 base::Bind(&GetRequestStateAsValue, base::Unretained(request)); | 553 base::Bind(&GetRequestStateAsValue, base::Unretained(request)); |
554 | 554 |
555 net::NetLog::EntryData entry_data( | 555 net::NetLog::EntryData entry_data( |
556 net::NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(), | 556 net::NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(), |
557 net::NetLog::PHASE_BEGIN, request->creation_time(), &callback); | 557 net::NetLog::PHASE_BEGIN, request->creation_time(), &callback); |
558 NetLog::Entry entry(&entry_data, request->net_log().GetLogLevel()); | 558 NetLog::Entry entry(&entry_data, request->net_log().GetCaptureMode()); |
559 observer->OnAddEntry(entry); | 559 observer->OnAddEntry(entry); |
560 } | 560 } |
561 } | 561 } |
562 | 562 |
563 } // namespace net | 563 } // namespace net |
OLD | NEW |