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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "content/public/browser/notification_details.h" | 50 #include "content/public/browser/notification_details.h" |
51 #include "content/public/browser/resource_dispatcher_host.h" | 51 #include "content/public/browser/resource_dispatcher_host.h" |
52 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
53 #include "content/public/browser/web_ui.h" | 53 #include "content/public/browser/web_ui.h" |
54 #include "content/public/browser/web_ui_data_source.h" | 54 #include "content/public/browser/web_ui_data_source.h" |
55 #include "content/public/browser/web_ui_message_handler.h" | 55 #include "content/public/browser/web_ui_message_handler.h" |
56 #include "grit/net_internals_resources.h" | 56 #include "grit/net_internals_resources.h" |
57 #include "net/base/net_errors.h" | 57 #include "net/base/net_errors.h" |
58 #include "net/base/net_log_logger.h" | 58 #include "net/base/net_log_logger.h" |
59 #include "net/base/net_util.h" | 59 #include "net/base/net_util.h" |
| 60 #include "net/base/sdch_manager.h" |
60 #include "net/disk_cache/disk_cache.h" | 61 #include "net/disk_cache/disk_cache.h" |
61 #include "net/dns/host_cache.h" | 62 #include "net/dns/host_cache.h" |
62 #include "net/dns/host_resolver.h" | 63 #include "net/dns/host_resolver.h" |
63 #include "net/http/http_cache.h" | 64 #include "net/http/http_cache.h" |
64 #include "net/http/http_network_layer.h" | 65 #include "net/http/http_network_layer.h" |
65 #include "net/http/http_network_session.h" | 66 #include "net/http/http_network_session.h" |
66 #include "net/http/http_server_properties.h" | 67 #include "net/http/http_server_properties.h" |
67 #include "net/http/http_stream_factory.h" | 68 #include "net/http/http_stream_factory.h" |
68 #include "net/http/transport_security_state.h" | 69 #include "net/http/transport_security_state.h" |
69 #include "net/proxy/proxy_service.h" | 70 #include "net/proxy/proxy_service.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 void OnHSTSDelete(const base::ListValue* list); | 392 void OnHSTSDelete(const base::ListValue* list); |
392 void OnGetHttpCacheInfo(const base::ListValue* list); | 393 void OnGetHttpCacheInfo(const base::ListValue* list); |
393 void OnGetSocketPoolInfo(const base::ListValue* list); | 394 void OnGetSocketPoolInfo(const base::ListValue* list); |
394 void OnGetSessionNetworkStats(const base::ListValue* list); | 395 void OnGetSessionNetworkStats(const base::ListValue* list); |
395 void OnCloseIdleSockets(const base::ListValue* list); | 396 void OnCloseIdleSockets(const base::ListValue* list); |
396 void OnFlushSocketPools(const base::ListValue* list); | 397 void OnFlushSocketPools(const base::ListValue* list); |
397 void OnGetSpdySessionInfo(const base::ListValue* list); | 398 void OnGetSpdySessionInfo(const base::ListValue* list); |
398 void OnGetSpdyStatus(const base::ListValue* list); | 399 void OnGetSpdyStatus(const base::ListValue* list); |
399 void OnGetSpdyAlternateProtocolMappings(const base::ListValue* list); | 400 void OnGetSpdyAlternateProtocolMappings(const base::ListValue* list); |
400 void OnGetQuicInfo(const base::ListValue* list); | 401 void OnGetQuicInfo(const base::ListValue* list); |
| 402 void OnGetSdchInfo(const base::ListValue* list); |
401 #if defined(OS_WIN) | 403 #if defined(OS_WIN) |
402 void OnGetServiceProviders(const base::ListValue* list); | 404 void OnGetServiceProviders(const base::ListValue* list); |
403 #endif | 405 #endif |
404 void OnSetLogLevel(const base::ListValue* list); | 406 void OnSetLogLevel(const base::ListValue* list); |
405 | 407 |
406 // ChromeNetLog::ThreadSafeObserver implementation: | 408 // ChromeNetLog::ThreadSafeObserver implementation: |
407 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | 409 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; |
408 | 410 |
409 // ConnectionTester::Delegate implementation: | 411 // ConnectionTester::Delegate implementation: |
410 virtual void OnStartConnectionTestSuite() OVERRIDE; | 412 virtual void OnStartConnectionTestSuite() OVERRIDE; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 base::Bind(&IOThreadImpl::CallbackHelper, | 600 base::Bind(&IOThreadImpl::CallbackHelper, |
599 &IOThreadImpl::OnGetSpdyStatus, proxy_)); | 601 &IOThreadImpl::OnGetSpdyStatus, proxy_)); |
600 web_ui()->RegisterMessageCallback( | 602 web_ui()->RegisterMessageCallback( |
601 "getSpdyAlternateProtocolMappings", | 603 "getSpdyAlternateProtocolMappings", |
602 base::Bind(&IOThreadImpl::CallbackHelper, | 604 base::Bind(&IOThreadImpl::CallbackHelper, |
603 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings, proxy_)); | 605 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings, proxy_)); |
604 web_ui()->RegisterMessageCallback( | 606 web_ui()->RegisterMessageCallback( |
605 "getQuicInfo", | 607 "getQuicInfo", |
606 base::Bind(&IOThreadImpl::CallbackHelper, | 608 base::Bind(&IOThreadImpl::CallbackHelper, |
607 &IOThreadImpl::OnGetQuicInfo, proxy_)); | 609 &IOThreadImpl::OnGetQuicInfo, proxy_)); |
| 610 web_ui()->RegisterMessageCallback( |
| 611 "getSdchInfo", |
| 612 base::Bind( |
| 613 &IOThreadImpl::CallbackHelper, &IOThreadImpl::OnGetSdchInfo, proxy_)); |
608 #if defined(OS_WIN) | 614 #if defined(OS_WIN) |
609 web_ui()->RegisterMessageCallback( | 615 web_ui()->RegisterMessageCallback( |
610 "getServiceProviders", | 616 "getServiceProviders", |
611 base::Bind(&IOThreadImpl::CallbackHelper, | 617 base::Bind(&IOThreadImpl::CallbackHelper, |
612 &IOThreadImpl::OnGetServiceProviders, proxy_)); | 618 &IOThreadImpl::OnGetServiceProviders, proxy_)); |
613 #endif | 619 #endif |
614 | 620 |
615 web_ui()->RegisterMessageCallback( | 621 web_ui()->RegisterMessageCallback( |
616 "setLogLevel", | 622 "setLogLevel", |
617 base::Bind(&IOThreadImpl::CallbackHelper, | 623 base::Bind(&IOThreadImpl::CallbackHelper, |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 const base::ListValue* list) { | 1345 const base::ListValue* list) { |
1340 DCHECK(!list); | 1346 DCHECK(!list); |
1341 net::HttpNetworkSession* http_network_session = | 1347 net::HttpNetworkSession* http_network_session = |
1342 GetHttpNetworkSession(GetMainContext()); | 1348 GetHttpNetworkSession(GetMainContext()); |
1343 | 1349 |
1344 base::Value* quic_info = http_network_session ? | 1350 base::Value* quic_info = http_network_session ? |
1345 http_network_session->QuicInfoToValue() : NULL; | 1351 http_network_session->QuicInfoToValue() : NULL; |
1346 SendJavascriptCommand("receivedQuicInfo", quic_info); | 1352 SendJavascriptCommand("receivedQuicInfo", quic_info); |
1347 } | 1353 } |
1348 | 1354 |
| 1355 void NetInternalsMessageHandler::IOThreadImpl::OnGetSdchInfo( |
| 1356 const base::ListValue* list) { |
| 1357 DCHECK(!list); |
| 1358 net::SdchManager* sdch_manager = GetMainContext()->sdch_manager(); |
| 1359 |
| 1360 base::Value* sdch_info = |
| 1361 sdch_manager ? sdch_manager->SdchInfoToValue() : NULL; |
| 1362 SendJavascriptCommand("receivedSdchInfo", sdch_info); |
| 1363 } |
| 1364 |
1349 #if defined(OS_WIN) | 1365 #if defined(OS_WIN) |
1350 void NetInternalsMessageHandler::IOThreadImpl::OnGetServiceProviders( | 1366 void NetInternalsMessageHandler::IOThreadImpl::OnGetServiceProviders( |
1351 const base::ListValue* list) { | 1367 const base::ListValue* list) { |
1352 DCHECK(!list); | 1368 DCHECK(!list); |
1353 | 1369 |
1354 base::DictionaryValue* service_providers = new base::DictionaryValue(); | 1370 base::DictionaryValue* service_providers = new base::DictionaryValue(); |
1355 | 1371 |
1356 WinsockLayeredServiceProviderList layered_providers; | 1372 WinsockLayeredServiceProviderList layered_providers; |
1357 GetWinsockLayeredServiceProviders(&layered_providers); | 1373 GetWinsockLayeredServiceProviders(&layered_providers); |
1358 base::ListValue* layered_provider_list = new base::ListValue(); | 1374 base::ListValue* layered_provider_list = new base::ListValue(); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 } | 1725 } |
1710 | 1726 |
1711 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1727 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1712 : WebUIController(web_ui) { | 1728 : WebUIController(web_ui) { |
1713 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1729 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1714 | 1730 |
1715 // Set up the chrome://net-internals/ source. | 1731 // Set up the chrome://net-internals/ source. |
1716 Profile* profile = Profile::FromWebUI(web_ui); | 1732 Profile* profile = Profile::FromWebUI(web_ui); |
1717 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1733 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1718 } | 1734 } |
OLD | NEW |