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