| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void OnClearBadProxies(const ListValue* list); | 273 void OnClearBadProxies(const ListValue* list); |
| 274 void OnGetHostResolverInfo(const ListValue* list); | 274 void OnGetHostResolverInfo(const ListValue* list); |
| 275 void OnClearHostResolverCache(const ListValue* list); | 275 void OnClearHostResolverCache(const ListValue* list); |
| 276 void OnEnableIPv6(const ListValue* list); | 276 void OnEnableIPv6(const ListValue* list); |
| 277 void OnStartConnectionTests(const ListValue* list); | 277 void OnStartConnectionTests(const ListValue* list); |
| 278 void OnHSTSQuery(const ListValue* list); | 278 void OnHSTSQuery(const ListValue* list); |
| 279 void OnHSTSAdd(const ListValue* list); | 279 void OnHSTSAdd(const ListValue* list); |
| 280 void OnHSTSDelete(const ListValue* list); | 280 void OnHSTSDelete(const ListValue* list); |
| 281 void OnGetHttpCacheInfo(const ListValue* list); | 281 void OnGetHttpCacheInfo(const ListValue* list); |
| 282 void OnGetSocketPoolInfo(const ListValue* list); | 282 void OnGetSocketPoolInfo(const ListValue* list); |
| 283 void OnCloseIdleSockets(const ListValue* list); |
| 284 void OnFlushSocketPools(const ListValue* list); |
| 283 void OnGetSpdySessionInfo(const ListValue* list); | 285 void OnGetSpdySessionInfo(const ListValue* list); |
| 284 void OnGetSpdyStatus(const ListValue* list); | 286 void OnGetSpdyStatus(const ListValue* list); |
| 285 void OnGetSpdyAlternateProtocolMappings(const ListValue* list); | 287 void OnGetSpdyAlternateProtocolMappings(const ListValue* list); |
| 286 #ifdef OS_WIN | 288 #ifdef OS_WIN |
| 287 void OnGetServiceProviders(const ListValue* list); | 289 void OnGetServiceProviders(const ListValue* list); |
| 288 #endif | 290 #endif |
| 289 | 291 |
| 290 void OnSetLogLevel(const ListValue* list); | 292 void OnSetLogLevel(const ListValue* list); |
| 291 | 293 |
| 292 // ChromeNetLog::ThreadSafeObserver implementation: | 294 // ChromeNetLog::ThreadSafeObserver implementation: |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 web_ui_->RegisterMessageCallback( | 552 web_ui_->RegisterMessageCallback( |
| 551 "hstsDelete", | 553 "hstsDelete", |
| 552 proxy_->CreateCallback(&IOThreadImpl::OnHSTSDelete)); | 554 proxy_->CreateCallback(&IOThreadImpl::OnHSTSDelete)); |
| 553 web_ui_->RegisterMessageCallback( | 555 web_ui_->RegisterMessageCallback( |
| 554 "getHttpCacheInfo", | 556 "getHttpCacheInfo", |
| 555 proxy_->CreateCallback(&IOThreadImpl::OnGetHttpCacheInfo)); | 557 proxy_->CreateCallback(&IOThreadImpl::OnGetHttpCacheInfo)); |
| 556 web_ui_->RegisterMessageCallback( | 558 web_ui_->RegisterMessageCallback( |
| 557 "getSocketPoolInfo", | 559 "getSocketPoolInfo", |
| 558 proxy_->CreateCallback(&IOThreadImpl::OnGetSocketPoolInfo)); | 560 proxy_->CreateCallback(&IOThreadImpl::OnGetSocketPoolInfo)); |
| 559 web_ui_->RegisterMessageCallback( | 561 web_ui_->RegisterMessageCallback( |
| 562 "closeIdleSockets", |
| 563 proxy_->CreateCallback(&IOThreadImpl::OnCloseIdleSockets)); |
| 564 web_ui_->RegisterMessageCallback( |
| 565 "flushSocketPools", |
| 566 proxy_->CreateCallback(&IOThreadImpl::OnFlushSocketPools)); |
| 567 web_ui_->RegisterMessageCallback( |
| 560 "getSpdySessionInfo", | 568 "getSpdySessionInfo", |
| 561 proxy_->CreateCallback(&IOThreadImpl::OnGetSpdySessionInfo)); | 569 proxy_->CreateCallback(&IOThreadImpl::OnGetSpdySessionInfo)); |
| 562 web_ui_->RegisterMessageCallback( | 570 web_ui_->RegisterMessageCallback( |
| 563 "getSpdyStatus", | 571 "getSpdyStatus", |
| 564 proxy_->CreateCallback(&IOThreadImpl::OnGetSpdyStatus)); | 572 proxy_->CreateCallback(&IOThreadImpl::OnGetSpdyStatus)); |
| 565 web_ui_->RegisterMessageCallback( | 573 web_ui_->RegisterMessageCallback( |
| 566 "getSpdyAlternateProtocolMappings", | 574 "getSpdyAlternateProtocolMappings", |
| 567 proxy_->CreateCallback( | 575 proxy_->CreateCallback( |
| 568 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings)); | 576 &IOThreadImpl::OnGetSpdyAlternateProtocolMappings)); |
| 569 #ifdef OS_WIN | 577 #ifdef OS_WIN |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 net::HttpNetworkSession* http_network_session = | 1150 net::HttpNetworkSession* http_network_session = |
| 1143 GetHttpNetworkSession(context_getter_->GetURLRequestContext()); | 1151 GetHttpNetworkSession(context_getter_->GetURLRequestContext()); |
| 1144 | 1152 |
| 1145 Value* socket_pool_info = NULL; | 1153 Value* socket_pool_info = NULL; |
| 1146 if (http_network_session) | 1154 if (http_network_session) |
| 1147 socket_pool_info = http_network_session->SocketPoolInfoToValue(); | 1155 socket_pool_info = http_network_session->SocketPoolInfoToValue(); |
| 1148 | 1156 |
| 1149 CallJavascriptFunction(L"g_browser.receivedSocketPoolInfo", socket_pool_info); | 1157 CallJavascriptFunction(L"g_browser.receivedSocketPoolInfo", socket_pool_info); |
| 1150 } | 1158 } |
| 1151 | 1159 |
| 1160 |
| 1161 void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools( |
| 1162 const ListValue* list) { |
| 1163 net::HttpNetworkSession* http_network_session = |
| 1164 GetHttpNetworkSession(context_getter_->GetURLRequestContext()); |
| 1165 |
| 1166 if (http_network_session) |
| 1167 http_network_session->CloseAllConnections(); |
| 1168 } |
| 1169 |
| 1170 void NetInternalsMessageHandler::IOThreadImpl::OnCloseIdleSockets( |
| 1171 const ListValue* list) { |
| 1172 net::HttpNetworkSession* http_network_session = |
| 1173 GetHttpNetworkSession(context_getter_->GetURLRequestContext()); |
| 1174 |
| 1175 if (http_network_session) |
| 1176 http_network_session->CloseIdleConnections(); |
| 1177 } |
| 1178 |
| 1152 void NetInternalsMessageHandler::IOThreadImpl::OnGetSpdySessionInfo( | 1179 void NetInternalsMessageHandler::IOThreadImpl::OnGetSpdySessionInfo( |
| 1153 const ListValue* list) { | 1180 const ListValue* list) { |
| 1154 net::HttpNetworkSession* http_network_session = | 1181 net::HttpNetworkSession* http_network_session = |
| 1155 GetHttpNetworkSession(context_getter_->GetURLRequestContext()); | 1182 GetHttpNetworkSession(context_getter_->GetURLRequestContext()); |
| 1156 | 1183 |
| 1157 Value* spdy_info = NULL; | 1184 Value* spdy_info = NULL; |
| 1158 if (http_network_session) { | 1185 if (http_network_session) { |
| 1159 spdy_info = http_network_session->SpdySessionPoolInfoToValue(); | 1186 spdy_info = http_network_session->SpdySessionPoolInfoToValue(); |
| 1160 } | 1187 } |
| 1161 | 1188 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 //////////////////////////////////////////////////////////////////////////////// | 1406 //////////////////////////////////////////////////////////////////////////////// |
| 1380 | 1407 |
| 1381 NetInternalsUI::NetInternalsUI(TabContents* contents) : WebUI(contents) { | 1408 NetInternalsUI::NetInternalsUI(TabContents* contents) : WebUI(contents) { |
| 1382 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); | 1409 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); |
| 1383 | 1410 |
| 1384 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); | 1411 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); |
| 1385 | 1412 |
| 1386 // Set up the chrome://net-internals/ source. | 1413 // Set up the chrome://net-internals/ source. |
| 1387 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 1414 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 1388 } | 1415 } |
| OLD | NEW |