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/base/net_log_util.h" | 5 #include "net/base/net_log_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "net/base/address_family.h" | 14 #include "net/base/address_family.h" |
15 #include "net/base/load_states.h" | 15 #include "net/base/load_states.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "net/base/net_log.h" | 17 #include "net/base/net_log.h" |
| 18 #include "net/base/sdch_manager.h" |
18 #include "net/disk_cache/disk_cache.h" | 19 #include "net/disk_cache/disk_cache.h" |
19 #include "net/dns/host_cache.h" | 20 #include "net/dns/host_cache.h" |
20 #include "net/dns/host_resolver.h" | 21 #include "net/dns/host_resolver.h" |
21 #include "net/http/http_cache.h" | 22 #include "net/http/http_cache.h" |
22 #include "net/http/http_network_session.h" | 23 #include "net/http/http_network_session.h" |
23 #include "net/http/http_server_properties.h" | 24 #include "net/http/http_server_properties.h" |
24 #include "net/http/http_transaction_factory.h" | 25 #include "net/http/http_transaction_factory.h" |
25 #include "net/proxy/proxy_config.h" | 26 #include "net/proxy/proxy_config.h" |
26 #include "net/proxy/proxy_retry_info.h" | 27 #include "net/proxy/proxy_retry_info.h" |
27 #include "net/proxy/proxy_service.h" | 28 #include "net/proxy/proxy_service.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "net/base/load_states_list.h" | 60 #include "net/base/load_states_list.h" |
60 #undef LOAD_STATE | 61 #undef LOAD_STATE |
61 }; | 62 }; |
62 | 63 |
63 const short kNetErrors[] = { | 64 const short kNetErrors[] = { |
64 #define NET_ERROR(label, value) value, | 65 #define NET_ERROR(label, value) value, |
65 #include "net/base/net_error_list.h" | 66 #include "net/base/net_error_list.h" |
66 #undef NET_ERROR | 67 #undef NET_ERROR |
67 }; | 68 }; |
68 | 69 |
| 70 const StringToConstant kSdchProblems[] = { |
| 71 #define SDCH_PROBLEM_CODE(label, value) \ |
| 72 { #label, value } \ |
| 73 , |
| 74 #include "net/base/sdch_problem_code_list.h" |
| 75 #undef SDCH_PROBLEM_CODE |
| 76 }; |
| 77 |
69 const char* NetInfoSourceToString(NetInfoSource source) { | 78 const char* NetInfoSourceToString(NetInfoSource source) { |
70 switch (source) { | 79 switch (source) { |
71 #define NET_INFO_SOURCE(label, string, value) \ | 80 #define NET_INFO_SOURCE(label, string, value) \ |
72 case NET_INFO_ ## label: \ | 81 case NET_INFO_ ## label: \ |
73 return string; | 82 return string; |
74 #include "net/base/net_info_source_list.h" | 83 #include "net/base/net_info_source_list.h" |
75 #undef NET_INFO_SOURCE | 84 #undef NET_INFO_SOURCE |
76 case NET_INFO_ALL_SOURCES: | 85 case NET_INFO_ALL_SOURCES: |
77 return "All"; | 86 return "All"; |
78 } | 87 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 for (net::QuicRstStreamErrorCode error = net::QUIC_STREAM_NO_ERROR; | 189 for (net::QuicRstStreamErrorCode error = net::QUIC_STREAM_NO_ERROR; |
181 error < net::QUIC_STREAM_LAST_ERROR; | 190 error < net::QUIC_STREAM_LAST_ERROR; |
182 error = static_cast<net::QuicRstStreamErrorCode>(error + 1)) { | 191 error = static_cast<net::QuicRstStreamErrorCode>(error + 1)) { |
183 dict->SetInteger(net::QuicUtils::StreamErrorToString(error), | 192 dict->SetInteger(net::QuicUtils::StreamErrorToString(error), |
184 static_cast<int>(error)); | 193 static_cast<int>(error)); |
185 } | 194 } |
186 | 195 |
187 constants_dict->Set("quicRstStreamError", dict); | 196 constants_dict->Set("quicRstStreamError", dict); |
188 } | 197 } |
189 | 198 |
| 199 // Add information on the relationship between SDCH problem codes and their |
| 200 // symbolic names. |
| 201 { |
| 202 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 203 |
| 204 for (size_t i = 0; i < arraysize(kSdchProblems); i++) |
| 205 dict->SetInteger(kSdchProblems[i].name, kSdchProblems[i].constant); |
| 206 |
| 207 constants_dict->Set("sdchProblemCode", dict); |
| 208 } |
| 209 |
190 // Information about the relationship between event phase enums and their | 210 // Information about the relationship between event phase enums and their |
191 // symbolic names. | 211 // symbolic names. |
192 { | 212 { |
193 base::DictionaryValue* dict = new base::DictionaryValue(); | 213 base::DictionaryValue* dict = new base::DictionaryValue(); |
194 | 214 |
195 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN); | 215 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN); |
196 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END); | 216 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END); |
197 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE); | 217 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE); |
198 | 218 |
199 constants_dict->Set("logEventPhase", dict); | 219 constants_dict->Set("logEventPhase", dict); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 stats_dict->SetStringWithoutPathExpansion( | 468 stats_dict->SetStringWithoutPathExpansion( |
449 stats[i].first, stats[i].second); | 469 stats[i].first, stats[i].second); |
450 } | 470 } |
451 } | 471 } |
452 info_dict->Set("stats", stats_dict); | 472 info_dict->Set("stats", stats_dict); |
453 | 473 |
454 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), | 474 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), |
455 info_dict); | 475 info_dict); |
456 } | 476 } |
457 | 477 |
| 478 if (info_sources & NET_INFO_SDCH) { |
| 479 base::Value* info_dict; |
| 480 SdchManager* sdch_manager = context->sdch_manager(); |
| 481 if (sdch_manager) { |
| 482 info_dict = sdch_manager->SdchInfoToValue(); |
| 483 } else { |
| 484 info_dict = new base::DictionaryValue(); |
| 485 } |
| 486 net_info_dict->Set(NetInfoSourceToString(NET_INFO_SDCH), info_dict); |
| 487 } |
| 488 |
458 return net_info_dict.Pass(); | 489 return net_info_dict.Pass(); |
459 } | 490 } |
460 | 491 |
461 } // namespace net | 492 } // namespace net |
OLD | NEW |