| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 // Javascript message handlers: | 549 // Javascript message handlers: |
| 550 //-------------------------------- | 550 //-------------------------------- |
| 551 | 551 |
| 552 void OnRendererReady(const ListValue* list); | 552 void OnRendererReady(const ListValue* list); |
| 553 | 553 |
| 554 void OnGetProxySettings(const ListValue* list); | 554 void OnGetProxySettings(const ListValue* list); |
| 555 void OnReloadProxySettings(const ListValue* list); | 555 void OnReloadProxySettings(const ListValue* list); |
| 556 void OnGetBadProxies(const ListValue* list); | 556 void OnGetBadProxies(const ListValue* list); |
| 557 void OnClearBadProxies(const ListValue* list); | 557 void OnClearBadProxies(const ListValue* list); |
| 558 void OnGetHostResolverInfo(const ListValue* list); | 558 void OnGetHostResolverInfo(const ListValue* list); |
| 559 void OnRunIPv6Probe(const ListValue* list); | |
| 560 void OnClearHostResolverCache(const ListValue* list); | 559 void OnClearHostResolverCache(const ListValue* list); |
| 561 void OnEnableIPv6(const ListValue* list); | 560 void OnEnableIPv6(const ListValue* list); |
| 562 void OnStartConnectionTests(const ListValue* list); | 561 void OnStartConnectionTests(const ListValue* list); |
| 563 void OnHSTSQuery(const ListValue* list); | 562 void OnHSTSQuery(const ListValue* list); |
| 564 void OnHSTSAdd(const ListValue* list); | 563 void OnHSTSAdd(const ListValue* list); |
| 565 void OnHSTSDelete(const ListValue* list); | 564 void OnHSTSDelete(const ListValue* list); |
| 566 void OnGetHttpCacheInfo(const ListValue* list); | 565 void OnGetHttpCacheInfo(const ListValue* list); |
| 567 void OnGetSocketPoolInfo(const ListValue* list); | 566 void OnGetSocketPoolInfo(const ListValue* list); |
| 568 void OnGetSessionNetworkStats(const ListValue* list); | 567 void OnGetSessionNetworkStats(const ListValue* list); |
| 569 void OnCloseIdleSockets(const ListValue* list); | 568 void OnCloseIdleSockets(const ListValue* list); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 &IOThreadImpl::OnGetBadProxies, proxy_)); | 713 &IOThreadImpl::OnGetBadProxies, proxy_)); |
| 715 web_ui()->RegisterMessageCallback( | 714 web_ui()->RegisterMessageCallback( |
| 716 "clearBadProxies", | 715 "clearBadProxies", |
| 717 base::Bind(&IOThreadImpl::CallbackHelper, | 716 base::Bind(&IOThreadImpl::CallbackHelper, |
| 718 &IOThreadImpl::OnClearBadProxies, proxy_)); | 717 &IOThreadImpl::OnClearBadProxies, proxy_)); |
| 719 web_ui()->RegisterMessageCallback( | 718 web_ui()->RegisterMessageCallback( |
| 720 "getHostResolverInfo", | 719 "getHostResolverInfo", |
| 721 base::Bind(&IOThreadImpl::CallbackHelper, | 720 base::Bind(&IOThreadImpl::CallbackHelper, |
| 722 &IOThreadImpl::OnGetHostResolverInfo, proxy_)); | 721 &IOThreadImpl::OnGetHostResolverInfo, proxy_)); |
| 723 web_ui()->RegisterMessageCallback( | 722 web_ui()->RegisterMessageCallback( |
| 724 "onRunIPv6Probe", | |
| 725 base::Bind(&IOThreadImpl::CallbackHelper, | |
| 726 &IOThreadImpl::OnRunIPv6Probe, proxy_)); | |
| 727 web_ui()->RegisterMessageCallback( | |
| 728 "clearHostResolverCache", | 723 "clearHostResolverCache", |
| 729 base::Bind(&IOThreadImpl::CallbackHelper, | 724 base::Bind(&IOThreadImpl::CallbackHelper, |
| 730 &IOThreadImpl::OnClearHostResolverCache, proxy_)); | 725 &IOThreadImpl::OnClearHostResolverCache, proxy_)); |
| 731 web_ui()->RegisterMessageCallback( | 726 web_ui()->RegisterMessageCallback( |
| 732 "enableIPv6", | 727 "enableIPv6", |
| 733 base::Bind(&IOThreadImpl::CallbackHelper, | 728 base::Bind(&IOThreadImpl::CallbackHelper, |
| 734 &IOThreadImpl::OnEnableIPv6, proxy_)); | 729 &IOThreadImpl::OnEnableIPv6, proxy_)); |
| 735 web_ui()->RegisterMessageCallback( | 730 web_ui()->RegisterMessageCallback( |
| 736 "startConnectionTests", | 731 "startConnectionTests", |
| 737 base::Bind(&IOThreadImpl::CallbackHelper, | 732 base::Bind(&IOThreadImpl::CallbackHelper, |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 | 1195 |
| 1201 entry_list->Append(entry_dict); | 1196 entry_list->Append(entry_dict); |
| 1202 } | 1197 } |
| 1203 | 1198 |
| 1204 cache_info_dict->Set("entries", entry_list); | 1199 cache_info_dict->Set("entries", entry_list); |
| 1205 dict->Set("cache", cache_info_dict); | 1200 dict->Set("cache", cache_info_dict); |
| 1206 | 1201 |
| 1207 SendJavascriptCommand("receivedHostResolverInfo", dict); | 1202 SendJavascriptCommand("receivedHostResolverInfo", dict); |
| 1208 } | 1203 } |
| 1209 | 1204 |
| 1210 void NetInternalsMessageHandler::IOThreadImpl::OnRunIPv6Probe( | |
| 1211 const ListValue* list) { | |
| 1212 DCHECK(!list); | |
| 1213 net::HostResolver* resolver = GetMainContext()->host_resolver(); | |
| 1214 | |
| 1215 // Have to set the default address family manually before calling | |
| 1216 // ProbeIPv6Support. | |
| 1217 resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_UNSPECIFIED); | |
| 1218 resolver->ProbeIPv6Support(); | |
| 1219 } | |
| 1220 | |
| 1221 void NetInternalsMessageHandler::IOThreadImpl::OnClearHostResolverCache( | 1205 void NetInternalsMessageHandler::IOThreadImpl::OnClearHostResolverCache( |
| 1222 const ListValue* list) { | 1206 const ListValue* list) { |
| 1223 DCHECK(!list); | 1207 DCHECK(!list); |
| 1224 net::HostCache* cache = GetHostResolverCache(GetMainContext()); | 1208 net::HostCache* cache = GetHostResolverCache(GetMainContext()); |
| 1225 | 1209 |
| 1226 if (cache) | 1210 if (cache) |
| 1227 cache->clear(); | 1211 cache->clear(); |
| 1228 | 1212 |
| 1229 // Cause the renderer to be notified of the new values. | 1213 // Cause the renderer to be notified of the new values. |
| 1230 OnGetHostResolverInfo(NULL); | 1214 OnGetHostResolverInfo(NULL); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 } | 1877 } |
| 1894 | 1878 |
| 1895 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1879 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1896 : WebUIController(web_ui) { | 1880 : WebUIController(web_ui) { |
| 1897 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1881 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1898 | 1882 |
| 1899 // Set up the chrome://net-internals/ source. | 1883 // Set up the chrome://net-internals/ source. |
| 1900 Profile* profile = Profile::FromWebUI(web_ui); | 1884 Profile* profile = Profile::FromWebUI(web_ui); |
| 1901 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1885 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 1902 } | 1886 } |
| OLD | NEW |