| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 void OnHSTSAdd(const ListValue* list); | 507 void OnHSTSAdd(const ListValue* list); |
| 508 void OnHSTSDelete(const ListValue* list); | 508 void OnHSTSDelete(const ListValue* list); |
| 509 void OnGetHttpCacheInfo(const ListValue* list); | 509 void OnGetHttpCacheInfo(const ListValue* list); |
| 510 void OnGetSocketPoolInfo(const ListValue* list); | 510 void OnGetSocketPoolInfo(const ListValue* list); |
| 511 void OnGetSessionNetworkStats(const ListValue* list); | 511 void OnGetSessionNetworkStats(const ListValue* list); |
| 512 void OnCloseIdleSockets(const ListValue* list); | 512 void OnCloseIdleSockets(const ListValue* list); |
| 513 void OnFlushSocketPools(const ListValue* list); | 513 void OnFlushSocketPools(const ListValue* list); |
| 514 void OnGetSpdySessionInfo(const ListValue* list); | 514 void OnGetSpdySessionInfo(const ListValue* list); |
| 515 void OnGetSpdyStatus(const ListValue* list); | 515 void OnGetSpdyStatus(const ListValue* list); |
| 516 void OnGetSpdyAlternateProtocolMappings(const ListValue* list); | 516 void OnGetSpdyAlternateProtocolMappings(const ListValue* list); |
| 517 void OnGetQuicInfo(const ListValue* list); |
| 517 #if defined(OS_WIN) | 518 #if defined(OS_WIN) |
| 518 void OnGetServiceProviders(const ListValue* list); | 519 void OnGetServiceProviders(const ListValue* list); |
| 519 #endif | 520 #endif |
| 520 void OnGetHttpPipeliningStatus(const ListValue* list); | 521 void OnGetHttpPipeliningStatus(const ListValue* list); |
| 521 void OnSetLogLevel(const ListValue* list); | 522 void OnSetLogLevel(const ListValue* list); |
| 522 | 523 |
| 523 // ChromeNetLog::ThreadSafeObserver implementation: | 524 // ChromeNetLog::ThreadSafeObserver implementation: |
| 524 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | 525 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; |
| 525 | 526 |
| 526 // ConnectionTester::Delegate implementation: | 527 // ConnectionTester::Delegate implementation: |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 base::Bind(&IOThreadImpl::CallbackHelper, | 716 base::Bind(&IOThreadImpl::CallbackHelper, |
| 716 &IOThreadImpl::OnGetSpdySessionInfo, proxy_)); | 717 &IOThreadImpl::OnGetSpdySessionInfo, proxy_)); |
| 717 web_ui()->RegisterMessageCallback( | 718 web_ui()->RegisterMessageCallback( |
| 718 "getSpdyStatus", | 719 "getSpdyStatus", |
| 719 base::Bind(&IOThreadImpl::CallbackHelper, | 720 base::Bind(&IOThreadImpl::CallbackHelper, |
| 720 &IOThreadImpl::OnGetSpdyStatus, proxy_)); | 721 &IOThreadImpl::OnGetSpdyStatus, proxy_)); |
| 721 web_ui()->RegisterMessageCallback( | 722 web_ui()->RegisterMessageCallback( |
| 722 "getSpdyAlternateProtocolMappings", | 723 "getSpdyAlternateProtocolMappings", |
| 723 base::Bind(&IOThreadImpl::CallbackHelper, | 724 base::Bind(&IOThreadImpl::CallbackHelper, |
| 724 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings, proxy_)); | 725 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings, proxy_)); |
| 726 web_ui()->RegisterMessageCallback( |
| 727 "getQuicInfo", |
| 728 base::Bind(&IOThreadImpl::CallbackHelper, |
| 729 &IOThreadImpl::OnGetQuicInfo, proxy_)); |
| 725 #if defined(OS_WIN) | 730 #if defined(OS_WIN) |
| 726 web_ui()->RegisterMessageCallback( | 731 web_ui()->RegisterMessageCallback( |
| 727 "getServiceProviders", | 732 "getServiceProviders", |
| 728 base::Bind(&IOThreadImpl::CallbackHelper, | 733 base::Bind(&IOThreadImpl::CallbackHelper, |
| 729 &IOThreadImpl::OnGetServiceProviders, proxy_)); | 734 &IOThreadImpl::OnGetServiceProviders, proxy_)); |
| 730 #endif | 735 #endif |
| 731 | 736 |
| 732 web_ui()->RegisterMessageCallback( | 737 web_ui()->RegisterMessageCallback( |
| 733 "getHttpPipeliningStatus", | 738 "getHttpPipeliningStatus", |
| 734 base::Bind(&IOThreadImpl::CallbackHelper, | 739 base::Bind(&IOThreadImpl::CallbackHelper, |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 it != map.end(); ++it) { | 1423 it != map.end(); ++it) { |
| 1419 DictionaryValue* dict = new DictionaryValue(); | 1424 DictionaryValue* dict = new DictionaryValue(); |
| 1420 dict->SetString("host_port_pair", it->first.ToString()); | 1425 dict->SetString("host_port_pair", it->first.ToString()); |
| 1421 dict->SetString("alternate_protocol", it->second.ToString()); | 1426 dict->SetString("alternate_protocol", it->second.ToString()); |
| 1422 dict_list->Append(dict); | 1427 dict_list->Append(dict); |
| 1423 } | 1428 } |
| 1424 | 1429 |
| 1425 SendJavascriptCommand("receivedSpdyAlternateProtocolMappings", dict_list); | 1430 SendJavascriptCommand("receivedSpdyAlternateProtocolMappings", dict_list); |
| 1426 } | 1431 } |
| 1427 | 1432 |
| 1433 void NetInternalsMessageHandler::IOThreadImpl::OnGetQuicInfo( |
| 1434 const ListValue* list) { |
| 1435 DCHECK(!list); |
| 1436 net::HttpNetworkSession* http_network_session = |
| 1437 GetHttpNetworkSession(GetMainContext()); |
| 1438 |
| 1439 Value* quic_info = http_network_session ? |
| 1440 http_network_session->QuicInfoToValue() : NULL; |
| 1441 SendJavascriptCommand("receivedQuicInfo", quic_info); |
| 1442 } |
| 1443 |
| 1428 #if defined(OS_WIN) | 1444 #if defined(OS_WIN) |
| 1429 void NetInternalsMessageHandler::IOThreadImpl::OnGetServiceProviders( | 1445 void NetInternalsMessageHandler::IOThreadImpl::OnGetServiceProviders( |
| 1430 const ListValue* list) { | 1446 const ListValue* list) { |
| 1431 DCHECK(!list); | 1447 DCHECK(!list); |
| 1432 | 1448 |
| 1433 DictionaryValue* service_providers = new DictionaryValue(); | 1449 DictionaryValue* service_providers = new DictionaryValue(); |
| 1434 | 1450 |
| 1435 WinsockLayeredServiceProviderList layered_providers; | 1451 WinsockLayeredServiceProviderList layered_providers; |
| 1436 GetWinsockLayeredServiceProviders(&layered_providers); | 1452 GetWinsockLayeredServiceProviders(&layered_providers); |
| 1437 ListValue* layered_provider_list = new ListValue(); | 1453 ListValue* layered_provider_list = new ListValue(); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 } | 1929 } |
| 1914 | 1930 |
| 1915 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1931 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1916 : WebUIController(web_ui) { | 1932 : WebUIController(web_ui) { |
| 1917 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1933 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1918 | 1934 |
| 1919 // Set up the chrome://net-internals/ source. | 1935 // Set up the chrome://net-internals/ source. |
| 1920 Profile* profile = Profile::FromWebUI(web_ui); | 1936 Profile* profile = Profile::FromWebUI(web_ui); |
| 1921 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); | 1937 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); |
| 1922 } | 1938 } |
| OLD | NEW |