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