| 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 19 matching lines...) Expand all Loading... |
| 30 #include "base/values.h" | 30 #include "base/values.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/chrome_notification_types.h" | 34 #include "chrome/browser/chrome_notification_types.h" |
| 35 #include "chrome/browser/download/download_prefs.h" | 35 #include "chrome/browser/download/download_prefs.h" |
| 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/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 41 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
| 40 #include "chrome/browser/prerender/prerender_manager.h" | 42 #include "chrome/browser/prerender/prerender_manager.h" |
| 41 #include "chrome/browser/prerender/prerender_manager_factory.h" | 43 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 42 #include "chrome/browser/profiles/profile.h" | 44 #include "chrome/browser/profiles/profile.h" |
| 43 #include "chrome/common/chrome_paths.h" | 45 #include "chrome/common/chrome_paths.h" |
| 44 #include "chrome/common/chrome_version_info.h" | 46 #include "chrome/common/chrome_version_info.h" |
| 45 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
| 46 #include "components/onc/onc_constants.h" | 48 #include "components/onc/onc_constants.h" |
| 47 #include "components/url_fixer/url_fixer.h" | 49 #include "components/url_fixer/url_fixer.h" |
| 48 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
| 49 #include "content/public/browser/notification_details.h" | 51 #include "content/public/browser/notification_details.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Takes ownership of |arg|. If the renderer is displaying a log file, the | 209 // Takes ownership of |arg|. If the renderer is displaying a log file, the |
| 208 // message will be ignored. | 210 // message will be ignored. |
| 209 void SendJavascriptCommand(const std::string& command, base::Value* arg); | 211 void SendJavascriptCommand(const std::string& command, base::Value* arg); |
| 210 | 212 |
| 211 // Javascript message handlers. | 213 // Javascript message handlers. |
| 212 void OnRendererReady(const base::ListValue* list); | 214 void OnRendererReady(const base::ListValue* list); |
| 213 void OnClearBrowserCache(const base::ListValue* list); | 215 void OnClearBrowserCache(const base::ListValue* list); |
| 214 void OnGetPrerenderInfo(const base::ListValue* list); | 216 void OnGetPrerenderInfo(const base::ListValue* list); |
| 215 void OnGetHistoricNetworkStats(const base::ListValue* list); | 217 void OnGetHistoricNetworkStats(const base::ListValue* list); |
| 216 void OnGetExtensionInfo(const base::ListValue* list); | 218 void OnGetExtensionInfo(const base::ListValue* list); |
| 219 void OnGetDataReductionProxyInfo(const base::ListValue* list); |
| 217 #if defined(OS_CHROMEOS) | 220 #if defined(OS_CHROMEOS) |
| 218 void OnRefreshSystemLogs(const base::ListValue* list); | 221 void OnRefreshSystemLogs(const base::ListValue* list); |
| 219 void OnGetSystemLog(const base::ListValue* list); | 222 void OnGetSystemLog(const base::ListValue* list); |
| 220 void OnImportONCFile(const base::ListValue* list); | 223 void OnImportONCFile(const base::ListValue* list); |
| 221 void OnStoreDebugLogs(const base::ListValue* list); | 224 void OnStoreDebugLogs(const base::ListValue* list); |
| 222 void OnStoreDebugLogsCompleted(const base::FilePath& log_path, | 225 void OnStoreDebugLogsCompleted(const base::FilePath& log_path, |
| 223 bool succeeded); | 226 bool succeeded); |
| 224 void OnSetNetworkDebugMode(const base::ListValue* list); | 227 void OnSetNetworkDebugMode(const base::ListValue* list); |
| 225 void OnSetNetworkDebugModeCompleted(const std::string& subsystem, | 228 void OnSetNetworkDebugModeCompleted(const std::string& subsystem, |
| 226 bool succeeded); | 229 bool succeeded); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 base::Bind(&NetInternalsMessageHandler::OnGetPrerenderInfo, | 574 base::Bind(&NetInternalsMessageHandler::OnGetPrerenderInfo, |
| 572 base::Unretained(this))); | 575 base::Unretained(this))); |
| 573 web_ui()->RegisterMessageCallback( | 576 web_ui()->RegisterMessageCallback( |
| 574 "getHistoricNetworkStats", | 577 "getHistoricNetworkStats", |
| 575 base::Bind(&NetInternalsMessageHandler::OnGetHistoricNetworkStats, | 578 base::Bind(&NetInternalsMessageHandler::OnGetHistoricNetworkStats, |
| 576 base::Unretained(this))); | 579 base::Unretained(this))); |
| 577 web_ui()->RegisterMessageCallback( | 580 web_ui()->RegisterMessageCallback( |
| 578 "getExtensionInfo", | 581 "getExtensionInfo", |
| 579 base::Bind(&NetInternalsMessageHandler::OnGetExtensionInfo, | 582 base::Bind(&NetInternalsMessageHandler::OnGetExtensionInfo, |
| 580 base::Unretained(this))); | 583 base::Unretained(this))); |
| 584 web_ui()->RegisterMessageCallback( |
| 585 "getDataReductionProxyInfo", |
| 586 base::Bind(&NetInternalsMessageHandler::OnGetDataReductionProxyInfo, |
| 587 base::Unretained(this))); |
| 581 #if defined(OS_CHROMEOS) | 588 #if defined(OS_CHROMEOS) |
| 582 web_ui()->RegisterMessageCallback( | 589 web_ui()->RegisterMessageCallback( |
| 583 "refreshSystemLogs", | 590 "refreshSystemLogs", |
| 584 base::Bind(&NetInternalsMessageHandler::OnRefreshSystemLogs, | 591 base::Bind(&NetInternalsMessageHandler::OnRefreshSystemLogs, |
| 585 base::Unretained(this))); | 592 base::Unretained(this))); |
| 586 web_ui()->RegisterMessageCallback( | 593 web_ui()->RegisterMessageCallback( |
| 587 "getSystemLog", | 594 "getSystemLog", |
| 588 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog, | 595 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog, |
| 589 base::Unretained(this))); | 596 base::Unretained(this))); |
| 590 web_ui()->RegisterMessageCallback( | 597 web_ui()->RegisterMessageCallback( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 bool enabled = extension_service->IsExtensionEnabled((*it)->id()); | 684 bool enabled = extension_service->IsExtensionEnabled((*it)->id()); |
| 678 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); | 685 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); |
| 679 extension_list->Append(extension_info); | 686 extension_list->Append(extension_info); |
| 680 } | 687 } |
| 681 } | 688 } |
| 682 } | 689 } |
| 683 #endif | 690 #endif |
| 684 SendJavascriptCommand("receivedExtensionInfo", extension_list); | 691 SendJavascriptCommand("receivedExtensionInfo", extension_list); |
| 685 } | 692 } |
| 686 | 693 |
| 694 void NetInternalsMessageHandler::OnGetDataReductionProxyInfo( |
| 695 const base::ListValue* list) { |
| 696 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 697 Profile* profile = Profile::FromWebUI(web_ui()); |
| 698 DataReductionProxyChromeSettings* data_reduction_proxy_settings = |
| 699 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); |
| 700 base::Value* value = |
| 701 data_reduction_proxy_settings->GetEventStore()->GetSummaryValue(); |
| 702 SendJavascriptCommand("receivedDataReductionProxyInfo", value); |
| 703 } |
| 704 |
| 687 #if defined(OS_CHROMEOS) | 705 #if defined(OS_CHROMEOS) |
| 688 //////////////////////////////////////////////////////////////////////////////// | 706 //////////////////////////////////////////////////////////////////////////////// |
| 689 // | 707 // |
| 690 // NetInternalsMessageHandler::SystemLogsGetter | 708 // NetInternalsMessageHandler::SystemLogsGetter |
| 691 // | 709 // |
| 692 //////////////////////////////////////////////////////////////////////////////// | 710 //////////////////////////////////////////////////////////////////////////////// |
| 693 | 711 |
| 694 NetInternalsMessageHandler::SystemLogsGetter::SystemLogsGetter( | 712 NetInternalsMessageHandler::SystemLogsGetter::SystemLogsGetter( |
| 695 NetInternalsMessageHandler* handler, | 713 NetInternalsMessageHandler* handler, |
| 696 chromeos::system::SyslogsProvider* syslogs_provider) | 714 chromeos::system::SyslogsProvider* syslogs_provider) |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 } | 1454 } |
| 1437 | 1455 |
| 1438 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1456 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1439 : WebUIController(web_ui) { | 1457 : WebUIController(web_ui) { |
| 1440 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1458 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1441 | 1459 |
| 1442 // Set up the chrome://net-internals/ source. | 1460 // Set up the chrome://net-internals/ source. |
| 1443 Profile* profile = Profile::FromWebUI(web_ui); | 1461 Profile* profile = Profile::FromWebUI(web_ui); |
| 1444 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1462 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 1445 } | 1463 } |
| OLD | NEW |