OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/net_internals/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "content/public/browser/resource_dispatcher_host.h" | 52 #include "content/public/browser/resource_dispatcher_host.h" |
53 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
54 #include "content/public/browser/web_ui.h" | 54 #include "content/public/browser/web_ui.h" |
55 #include "content/public/browser/web_ui_data_source.h" | 55 #include "content/public/browser/web_ui_data_source.h" |
56 #include "content/public/browser/web_ui_message_handler.h" | 56 #include "content/public/browser/web_ui_message_handler.h" |
57 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
58 #include "grit/net_internals_resources.h" | 58 #include "grit/net_internals_resources.h" |
59 #include "net/base/net_errors.h" | 59 #include "net/base/net_errors.h" |
60 #include "net/base/net_log_logger.h" | 60 #include "net/base/net_log_logger.h" |
61 #include "net/base/net_util.h" | 61 #include "net/base/net_util.h" |
| 62 #include "net/base/sdch_manager.h" |
62 #include "net/disk_cache/disk_cache.h" | 63 #include "net/disk_cache/disk_cache.h" |
63 #include "net/dns/host_cache.h" | 64 #include "net/dns/host_cache.h" |
64 #include "net/dns/host_resolver.h" | 65 #include "net/dns/host_resolver.h" |
65 #include "net/http/http_cache.h" | 66 #include "net/http/http_cache.h" |
66 #include "net/http/http_network_layer.h" | 67 #include "net/http/http_network_layer.h" |
67 #include "net/http/http_network_session.h" | 68 #include "net/http/http_network_session.h" |
68 #include "net/http/http_server_properties.h" | 69 #include "net/http/http_server_properties.h" |
69 #include "net/http/http_stream_factory.h" | 70 #include "net/http/http_stream_factory.h" |
70 #include "net/http/transport_security_state.h" | 71 #include "net/http/transport_security_state.h" |
71 #include "net/proxy/proxy_service.h" | 72 #include "net/proxy/proxy_service.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 void OnHSTSDelete(const base::ListValue* list); | 466 void OnHSTSDelete(const base::ListValue* list); |
466 void OnGetHttpCacheInfo(const base::ListValue* list); | 467 void OnGetHttpCacheInfo(const base::ListValue* list); |
467 void OnGetSocketPoolInfo(const base::ListValue* list); | 468 void OnGetSocketPoolInfo(const base::ListValue* list); |
468 void OnGetSessionNetworkStats(const base::ListValue* list); | 469 void OnGetSessionNetworkStats(const base::ListValue* list); |
469 void OnCloseIdleSockets(const base::ListValue* list); | 470 void OnCloseIdleSockets(const base::ListValue* list); |
470 void OnFlushSocketPools(const base::ListValue* list); | 471 void OnFlushSocketPools(const base::ListValue* list); |
471 void OnGetSpdySessionInfo(const base::ListValue* list); | 472 void OnGetSpdySessionInfo(const base::ListValue* list); |
472 void OnGetSpdyStatus(const base::ListValue* list); | 473 void OnGetSpdyStatus(const base::ListValue* list); |
473 void OnGetSpdyAlternateProtocolMappings(const base::ListValue* list); | 474 void OnGetSpdyAlternateProtocolMappings(const base::ListValue* list); |
474 void OnGetQuicInfo(const base::ListValue* list); | 475 void OnGetQuicInfo(const base::ListValue* list); |
| 476 void OnGetSdchInfo(const base::ListValue* list); |
475 #if defined(OS_WIN) | 477 #if defined(OS_WIN) |
476 void OnGetServiceProviders(const base::ListValue* list); | 478 void OnGetServiceProviders(const base::ListValue* list); |
477 #endif | 479 #endif |
478 void OnSetLogLevel(const base::ListValue* list); | 480 void OnSetLogLevel(const base::ListValue* list); |
479 | 481 |
480 // ChromeNetLog::ThreadSafeObserver implementation: | 482 // ChromeNetLog::ThreadSafeObserver implementation: |
481 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | 483 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; |
482 | 484 |
483 // ConnectionTester::Delegate implementation: | 485 // ConnectionTester::Delegate implementation: |
484 virtual void OnStartConnectionTestSuite() OVERRIDE; | 486 virtual void OnStartConnectionTestSuite() OVERRIDE; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 base::Bind(&IOThreadImpl::CallbackHelper, | 674 base::Bind(&IOThreadImpl::CallbackHelper, |
673 &IOThreadImpl::OnGetSpdyStatus, proxy_)); | 675 &IOThreadImpl::OnGetSpdyStatus, proxy_)); |
674 web_ui()->RegisterMessageCallback( | 676 web_ui()->RegisterMessageCallback( |
675 "getSpdyAlternateProtocolMappings", | 677 "getSpdyAlternateProtocolMappings", |
676 base::Bind(&IOThreadImpl::CallbackHelper, | 678 base::Bind(&IOThreadImpl::CallbackHelper, |
677 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings, proxy_)); | 679 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings, proxy_)); |
678 web_ui()->RegisterMessageCallback( | 680 web_ui()->RegisterMessageCallback( |
679 "getQuicInfo", | 681 "getQuicInfo", |
680 base::Bind(&IOThreadImpl::CallbackHelper, | 682 base::Bind(&IOThreadImpl::CallbackHelper, |
681 &IOThreadImpl::OnGetQuicInfo, proxy_)); | 683 &IOThreadImpl::OnGetQuicInfo, proxy_)); |
| 684 web_ui()->RegisterMessageCallback( |
| 685 "getSdchInfo", |
| 686 base::Bind(&IOThreadImpl::CallbackHelper, |
| 687 &IOThreadImpl::OnGetSdchInfo, proxy_)); |
682 #if defined(OS_WIN) | 688 #if defined(OS_WIN) |
683 web_ui()->RegisterMessageCallback( | 689 web_ui()->RegisterMessageCallback( |
684 "getServiceProviders", | 690 "getServiceProviders", |
685 base::Bind(&IOThreadImpl::CallbackHelper, | 691 base::Bind(&IOThreadImpl::CallbackHelper, |
686 &IOThreadImpl::OnGetServiceProviders, proxy_)); | 692 &IOThreadImpl::OnGetServiceProviders, proxy_)); |
687 #endif | 693 #endif |
688 | 694 |
689 web_ui()->RegisterMessageCallback( | 695 web_ui()->RegisterMessageCallback( |
690 "setLogLevel", | 696 "setLogLevel", |
691 base::Bind(&IOThreadImpl::CallbackHelper, | 697 base::Bind(&IOThreadImpl::CallbackHelper, |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 const base::ListValue* list) { | 1419 const base::ListValue* list) { |
1414 DCHECK(!list); | 1420 DCHECK(!list); |
1415 net::HttpNetworkSession* http_network_session = | 1421 net::HttpNetworkSession* http_network_session = |
1416 GetHttpNetworkSession(GetMainContext()); | 1422 GetHttpNetworkSession(GetMainContext()); |
1417 | 1423 |
1418 base::Value* quic_info = http_network_session ? | 1424 base::Value* quic_info = http_network_session ? |
1419 http_network_session->QuicInfoToValue() : NULL; | 1425 http_network_session->QuicInfoToValue() : NULL; |
1420 SendJavascriptCommand("receivedQuicInfo", quic_info); | 1426 SendJavascriptCommand("receivedQuicInfo", quic_info); |
1421 } | 1427 } |
1422 | 1428 |
| 1429 void NetInternalsMessageHandler::IOThreadImpl::OnGetSdchInfo( |
| 1430 const base::ListValue* list) { |
| 1431 DCHECK(!list); |
| 1432 net::SdchManager* sdch_manager = GetMainContext()->sdch_manager(); |
| 1433 |
| 1434 base::Value* sdch_info = |
| 1435 sdch_manager ? sdch_manager->SdchInfoToValue() : NULL; |
| 1436 SendJavascriptCommand("receivedSdchInfo", sdch_info); |
| 1437 } |
| 1438 |
1423 #if defined(OS_WIN) | 1439 #if defined(OS_WIN) |
1424 void NetInternalsMessageHandler::IOThreadImpl::OnGetServiceProviders( | 1440 void NetInternalsMessageHandler::IOThreadImpl::OnGetServiceProviders( |
1425 const base::ListValue* list) { | 1441 const base::ListValue* list) { |
1426 DCHECK(!list); | 1442 DCHECK(!list); |
1427 | 1443 |
1428 base::DictionaryValue* service_providers = new base::DictionaryValue(); | 1444 base::DictionaryValue* service_providers = new base::DictionaryValue(); |
1429 | 1445 |
1430 WinsockLayeredServiceProviderList layered_providers; | 1446 WinsockLayeredServiceProviderList layered_providers; |
1431 GetWinsockLayeredServiceProviders(&layered_providers); | 1447 GetWinsockLayeredServiceProviders(&layered_providers); |
1432 base::ListValue* layered_provider_list = new base::ListValue(); | 1448 base::ListValue* layered_provider_list = new base::ListValue(); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 } | 1797 } |
1782 | 1798 |
1783 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1799 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1784 : WebUIController(web_ui) { | 1800 : WebUIController(web_ui) { |
1785 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1801 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1786 | 1802 |
1787 // Set up the chrome://net-internals/ source. | 1803 // Set up the chrome://net-internals/ source. |
1788 Profile* profile = Profile::FromWebUI(web_ui); | 1804 Profile* profile = Profile::FromWebUI(web_ui); |
1789 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1805 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1790 } | 1806 } |
OLD | NEW |