OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/net/view_net_internals_job_factory.h" | 5 #include "chrome/browser/net/view_net_internals_job_factory.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/browser/net/chrome_net_log.h" |
| 13 #include "chrome/browser/net/chrome_url_request_context.h" |
| 14 #include "chrome/browser/net/passive_log_collector.h" |
12 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
13 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
14 #include "net/base/host_resolver_impl.h" | 17 #include "net/base/host_resolver_impl.h" |
15 #include "net/base/load_log_util.h" | |
16 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/base/net_log_util.h" |
17 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
18 #include "net/base/sys_addrinfo.h" | 21 #include "net/base/sys_addrinfo.h" |
19 #include "net/proxy/proxy_service.h" | 22 #include "net/proxy/proxy_service.h" |
20 #include "net/socket_stream/socket_stream.h" | 23 #include "net/socket_stream/socket_stream.h" |
21 #include "net/url_request/url_request.h" | 24 #include "net/url_request/url_request.h" |
22 #include "net/url_request/url_request_context.h" | 25 #include "net/url_request/url_request_context.h" |
23 #include "net/url_request/url_request_simple_job.h" | 26 #include "net/url_request/url_request_simple_job.h" |
24 #include "net/url_request/view_cache_helper.h" | 27 #include "net/url_request/view_cache_helper.h" |
25 | 28 |
26 namespace { | 29 namespace { |
27 | 30 |
28 const char kViewHttpCacheSubPath[] = "view-cache"; | 31 const char kViewHttpCacheSubPath[] = "view-cache"; |
29 | 32 |
| 33 PassiveLogCollector* GetPassiveLogCollector(URLRequestContext* context) { |
| 34 // Really this is the same as: |
| 35 // g_browser_process->io_thread()->globals()-> |
| 36 // net_log.get() |
| 37 // (But we can't access g_browser_process from the IO thread). |
| 38 ChromeNetLog* chrome_net_log = static_cast<ChromeNetLog*>( |
| 39 static_cast<ChromeURLRequestContext*>(context)->net_log()); |
| 40 return chrome_net_log->passive_collector(); |
| 41 } |
| 42 |
| 43 PassiveLogCollector::RequestTracker* GetURLRequestTracker( |
| 44 URLRequestContext* context) { |
| 45 return GetPassiveLogCollector(context)->url_request_tracker(); |
| 46 } |
| 47 |
| 48 PassiveLogCollector::RequestTracker* GetSocketStreamTracker( |
| 49 URLRequestContext* context) { |
| 50 return GetPassiveLogCollector(context)->socket_stream_tracker(); |
| 51 } |
| 52 |
30 std::string GetDetails(const GURL& url) { | 53 std::string GetDetails(const GURL& url) { |
31 DCHECK(ViewNetInternalsJobFactory::IsSupportedURL(url)); | 54 DCHECK(ViewNetInternalsJobFactory::IsSupportedURL(url)); |
32 size_t start = strlen(chrome::kNetworkViewInternalsURL); | 55 size_t start = strlen(chrome::kNetworkViewInternalsURL); |
33 if (start >= url.spec().size()) | 56 if (start >= url.spec().size()) |
34 return std::string(); | 57 return std::string(); |
35 return url.spec().substr(start); | 58 return url.spec().substr(start); |
36 } | 59 } |
37 | 60 |
38 GURL MakeURL(const std::string& details) { | 61 GURL MakeURL(const std::string& details) { |
39 return GURL(std::string(chrome::kNetworkViewInternalsURL) + details); | 62 return GURL(std::string(chrome::kNetworkViewInternalsURL) + details); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 }; | 248 }; |
226 | 249 |
227 class ProxyServiceLastInitLogSubSection : public SubSection { | 250 class ProxyServiceLastInitLogSubSection : public SubSection { |
228 public: | 251 public: |
229 explicit ProxyServiceLastInitLogSubSection(SubSection* parent) | 252 explicit ProxyServiceLastInitLogSubSection(SubSection* parent) |
230 : SubSection(parent, "init_log", "Last initialized load log") { | 253 : SubSection(parent, "init_log", "Last initialized load log") { |
231 } | 254 } |
232 | 255 |
233 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 256 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
234 net::ProxyService* proxy_service = context->proxy_service(); | 257 net::ProxyService* proxy_service = context->proxy_service(); |
235 net::LoadLog* log = proxy_service->init_proxy_resolver_log(); | 258 OutputTextInPre(net::NetLogUtil::PrettyPrintAsEventTree( |
236 if (log) { | 259 proxy_service->init_proxy_resolver_log().entries(), 0), out); |
237 OutputTextInPre(net::LoadLogUtil::PrettyPrintAsEventTree(log), out); | |
238 } else { | |
239 out->append("<i>None.</i>"); | |
240 } | |
241 } | 260 } |
242 }; | 261 }; |
243 | 262 |
244 class ProxyServiceBadProxiesSubSection : public SubSection { | 263 class ProxyServiceBadProxiesSubSection : public SubSection { |
245 public: | 264 public: |
246 explicit ProxyServiceBadProxiesSubSection(SubSection* parent) | 265 explicit ProxyServiceBadProxiesSubSection(SubSection* parent) |
247 : SubSection(parent, "bad_proxies", "Bad Proxies") { | 266 : SubSection(parent, "bad_proxies", "Bad Proxies") { |
248 } | 267 } |
249 | 268 |
250 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 269 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 430 } |
412 | 431 |
413 DrawCommandButton("Clear", "clear-hostresolver-trace", out); | 432 DrawCommandButton("Clear", "clear-hostresolver-trace", out); |
414 | 433 |
415 if (resolver->IsRequestsTracingEnabled()) { | 434 if (resolver->IsRequestsTracingEnabled()) { |
416 DrawCommandButton("Disable tracing", "hostresolver-trace-disable", out); | 435 DrawCommandButton("Disable tracing", "hostresolver-trace-disable", out); |
417 } else { | 436 } else { |
418 DrawCommandButton("Enable tracing", "hostresolver-trace-enable", out); | 437 DrawCommandButton("Enable tracing", "hostresolver-trace-enable", out); |
419 } | 438 } |
420 | 439 |
421 scoped_refptr<net::LoadLog> log = resolver->GetRequestsTrace(); | 440 std::vector<net::NetLog::Entry> entries; |
422 | 441 if (resolver->GetRequestsTrace(&entries)) { |
423 if (log) { | |
424 out->append( | 442 out->append( |
425 "<p>To make sense of this trace, process it with the Python script " | 443 "<p>To make sense of this trace, process it with the Python script " |
426 "formatter.py at " | 444 "formatter.py at " |
427 "<a href='http://src.chromium.org/viewvc/chrome/trunk/src/net/tools/" | 445 "<a href='http://src.chromium.org/viewvc/chrome/trunk/src/net/tools/" |
428 "dns_trace_formatter/'>net/tools/dns_trace_formatter</a></p>"); | 446 "dns_trace_formatter/'>net/tools/dns_trace_formatter</a></p>"); |
429 OutputTextInPre(net::LoadLogUtil::PrettyPrintAsEventTree(log), out); | 447 OutputTextInPre(net::NetLogUtil::PrettyPrintAsEventTree(entries, 0), |
| 448 out); |
430 } else { | 449 } else { |
431 out->append("<p><i>No trace information, must enable tracing.</i></p>"); | 450 out->append("<p><i>No trace information, must enable tracing.</i></p>"); |
432 } | 451 } |
433 } | 452 } |
434 }; | 453 }; |
435 | 454 |
436 class HostResolverSubSection : public SubSection { | 455 class HostResolverSubSection : public SubSection { |
437 public: | 456 public: |
438 explicit HostResolverSubSection(SubSection* parent) | 457 explicit HostResolverSubSection(SubSection* parent) |
439 : SubSection(parent, "hostresolver", "HostResolver") { | 458 : SubSection(parent, "hostresolver", "HostResolver") { |
440 AddSubSection(new HostResolverCacheSubSection(this)); | 459 AddSubSection(new HostResolverCacheSubSection(this)); |
441 AddSubSection(new HostResolverTraceSubSection(this)); | 460 AddSubSection(new HostResolverTraceSubSection(this)); |
442 } | 461 } |
443 }; | 462 }; |
444 | 463 |
445 // Helper for the URLRequest "outstanding" and "live" sections. | 464 // Helper for the URLRequest "outstanding" and "live" sections. |
446 void OutputURLAndLoadLog(const GURL& url, | 465 void OutputURLAndLoadLog(const PassiveLogCollector::RequestInfo& request, |
447 const net::LoadLog* log, | |
448 std::string* out) { | 466 std::string* out) { |
449 out->append("<li>"); | 467 out->append("<li>"); |
450 out->append("<nobr>"); | 468 out->append("<nobr>"); |
451 out->append(EscapeForHTML(url.possibly_invalid_spec())); | 469 out->append(EscapeForHTML(request.url)); |
452 out->append("</nobr>"); | 470 out->append("</nobr>"); |
453 if (log) | 471 OutputTextInPre( |
454 OutputTextInPre(net::LoadLogUtil::PrettyPrintAsEventTree(log), out); | 472 net::NetLogUtil::PrettyPrintAsEventTree( |
| 473 request.entries, |
| 474 request.num_entries_truncated), |
| 475 out); |
455 out->append("</li>"); | 476 out->append("</li>"); |
456 } | 477 } |
457 | 478 |
458 class URLRequestLiveSubSection : public SubSection { | 479 class URLRequestLiveSubSection : public SubSection { |
459 public: | 480 public: |
460 explicit URLRequestLiveSubSection(SubSection* parent) | 481 explicit URLRequestLiveSubSection(SubSection* parent) |
461 : SubSection(parent, "outstanding", "Outstanding requests") { | 482 : SubSection(parent, "outstanding", "Outstanding requests") { |
462 } | 483 } |
463 | 484 |
464 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 485 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
465 std::vector<URLRequest*> requests = | 486 PassiveLogCollector::RequestInfoList requests = |
466 context->url_request_tracker()->GetLiveRequests(); | 487 GetURLRequestTracker(context)->GetLiveRequests(); |
467 | 488 |
468 out->append("<ol>"); | 489 out->append("<ol>"); |
469 for (size_t i = 0; i < requests.size(); ++i) { | 490 for (size_t i = 0; i < requests.size(); ++i) { |
470 // Reverse the list order, so we dispay from most recent to oldest. | 491 // Reverse the list order, so we dispay from most recent to oldest. |
471 size_t index = requests.size() - i - 1; | 492 size_t index = requests.size() - i - 1; |
472 OutputURLAndLoadLog(requests[index]->original_url(), | 493 OutputURLAndLoadLog(requests[index], out); |
473 requests[index]->load_log(), | |
474 out); | |
475 } | 494 } |
476 out->append("</ol>"); | 495 out->append("</ol>"); |
477 } | 496 } |
478 }; | 497 }; |
479 | 498 |
480 class URLRequestRecentSubSection : public SubSection { | 499 class URLRequestRecentSubSection : public SubSection { |
481 public: | 500 public: |
482 explicit URLRequestRecentSubSection(SubSection* parent) | 501 explicit URLRequestRecentSubSection(SubSection* parent) |
483 : SubSection(parent, "recent", "Recently completed requests") { | 502 : SubSection(parent, "recent", "Recently completed requests") { |
484 } | 503 } |
485 | 504 |
486 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 505 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
487 RequestTracker<URLRequest>::RecentRequestInfoList recent = | 506 PassiveLogCollector::RequestInfoList recent = |
488 context->url_request_tracker()->GetRecentlyDeceased(); | 507 GetURLRequestTracker(context)->GetRecentlyDeceased(); |
489 | 508 |
490 DrawCommandButton("Clear", "clear-urlrequest-graveyard", out); | 509 DrawCommandButton("Clear", "clear-urlrequest-graveyard", out); |
491 | 510 |
492 out->append("<ol>"); | 511 out->append("<ol>"); |
493 for (size_t i = 0; i < recent.size(); ++i) { | 512 for (size_t i = 0; i < recent.size(); ++i) { |
494 // Reverse the list order, so we dispay from most recent to oldest. | 513 // Reverse the list order, so we dispay from most recent to oldest. |
495 size_t index = recent.size() - i - 1; | 514 size_t index = recent.size() - i - 1; |
496 OutputURLAndLoadLog(recent[index].original_url, | 515 OutputURLAndLoadLog(recent[index], out); |
497 recent[index].load_log, out); | |
498 } | 516 } |
499 out->append("</ol>"); | 517 out->append("</ol>"); |
500 } | 518 } |
501 }; | 519 }; |
502 | 520 |
503 class URLRequestSubSection : public SubSection { | 521 class URLRequestSubSection : public SubSection { |
504 public: | 522 public: |
505 explicit URLRequestSubSection(SubSection* parent) | 523 explicit URLRequestSubSection(SubSection* parent) |
506 : SubSection(parent, "urlrequest", "URLRequest") { | 524 : SubSection(parent, "urlrequest", "URLRequest") { |
507 AddSubSection(new URLRequestLiveSubSection(this)); | 525 AddSubSection(new URLRequestLiveSubSection(this)); |
(...skipping 27 matching lines...) Expand all Loading... |
535 } | 553 } |
536 }; | 554 }; |
537 | 555 |
538 class SocketStreamLiveSubSection : public SubSection { | 556 class SocketStreamLiveSubSection : public SubSection { |
539 public: | 557 public: |
540 explicit SocketStreamLiveSubSection(SubSection* parent) | 558 explicit SocketStreamLiveSubSection(SubSection* parent) |
541 : SubSection(parent, "live", "Live SocketStreams") { | 559 : SubSection(parent, "live", "Live SocketStreams") { |
542 } | 560 } |
543 | 561 |
544 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 562 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
545 std::vector<net::SocketStream*> sockets = | 563 PassiveLogCollector::RequestInfoList sockets = |
546 context->socket_stream_tracker()->GetLiveRequests(); | 564 GetSocketStreamTracker(context)->GetLiveRequests(); |
547 | 565 |
548 out->append("<ol>"); | 566 out->append("<ol>"); |
549 for (size_t i = 0; i < sockets.size(); ++i) { | 567 for (size_t i = 0; i < sockets.size(); ++i) { |
550 // Reverse the list order, so we dispay from most recent to oldest. | 568 // Reverse the list order, so we dispay from most recent to oldest. |
551 size_t index = sockets.size() - i - 1; | 569 size_t index = sockets.size() - i - 1; |
552 OutputURLAndLoadLog(sockets[index]->url(), | 570 OutputURLAndLoadLog(sockets[index], out); |
553 sockets[index]->load_log(), | |
554 out); | |
555 } | 571 } |
556 out->append("</ol>"); | 572 out->append("</ol>"); |
557 } | 573 } |
558 }; | 574 }; |
559 | 575 |
560 class SocketStreamRecentSubSection : public SubSection { | 576 class SocketStreamRecentSubSection : public SubSection { |
561 public: | 577 public: |
562 explicit SocketStreamRecentSubSection(SubSection* parent) | 578 explicit SocketStreamRecentSubSection(SubSection* parent) |
563 : SubSection(parent, "recent", "Recently completed SocketStreams") { | 579 : SubSection(parent, "recent", "Recently completed SocketStreams") { |
564 } | 580 } |
565 | 581 |
566 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 582 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
567 RequestTracker<net::SocketStream>::RecentRequestInfoList recent = | 583 PassiveLogCollector::RequestInfoList recent = |
568 context->socket_stream_tracker()->GetRecentlyDeceased(); | 584 GetSocketStreamTracker(context)->GetRecentlyDeceased(); |
569 | 585 |
570 DrawCommandButton("Clear", "clear-socketstream-graveyard", out); | 586 DrawCommandButton("Clear", "clear-socketstream-graveyard", out); |
571 | 587 |
572 out->append("<ol>"); | 588 out->append("<ol>"); |
573 for (size_t i = 0; i < recent.size(); ++i) { | 589 for (size_t i = 0; i < recent.size(); ++i) { |
574 // Reverse the list order, so we dispay from most recent to oldest. | 590 // Reverse the list order, so we dispay from most recent to oldest. |
575 size_t index = recent.size() - i - 1; | 591 size_t index = recent.size() - i - 1; |
576 OutputURLAndLoadLog(recent[index].original_url, | 592 OutputURLAndLoadLog(recent[index], out); |
577 recent[index].load_log, out); | |
578 } | 593 } |
579 out->append("</ol>"); | 594 out->append("</ol>"); |
580 } | 595 } |
581 }; | 596 }; |
582 | 597 |
583 class SocketStreamSubSection : public SubSection { | 598 class SocketStreamSubSection : public SubSection { |
584 public: | 599 public: |
585 explicit SocketStreamSubSection(SubSection* parent) | 600 explicit SocketStreamSubSection(SubSection* parent) |
586 : SubSection(parent, "socketstream", "SocketStream") { | 601 : SubSection(parent, "socketstream", "SocketStream") { |
587 AddSubSection(new SocketStreamLiveSubSection(this)); | 602 AddSubSection(new SocketStreamLiveSubSection(this)); |
588 AddSubSection(new SocketStreamRecentSubSection(this)); | 603 AddSubSection(new SocketStreamRecentSubSection(this)); |
589 } | 604 } |
590 }; | 605 }; |
591 | 606 |
592 class AllSubSections : public SubSection { | 607 class AllSubSections : public SubSection { |
593 public: | 608 public: |
594 AllSubSections() : SubSection(NULL, "", "") { | 609 AllSubSections() : SubSection(NULL, "", "") { |
595 AddSubSection(new ProxyServiceSubSection(this)); | 610 AddSubSection(new ProxyServiceSubSection(this)); |
596 AddSubSection(new HostResolverSubSection(this)); | 611 AddSubSection(new HostResolverSubSection(this)); |
597 AddSubSection(new URLRequestSubSection(this)); | 612 AddSubSection(new URLRequestSubSection(this)); |
598 AddSubSection(new HttpCacheSection(this)); | 613 AddSubSection(new HttpCacheSection(this)); |
599 AddSubSection(new SocketStreamSubSection(this)); | 614 AddSubSection(new SocketStreamSubSection(this)); |
600 } | 615 } |
601 }; | 616 }; |
602 | 617 |
603 bool HandleCommand(const std::string& command, URLRequestContext* context) { | 618 bool HandleCommand(const std::string& command, |
| 619 URLRequestContext* context) { |
604 if (StartsWithASCII(command, "full-logging-", true)) { | 620 if (StartsWithASCII(command, "full-logging-", true)) { |
605 bool enable_full_logging = (command == "full-logging-enable"); | 621 bool enable_full_logging = (command == "full-logging-enable"); |
606 context->url_request_tracker()->SetUnbounded(enable_full_logging); | 622 GetURLRequestTracker(context)->SetUnbounded(enable_full_logging); |
607 context->socket_stream_tracker()->SetUnbounded(enable_full_logging); | 623 GetSocketStreamTracker(context)->SetUnbounded(enable_full_logging); |
608 return true; | 624 return true; |
609 } | 625 } |
610 | 626 |
611 if (StartsWithASCII(command, "hostresolver-trace-", true)) { | 627 if (StartsWithASCII(command, "hostresolver-trace-", true)) { |
612 bool enable_tracing = (command == "hostresolver-trace-enable"); | 628 bool enable_tracing = (command == "hostresolver-trace-enable"); |
613 if (GetHostResolverImpl(context)) { | 629 if (GetHostResolverImpl(context)) { |
614 GetHostResolverImpl(context)->EnableRequestsTracing(enable_tracing); | 630 GetHostResolverImpl(context)->EnableRequestsTracing(enable_tracing); |
615 } | 631 } |
616 } | 632 } |
617 | 633 |
618 if (command == "clear-urlrequest-graveyard") { | 634 if (command == "clear-urlrequest-graveyard") { |
619 context->url_request_tracker()->ClearRecentlyDeceased(); | 635 GetURLRequestTracker(context)->ClearRecentlyDeceased(); |
620 return true; | 636 return true; |
621 } | 637 } |
622 | 638 |
623 if (command == "clear-socketstream-graveyard") { | 639 if (command == "clear-socketstream-graveyard") { |
624 context->socket_stream_tracker()->ClearRecentlyDeceased(); | 640 GetSocketStreamTracker(context)->ClearRecentlyDeceased(); |
625 return true; | 641 return true; |
626 } | 642 } |
627 | 643 |
628 if (command == "clear-hostcache") { | 644 if (command == "clear-hostcache") { |
629 net::HostCache* host_cache = GetHostCache(context); | 645 net::HostCache* host_cache = GetHostCache(context); |
630 if (host_cache) | 646 if (host_cache) |
631 host_cache->clear(); | 647 host_cache->clear(); |
632 return true; | 648 return true; |
633 } | 649 } |
634 | 650 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 SplitString(commands_str, ',', &commands); | 683 SplitString(commands_str, ',', &commands); |
668 | 684 |
669 for (size_t i = 0; i < commands.size(); ++i) | 685 for (size_t i = 0; i < commands.size(); ++i) |
670 HandleCommand(commands[i], context); | 686 HandleCommand(commands[i], context); |
671 } | 687 } |
672 | 688 |
673 // Appends some HTML controls to |data| that allow the user to enable full | 689 // Appends some HTML controls to |data| that allow the user to enable full |
674 // logging, and clear some of the already logged data. | 690 // logging, and clear some of the already logged data. |
675 void DrawControlsHeader(URLRequestContext* context, std::string* data) { | 691 void DrawControlsHeader(URLRequestContext* context, std::string* data) { |
676 bool is_full_logging_enabled = | 692 bool is_full_logging_enabled = |
677 context->url_request_tracker()->IsUnbounded() && | 693 GetURLRequestTracker(context)->IsUnbounded() && |
678 context->socket_stream_tracker()->IsUnbounded(); | 694 GetSocketStreamTracker(context)->IsUnbounded(); |
679 | 695 |
680 data->append("<div style='margin-bottom: 10px'>"); | 696 data->append("<div style='margin-bottom: 10px'>"); |
681 | 697 |
682 if (is_full_logging_enabled) { | 698 if (is_full_logging_enabled) { |
683 DrawCommandButton("Disable full logging", "full-logging-disable", data); | 699 DrawCommandButton("Disable full logging", "full-logging-disable", data); |
684 } else { | 700 } else { |
685 DrawCommandButton("Enable full logging", "full-logging-enable", data); | 701 DrawCommandButton("Enable full logging", "full-logging-enable", data); |
686 } | 702 } |
687 | 703 |
688 DrawCommandButton("Clear all data", | 704 DrawCommandButton("Clear all data", |
689 // Send a list of comma separated commands: | 705 // Send a list of comma separated commands: |
690 "clear-badproxies," | 706 "clear-badproxies," |
691 "clear-hostcache," | 707 "clear-hostcache," |
692 "clear-urlrequest-graveyard," | 708 "clear-urlrequest-graveyard," |
693 "clear-socketstream-graveyard," | 709 "clear-socketstream-graveyard," |
694 "clear-hostresolver-trace", | 710 "clear-hostresolver-trace", |
695 data); | 711 data); |
696 | 712 |
697 data->append("</div>"); | 713 data->append("</div>"); |
698 } | 714 } |
699 | 715 |
700 bool ViewNetInternalsJob::GetData(std::string* mime_type, | 716 bool ViewNetInternalsJob::GetData(std::string* mime_type, |
701 std::string* charset, | 717 std::string* charset, |
702 std::string* data) const { | 718 std::string* data) const { |
703 mime_type->assign("text/html"); | 719 mime_type->assign("text/html"); |
704 charset->assign("UTF-8"); | 720 charset->assign("UTF-8"); |
705 | 721 |
706 URLRequestContext* context = request_->context(); | 722 URLRequestContext* context = |
| 723 static_cast<URLRequestContext*>(request_->context()); |
707 | 724 |
708 data->clear(); | 725 data->clear(); |
709 | 726 |
710 // Use a different handler for "view-cache/*" subpaths. | 727 // Use a different handler for "view-cache/*" subpaths. |
711 std::string cache_key; | 728 std::string cache_key; |
712 if (GetViewCacheKeyForRequest(&cache_key)) { | 729 if (GetViewCacheKeyForRequest(&cache_key)) { |
713 GURL url = MakeURL(kViewHttpCacheSubPath + std::string("/")); | 730 GURL url = MakeURL(kViewHttpCacheSubPath + std::string("/")); |
714 ViewCacheHelper::GetEntryInfoHTML(cache_key, context, url.spec(), data); | 731 ViewCacheHelper::GetEntryInfoHTML(cache_key, context, url.spec(), data); |
715 return true; | 732 return true; |
716 } | 733 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 return StartsWithASCII(url.spec(), | 830 return StartsWithASCII(url.spec(), |
814 chrome::kNetworkViewInternalsURL, | 831 chrome::kNetworkViewInternalsURL, |
815 true /*case_sensitive*/); | 832 true /*case_sensitive*/); |
816 } | 833 } |
817 | 834 |
818 // static | 835 // static |
819 URLRequestJob* ViewNetInternalsJobFactory::CreateJobForRequest( | 836 URLRequestJob* ViewNetInternalsJobFactory::CreateJobForRequest( |
820 URLRequest* request) { | 837 URLRequest* request) { |
821 return new ViewNetInternalsJob(request); | 838 return new ViewNetInternalsJob(request); |
822 } | 839 } |
OLD | NEW |