| 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 27 matching lines...) Expand all Loading... |
| 38 #include "chrome/browser/net/connection_tester.h" | 38 #include "chrome/browser/net/connection_tester.h" |
| 39 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 39 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 40 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 40 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
| 41 #include "chrome/browser/prerender/prerender_manager.h" | 41 #include "chrome/browser/prerender/prerender_manager.h" |
| 42 #include "chrome/browser/prerender/prerender_manager_factory.h" | 42 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 43 #include "chrome/browser/profiles/profile.h" | 43 #include "chrome/browser/profiles/profile.h" |
| 44 #include "chrome/common/chrome_paths.h" | 44 #include "chrome/common/chrome_paths.h" |
| 45 #include "chrome/common/chrome_version_info.h" | 45 #include "chrome/common/chrome_version_info.h" |
| 46 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
| 47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" | 47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
| 48 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
| 49 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" |
| 48 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" | 50 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" |
| 49 #include "components/onc/onc_constants.h" | 51 #include "components/onc/onc_constants.h" |
| 50 #include "components/url_fixer/url_fixer.h" | 52 #include "components/url_fixer/url_fixer.h" |
| 51 #include "content/public/browser/browser_thread.h" | 53 #include "content/public/browser/browser_thread.h" |
| 52 #include "content/public/browser/notification_details.h" | 54 #include "content/public/browser/notification_details.h" |
| 53 #include "content/public/browser/resource_dispatcher_host.h" | 55 #include "content/public/browser/resource_dispatcher_host.h" |
| 54 #include "content/public/browser/web_contents.h" | 56 #include "content/public/browser/web_contents.h" |
| 55 #include "content/public/browser/web_ui.h" | 57 #include "content/public/browser/web_ui.h" |
| 56 #include "content/public/browser/web_ui_data_source.h" | 58 #include "content/public/browser/web_ui_data_source.h" |
| 57 #include "content/public/browser/web_ui_message_handler.h" | 59 #include "content/public/browser/web_ui_message_handler.h" |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 } else { | 579 } else { |
| 578 value = prerender_manager->GetAsValue(); | 580 value = prerender_manager->GetAsValue(); |
| 579 } | 581 } |
| 580 SendJavascriptCommand("receivedPrerenderInfo", value); | 582 SendJavascriptCommand("receivedPrerenderInfo", value); |
| 581 } | 583 } |
| 582 | 584 |
| 583 void NetInternalsMessageHandler::OnGetHistoricNetworkStats( | 585 void NetInternalsMessageHandler::OnGetHistoricNetworkStats( |
| 584 const base::ListValue* list) { | 586 const base::ListValue* list) { |
| 585 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 587 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 586 Profile* profile = Profile::FromWebUI(web_ui()); | 588 Profile* profile = Profile::FromWebUI(web_ui()); |
| 589 DataReductionProxyChromeSettings* data_reduction_proxy_settings = |
| 590 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); |
| 591 data_reduction_proxy::DataReductionProxyStatisticsPrefs* statistics_prefs = |
| 592 data_reduction_proxy_settings->data_reduction_proxy_service()-> |
| 593 statistics_prefs(); |
| 587 base::Value* historic_network_info = | 594 base::Value* historic_network_info = |
| 588 data_reduction_proxy::DataReductionProxyNetworkDelegate:: | 595 statistics_prefs->HistoricNetworkStatsInfoToValue(); |
| 589 HistoricNetworkStatsInfoToValue(profile->GetPrefs()); | |
| 590 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info); | 596 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info); |
| 591 } | 597 } |
| 592 | 598 |
| 593 void NetInternalsMessageHandler::OnGetExtensionInfo( | 599 void NetInternalsMessageHandler::OnGetExtensionInfo( |
| 594 const base::ListValue* list) { | 600 const base::ListValue* list) { |
| 595 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 601 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 596 base::ListValue* extension_list = new base::ListValue(); | 602 base::ListValue* extension_list = new base::ListValue(); |
| 597 #if defined(ENABLE_EXTENSIONS) | 603 #if defined(ENABLE_EXTENSIONS) |
| 598 Profile* profile = Profile::FromWebUI(web_ui()); | 604 Profile* profile = Profile::FromWebUI(web_ui()); |
| 599 extensions::ExtensionSystem* extension_system = | 605 extensions::ExtensionSystem* extension_system = |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 } | 1286 } |
| 1281 | 1287 |
| 1282 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1288 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1283 : WebUIController(web_ui) { | 1289 : WebUIController(web_ui) { |
| 1284 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1290 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1285 | 1291 |
| 1286 // Set up the chrome://net-internals/ source. | 1292 // Set up the chrome://net-internals/ source. |
| 1287 Profile* profile = Profile::FromWebUI(web_ui); | 1293 Profile* profile = Profile::FromWebUI(web_ui); |
| 1288 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1294 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 1289 } | 1295 } |
| OLD | NEW |