OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/url_request_view_net_internals_job.h" | 5 #include "net/url_request/url_request_view_net_internals_job.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <ws2tcpip.h> | 8 #include <ws2tcpip.h> |
9 #else | 9 #else |
10 #include <netdb.h> | 10 #include <netdb.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #include <sstream> | 13 #include <sstream> |
14 | 14 |
| 15 #include "base/format_macros.h" |
15 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
17 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
18 #include "net/base/host_cache.h" | 19 #include "net/base/host_cache.h" |
19 #include "net/base/load_log_util.h" | 20 #include "net/base/load_log_util.h" |
20 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
21 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
22 #include "net/proxy/proxy_service.h" | 23 #include "net/proxy/proxy_service.h" |
23 #include "net/socket_stream/socket_stream.h" | 24 #include "net/socket_stream/socket_stream.h" |
24 #include "net/url_request/url_request.h" | 25 #include "net/url_request/url_request.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 210 } |
210 | 211 |
211 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 212 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
212 const net::HostCache* host_cache = context->host_resolver()->GetHostCache(); | 213 const net::HostCache* host_cache = context->host_resolver()->GetHostCache(); |
213 | 214 |
214 if (!host_cache || host_cache->caching_is_disabled()) { | 215 if (!host_cache || host_cache->caching_is_disabled()) { |
215 out->append("<i>Caching is disabled.</i>"); | 216 out->append("<i>Caching is disabled.</i>"); |
216 return; | 217 return; |
217 } | 218 } |
218 | 219 |
219 out->append(StringPrintf("<ul><li>Size: %u</li>" | 220 out->append(StringPrintf("<ul><li>Size: %" PRIuS "</li>" |
220 "<li>Capacity: %u</li>" | 221 "<li>Capacity: %" PRIuS "</li>" |
221 "<li>Time to live (ms): %u</li></ul>", | 222 "<li>Time to live (ms): %" PRIuS "</li></ul>", |
222 host_cache->size(), | 223 host_cache->size(), |
223 host_cache->max_entries(), | 224 host_cache->max_entries(), |
224 host_cache->cache_duration_ms())); | 225 host_cache->cache_duration_ms())); |
225 | 226 |
226 out->append("<table border=1>" | 227 out->append("<table border=1>" |
227 "<tr>" | 228 "<tr>" |
228 "<th>Host</th>" | 229 "<th>Host</th>" |
229 "<th>Address family</th>" | 230 "<th>Address family</th>" |
230 "<th>Address list</th>" | 231 "<th>Address list</th>" |
231 "<th>Time to live (ms)</th>" | 232 "<th>Time to live (ms)</th>" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } else { | 528 } else { |
528 data->append("<i>Nothing found for \""); | 529 data->append("<i>Nothing found for \""); |
529 data->append(EscapeForHTML(details)); | 530 data->append(EscapeForHTML(details)); |
530 data->append("\"</i>"); | 531 data->append("\"</i>"); |
531 } | 532 } |
532 | 533 |
533 data->append("</body></html>"); | 534 data->append("</body></html>"); |
534 | 535 |
535 return true; | 536 return true; |
536 } | 537 } |
OLD | NEW |