| 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 18 matching lines...) Expand all Loading... |
| 29 #include "base/values.h" | 29 #include "base/values.h" |
| 30 #include "chrome/browser/api/prefs/pref_member.h" | 30 #include "chrome/browser/api/prefs/pref_member.h" |
| 31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
| 32 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 32 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 33 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 33 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 34 #include "chrome/browser/download/download_util.h" | 34 #include "chrome/browser/download/download_util.h" |
| 35 #include "chrome/browser/io_thread.h" | 35 #include "chrome/browser/io_thread.h" |
| 36 #include "chrome/browser/net/chrome_net_log.h" | 36 #include "chrome/browser/net/chrome_net_log.h" |
| 37 #include "chrome/browser/net/chrome_network_delegate.h" | 37 #include "chrome/browser/net/chrome_network_delegate.h" |
| 38 #include "chrome/browser/net/connection_tester.h" | 38 #include "chrome/browser/net/connection_tester.h" |
| 39 #include "chrome/browser/net/net_log_logger.h" |
| 39 #include "chrome/browser/net/url_fixer_upper.h" | 40 #include "chrome/browser/net/url_fixer_upper.h" |
| 40 #include "chrome/browser/prerender/prerender_manager.h" | 41 #include "chrome/browser/prerender/prerender_manager.h" |
| 41 #include "chrome/browser/prerender/prerender_manager_factory.h" | 42 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 42 #include "chrome/browser/profiles/profile.h" | 43 #include "chrome/browser/profiles/profile.h" |
| 43 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 44 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 44 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 45 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 45 #include "chrome/common/cancelable_task_tracker.h" | 46 #include "chrome/common/cancelable_task_tracker.h" |
| 46 #include "chrome/common/chrome_notification_types.h" | 47 #include "chrome/common/chrome_notification_types.h" |
| 47 #include "chrome/common/chrome_paths.h" | 48 #include "chrome/common/chrome_paths.h" |
| 48 #include "chrome/common/chrome_version_info.h" | 49 #include "chrome/common/chrome_version_info.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 void OnRunIPv6Probe(const ListValue* list); | 502 void OnRunIPv6Probe(const ListValue* list); |
| 502 void OnClearHostResolverCache(const ListValue* list); | 503 void OnClearHostResolverCache(const ListValue* list); |
| 503 void OnEnableIPv6(const ListValue* list); | 504 void OnEnableIPv6(const ListValue* list); |
| 504 void OnStartConnectionTests(const ListValue* list); | 505 void OnStartConnectionTests(const ListValue* list); |
| 505 void OnHSTSQuery(const ListValue* list); | 506 void OnHSTSQuery(const ListValue* list); |
| 506 void OnHSTSAdd(const ListValue* list); | 507 void OnHSTSAdd(const ListValue* list); |
| 507 void OnHSTSDelete(const ListValue* list); | 508 void OnHSTSDelete(const ListValue* list); |
| 508 void OnGetHttpCacheInfo(const ListValue* list); | 509 void OnGetHttpCacheInfo(const ListValue* list); |
| 509 void OnGetSocketPoolInfo(const ListValue* list); | 510 void OnGetSocketPoolInfo(const ListValue* list); |
| 510 void OnGetSessionNetworkStats(const ListValue* list); | 511 void OnGetSessionNetworkStats(const ListValue* list); |
| 512 void OnStartNetLog(const ListValue* list); |
| 513 void OnStopNetLog(const ListValue* list); |
| 514 void OnSendNetLog(const ListValue* list); |
| 511 void OnCloseIdleSockets(const ListValue* list); | 515 void OnCloseIdleSockets(const ListValue* list); |
| 512 void OnFlushSocketPools(const ListValue* list); | 516 void OnFlushSocketPools(const ListValue* list); |
| 513 void OnGetSpdySessionInfo(const ListValue* list); | 517 void OnGetSpdySessionInfo(const ListValue* list); |
| 514 void OnGetSpdyStatus(const ListValue* list); | 518 void OnGetSpdyStatus(const ListValue* list); |
| 515 void OnGetSpdyAlternateProtocolMappings(const ListValue* list); | 519 void OnGetSpdyAlternateProtocolMappings(const ListValue* list); |
| 516 #if defined(OS_WIN) | 520 #if defined(OS_WIN) |
| 517 void OnGetServiceProviders(const ListValue* list); | 521 void OnGetServiceProviders(const ListValue* list); |
| 518 #endif | 522 #endif |
| 519 void OnGetHttpPipeliningStatus(const ListValue* list); | 523 void OnGetHttpPipeliningStatus(const ListValue* list); |
| 520 void OnSetLogLevel(const ListValue* list); | 524 void OnSetLogLevel(const ListValue* list); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 &IOThreadImpl::OnGetHttpCacheInfo, proxy_)); | 699 &IOThreadImpl::OnGetHttpCacheInfo, proxy_)); |
| 696 web_ui()->RegisterMessageCallback( | 700 web_ui()->RegisterMessageCallback( |
| 697 "getSocketPoolInfo", | 701 "getSocketPoolInfo", |
| 698 base::Bind(&IOThreadImpl::CallbackHelper, | 702 base::Bind(&IOThreadImpl::CallbackHelper, |
| 699 &IOThreadImpl::OnGetSocketPoolInfo, proxy_)); | 703 &IOThreadImpl::OnGetSocketPoolInfo, proxy_)); |
| 700 web_ui()->RegisterMessageCallback( | 704 web_ui()->RegisterMessageCallback( |
| 701 "getSessionNetworkStats", | 705 "getSessionNetworkStats", |
| 702 base::Bind(&IOThreadImpl::CallbackHelper, | 706 base::Bind(&IOThreadImpl::CallbackHelper, |
| 703 &IOThreadImpl::OnGetSessionNetworkStats, proxy_)); | 707 &IOThreadImpl::OnGetSessionNetworkStats, proxy_)); |
| 704 web_ui()->RegisterMessageCallback( | 708 web_ui()->RegisterMessageCallback( |
| 709 "startNetLog", |
| 710 base::Bind(&IOThreadImpl::CallbackHelper, |
| 711 &IOThreadImpl::OnStartNetLog, proxy_)); |
| 712 web_ui()->RegisterMessageCallback( |
| 713 "stopNetLog", |
| 714 base::Bind(&IOThreadImpl::CallbackHelper, |
| 715 &IOThreadImpl::OnStopNetLog, proxy_)); |
| 716 web_ui()->RegisterMessageCallback( |
| 717 "sendNetLog", |
| 718 base::Bind(&IOThreadImpl::CallbackHelper, |
| 719 &IOThreadImpl::OnSendNetLog, proxy_)); |
| 720 web_ui()->RegisterMessageCallback( |
| 705 "closeIdleSockets", | 721 "closeIdleSockets", |
| 706 base::Bind(&IOThreadImpl::CallbackHelper, | 722 base::Bind(&IOThreadImpl::CallbackHelper, |
| 707 &IOThreadImpl::OnCloseIdleSockets, proxy_)); | 723 &IOThreadImpl::OnCloseIdleSockets, proxy_)); |
| 708 web_ui()->RegisterMessageCallback( | 724 web_ui()->RegisterMessageCallback( |
| 709 "flushSocketPools", | 725 "flushSocketPools", |
| 710 base::Bind(&IOThreadImpl::CallbackHelper, | 726 base::Bind(&IOThreadImpl::CallbackHelper, |
| 711 &IOThreadImpl::OnFlushSocketPools, proxy_)); | 727 &IOThreadImpl::OnFlushSocketPools, proxy_)); |
| 712 web_ui()->RegisterMessageCallback( | 728 web_ui()->RegisterMessageCallback( |
| 713 "getSpdySessionInfo", | 729 "getSpdySessionInfo", |
| 714 base::Bind(&IOThreadImpl::CallbackHelper, | 730 base::Bind(&IOThreadImpl::CallbackHelper, |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools( | 1358 void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools( |
| 1343 const ListValue* list) { | 1359 const ListValue* list) { |
| 1344 DCHECK(!list); | 1360 DCHECK(!list); |
| 1345 net::HttpNetworkSession* http_network_session = | 1361 net::HttpNetworkSession* http_network_session = |
| 1346 GetHttpNetworkSession(GetMainContext()); | 1362 GetHttpNetworkSession(GetMainContext()); |
| 1347 | 1363 |
| 1348 if (http_network_session) | 1364 if (http_network_session) |
| 1349 http_network_session->CloseAllConnections(); | 1365 http_network_session->CloseAllConnections(); |
| 1350 } | 1366 } |
| 1351 | 1367 |
| 1368 void NetInternalsMessageHandler::IOThreadImpl::OnStartNetLog( |
| 1369 const ListValue* list) { |
| 1370 DCHECK(!list); |
| 1371 NetLogLogger::StartNetLog(); |
| 1372 } |
| 1373 |
| 1374 void NetInternalsMessageHandler::IOThreadImpl::OnStopNetLog( |
| 1375 const ListValue* list) { |
| 1376 DCHECK(!list); |
| 1377 NetLogLogger::StopNetLog(); |
| 1378 } |
| 1379 |
| 1380 void NetInternalsMessageHandler::IOThreadImpl::OnSendNetLog( |
| 1381 const ListValue* list) { |
| 1382 DCHECK(!list); |
| 1383 NetLogLogger::SendNetLog(); |
| 1384 } |
| 1385 |
| 1352 void NetInternalsMessageHandler::IOThreadImpl::OnCloseIdleSockets( | 1386 void NetInternalsMessageHandler::IOThreadImpl::OnCloseIdleSockets( |
| 1353 const ListValue* list) { | 1387 const ListValue* list) { |
| 1354 DCHECK(!list); | 1388 DCHECK(!list); |
| 1355 net::HttpNetworkSession* http_network_session = | 1389 net::HttpNetworkSession* http_network_session = |
| 1356 GetHttpNetworkSession(GetMainContext()); | 1390 GetHttpNetworkSession(GetMainContext()); |
| 1357 | 1391 |
| 1358 if (http_network_session) | 1392 if (http_network_session) |
| 1359 http_network_session->CloseIdleConnections(); | 1393 http_network_session->CloseIdleConnections(); |
| 1360 } | 1394 } |
| 1361 | 1395 |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 } | 1944 } |
| 1911 | 1945 |
| 1912 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1946 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1913 : WebUIController(web_ui) { | 1947 : WebUIController(web_ui) { |
| 1914 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1948 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1915 | 1949 |
| 1916 // Set up the chrome://net-internals/ source. | 1950 // Set up the chrome://net-internals/ source. |
| 1917 Profile* profile = Profile::FromWebUI(web_ui); | 1951 Profile* profile = Profile::FromWebUI(web_ui); |
| 1918 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); | 1952 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); |
| 1919 } | 1953 } |
| OLD | NEW |