| 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 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/io_thread.h" | 36 #include "chrome/browser/io_thread.h" |
| 37 #include "chrome/browser/net/chrome_net_log.h" | 37 #include "chrome/browser/net/chrome_net_log.h" |
| 38 #include "chrome/browser/net/chrome_network_delegate.h" | 38 #include "chrome/browser/net/chrome_network_delegate.h" |
| 39 #include "chrome/browser/net/connection_tester.h" | 39 #include "chrome/browser/net/connection_tester.h" |
| 40 #include "chrome/browser/prerender/prerender_manager.h" | 40 #include "chrome/browser/prerender/prerender_manager.h" |
| 41 #include "chrome/browser/prerender/prerender_manager_factory.h" | 41 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 42 #include "chrome/browser/profiles/profile.h" | 42 #include "chrome/browser/profiles/profile.h" |
| 43 #include "chrome/common/chrome_paths.h" | 43 #include "chrome/common/chrome_paths.h" |
| 44 #include "chrome/common/chrome_version_info.h" | 44 #include "chrome/common/chrome_version_info.h" |
| 45 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
| 46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
| 46 #include "components/onc/onc_constants.h" | 47 #include "components/onc/onc_constants.h" |
| 47 #include "components/url_fixer/url_fixer.h" | 48 #include "components/url_fixer/url_fixer.h" |
| 48 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
| 49 #include "content/public/browser/notification_details.h" | 50 #include "content/public/browser/notification_details.h" |
| 50 #include "content/public/browser/resource_dispatcher_host.h" | 51 #include "content/public/browser/resource_dispatcher_host.h" |
| 51 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
| 52 #include "content/public/browser/web_ui.h" | 53 #include "content/public/browser/web_ui.h" |
| 53 #include "content/public/browser/web_ui_data_source.h" | 54 #include "content/public/browser/web_ui_data_source.h" |
| 54 #include "content/public/browser/web_ui_message_handler.h" | 55 #include "content/public/browser/web_ui_message_handler.h" |
| 55 #include "grit/net_internals_resources.h" | 56 #include "grit/net_internals_resources.h" |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 value = prerender_manager->GetAsValue(); | 646 value = prerender_manager->GetAsValue(); |
| 646 } | 647 } |
| 647 SendJavascriptCommand("receivedPrerenderInfo", value); | 648 SendJavascriptCommand("receivedPrerenderInfo", value); |
| 648 } | 649 } |
| 649 | 650 |
| 650 void NetInternalsMessageHandler::OnGetHistoricNetworkStats( | 651 void NetInternalsMessageHandler::OnGetHistoricNetworkStats( |
| 651 const base::ListValue* list) { | 652 const base::ListValue* list) { |
| 652 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 653 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 653 Profile* profile = Profile::FromWebUI(web_ui()); | 654 Profile* profile = Profile::FromWebUI(web_ui()); |
| 654 base::Value* historic_network_info = | 655 base::Value* historic_network_info = |
| 655 ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue( | 656 data_reduction_proxy::DataReductionProxyNetworkDelegate:: |
| 656 profile->GetPrefs()); | 657 HistoricNetworkStatsInfoToValue(profile->GetPrefs()); |
| 657 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info); | 658 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info); |
| 658 } | 659 } |
| 659 | 660 |
| 660 void NetInternalsMessageHandler::OnGetExtensionInfo( | 661 void NetInternalsMessageHandler::OnGetExtensionInfo( |
| 661 const base::ListValue* list) { | 662 const base::ListValue* list) { |
| 662 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 663 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 663 base::ListValue* extension_list = new base::ListValue(); | 664 base::ListValue* extension_list = new base::ListValue(); |
| 664 #if defined(ENABLE_EXTENSIONS) | 665 #if defined(ENABLE_EXTENSIONS) |
| 665 Profile* profile = Profile::FromWebUI(web_ui()); | 666 Profile* profile = Profile::FromWebUI(web_ui()); |
| 666 extensions::ExtensionSystem* extension_system = | 667 extensions::ExtensionSystem* extension_system = |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 } | 1059 } |
| 1059 | 1060 |
| 1060 void NetInternalsMessageHandler::IOThreadImpl::OnGetSessionNetworkStats( | 1061 void NetInternalsMessageHandler::IOThreadImpl::OnGetSessionNetworkStats( |
| 1061 const base::ListValue* list) { | 1062 const base::ListValue* list) { |
| 1062 DCHECK(!list); | 1063 DCHECK(!list); |
| 1063 net::HttpNetworkSession* http_network_session = | 1064 net::HttpNetworkSession* http_network_session = |
| 1064 GetHttpNetworkSession(main_context_getter_->GetURLRequestContext()); | 1065 GetHttpNetworkSession(main_context_getter_->GetURLRequestContext()); |
| 1065 | 1066 |
| 1066 base::Value* network_info = NULL; | 1067 base::Value* network_info = NULL; |
| 1067 if (http_network_session) { | 1068 if (http_network_session) { |
| 1068 ChromeNetworkDelegate* net_delegate = | 1069 data_reduction_proxy::DataReductionProxyNetworkDelegate* net_delegate = |
| 1069 static_cast<ChromeNetworkDelegate*>( | 1070 static_cast<data_reduction_proxy::DataReductionProxyNetworkDelegate*>( |
| 1070 http_network_session->network_delegate()); | 1071 http_network_session->network_delegate()); |
| 1071 if (net_delegate) { | 1072 if (net_delegate) { |
| 1072 network_info = net_delegate->SessionNetworkStatsInfoToValue(); | 1073 network_info = net_delegate->SessionNetworkStatsInfoToValue(); |
| 1073 } | 1074 } |
| 1074 } | 1075 } |
| 1075 SendJavascriptCommand("receivedSessionNetworkStats", network_info); | 1076 SendJavascriptCommand("receivedSessionNetworkStats", network_info); |
| 1076 } | 1077 } |
| 1077 | 1078 |
| 1078 void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools( | 1079 void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools( |
| 1079 const base::ListValue* list) { | 1080 const base::ListValue* list) { |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 } | 1437 } |
| 1437 | 1438 |
| 1438 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1439 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1439 : WebUIController(web_ui) { | 1440 : WebUIController(web_ui) { |
| 1440 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1441 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1441 | 1442 |
| 1442 // Set up the chrome://net-internals/ source. | 1443 // Set up the chrome://net-internals/ source. |
| 1443 Profile* profile = Profile::FromWebUI(web_ui); | 1444 Profile* profile = Profile::FromWebUI(web_ui); |
| 1444 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1445 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 1445 } | 1446 } |
| OLD | NEW |