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/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" | 48 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
47 #include "components/onc/onc_constants.h" | 49 #include "components/onc/onc_constants.h" |
48 #include "components/url_fixer/url_fixer.h" | 50 #include "components/url_fixer/url_fixer.h" |
49 #include "content/public/browser/browser_thread.h" | 51 #include "content/public/browser/browser_thread.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // Takes ownership of |arg|. If the renderer is displaying a log file, the | 210 // Takes ownership of |arg|. If the renderer is displaying a log file, the |
209 // message will be ignored. | 211 // message will be ignored. |
210 void SendJavascriptCommand(const std::string& command, base::Value* arg); | 212 void SendJavascriptCommand(const std::string& command, base::Value* arg); |
211 | 213 |
212 // Javascript message handlers. | 214 // Javascript message handlers. |
213 void OnRendererReady(const base::ListValue* list); | 215 void OnRendererReady(const base::ListValue* list); |
214 void OnClearBrowserCache(const base::ListValue* list); | 216 void OnClearBrowserCache(const base::ListValue* list); |
215 void OnGetPrerenderInfo(const base::ListValue* list); | 217 void OnGetPrerenderInfo(const base::ListValue* list); |
216 void OnGetHistoricNetworkStats(const base::ListValue* list); | 218 void OnGetHistoricNetworkStats(const base::ListValue* list); |
217 void OnGetExtensionInfo(const base::ListValue* list); | 219 void OnGetExtensionInfo(const base::ListValue* list); |
| 220 void OnGetDataReductionProxyInfo(const base::ListValue* list); |
218 #if defined(OS_CHROMEOS) | 221 #if defined(OS_CHROMEOS) |
219 void OnRefreshSystemLogs(const base::ListValue* list); | 222 void OnRefreshSystemLogs(const base::ListValue* list); |
220 void OnGetSystemLog(const base::ListValue* list); | 223 void OnGetSystemLog(const base::ListValue* list); |
221 void OnImportONCFile(const base::ListValue* list); | 224 void OnImportONCFile(const base::ListValue* list); |
222 void OnStoreDebugLogs(const base::ListValue* list); | 225 void OnStoreDebugLogs(const base::ListValue* list); |
223 void OnStoreDebugLogsCompleted(const base::FilePath& log_path, | 226 void OnStoreDebugLogsCompleted(const base::FilePath& log_path, |
224 bool succeeded); | 227 bool succeeded); |
225 void OnSetNetworkDebugMode(const base::ListValue* list); | 228 void OnSetNetworkDebugMode(const base::ListValue* list); |
226 void OnSetNetworkDebugModeCompleted(const std::string& subsystem, | 229 void OnSetNetworkDebugModeCompleted(const std::string& subsystem, |
227 bool succeeded); | 230 bool succeeded); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 base::Bind(&NetInternalsMessageHandler::OnGetPrerenderInfo, | 575 base::Bind(&NetInternalsMessageHandler::OnGetPrerenderInfo, |
573 base::Unretained(this))); | 576 base::Unretained(this))); |
574 web_ui()->RegisterMessageCallback( | 577 web_ui()->RegisterMessageCallback( |
575 "getHistoricNetworkStats", | 578 "getHistoricNetworkStats", |
576 base::Bind(&NetInternalsMessageHandler::OnGetHistoricNetworkStats, | 579 base::Bind(&NetInternalsMessageHandler::OnGetHistoricNetworkStats, |
577 base::Unretained(this))); | 580 base::Unretained(this))); |
578 web_ui()->RegisterMessageCallback( | 581 web_ui()->RegisterMessageCallback( |
579 "getExtensionInfo", | 582 "getExtensionInfo", |
580 base::Bind(&NetInternalsMessageHandler::OnGetExtensionInfo, | 583 base::Bind(&NetInternalsMessageHandler::OnGetExtensionInfo, |
581 base::Unretained(this))); | 584 base::Unretained(this))); |
| 585 web_ui()->RegisterMessageCallback( |
| 586 "getDataReductionProxyInfo", |
| 587 base::Bind(&NetInternalsMessageHandler::OnGetDataReductionProxyInfo, |
| 588 base::Unretained(this))); |
582 #if defined(OS_CHROMEOS) | 589 #if defined(OS_CHROMEOS) |
583 web_ui()->RegisterMessageCallback( | 590 web_ui()->RegisterMessageCallback( |
584 "refreshSystemLogs", | 591 "refreshSystemLogs", |
585 base::Bind(&NetInternalsMessageHandler::OnRefreshSystemLogs, | 592 base::Bind(&NetInternalsMessageHandler::OnRefreshSystemLogs, |
586 base::Unretained(this))); | 593 base::Unretained(this))); |
587 web_ui()->RegisterMessageCallback( | 594 web_ui()->RegisterMessageCallback( |
588 "getSystemLog", | 595 "getSystemLog", |
589 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog, | 596 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog, |
590 base::Unretained(this))); | 597 base::Unretained(this))); |
591 web_ui()->RegisterMessageCallback( | 598 web_ui()->RegisterMessageCallback( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 bool enabled = extension_service->IsExtensionEnabled((*it)->id()); | 685 bool enabled = extension_service->IsExtensionEnabled((*it)->id()); |
679 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); | 686 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); |
680 extension_list->Append(extension_info); | 687 extension_list->Append(extension_info); |
681 } | 688 } |
682 } | 689 } |
683 } | 690 } |
684 #endif | 691 #endif |
685 SendJavascriptCommand("receivedExtensionInfo", extension_list); | 692 SendJavascriptCommand("receivedExtensionInfo", extension_list); |
686 } | 693 } |
687 | 694 |
| 695 void NetInternalsMessageHandler::OnGetDataReductionProxyInfo( |
| 696 const base::ListValue* list) { |
| 697 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 698 Profile* profile = Profile::FromWebUI(web_ui()); |
| 699 DataReductionProxyChromeSettings* data_reduction_proxy_settings = |
| 700 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); |
| 701 base::Value* value = |
| 702 data_reduction_proxy_settings->GetEventStore()->GetSummaryValue(); |
| 703 SendJavascriptCommand("receivedDataReductionProxyInfo", value); |
| 704 } |
| 705 |
688 #if defined(OS_CHROMEOS) | 706 #if defined(OS_CHROMEOS) |
689 //////////////////////////////////////////////////////////////////////////////// | 707 //////////////////////////////////////////////////////////////////////////////// |
690 // | 708 // |
691 // NetInternalsMessageHandler::SystemLogsGetter | 709 // NetInternalsMessageHandler::SystemLogsGetter |
692 // | 710 // |
693 //////////////////////////////////////////////////////////////////////////////// | 711 //////////////////////////////////////////////////////////////////////////////// |
694 | 712 |
695 NetInternalsMessageHandler::SystemLogsGetter::SystemLogsGetter( | 713 NetInternalsMessageHandler::SystemLogsGetter::SystemLogsGetter( |
696 NetInternalsMessageHandler* handler, | 714 NetInternalsMessageHandler* handler, |
697 chromeos::system::SyslogsProvider* syslogs_provider) | 715 chromeos::system::SyslogsProvider* syslogs_provider) |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 dict->SetString("cl", version_info.LastChange()); | 1442 dict->SetString("cl", version_info.LastChange()); |
1425 dict->SetString("version_mod", | 1443 dict->SetString("version_mod", |
1426 chrome::VersionInfo::GetVersionStringModifier()); | 1444 chrome::VersionInfo::GetVersionStringModifier()); |
1427 dict->SetString("official", | 1445 dict->SetString("official", |
1428 version_info.IsOfficialBuild() ? "official" : "unofficial"); | 1446 version_info.IsOfficialBuild() ? "official" : "unofficial"); |
1429 dict->SetString("os_type", version_info.OSType()); | 1447 dict->SetString("os_type", version_info.OSType()); |
1430 dict->SetString("command_line", | 1448 dict->SetString("command_line", |
1431 CommandLine::ForCurrentProcess()->GetCommandLineString()); | 1449 CommandLine::ForCurrentProcess()->GetCommandLineString()); |
1432 | 1450 |
1433 constants_dict->Set("clientInfo", dict); | 1451 constants_dict->Set("clientInfo", dict); |
| 1452 |
| 1453 data_reduction_proxy::DataReductionProxyEventStore::AddConstants( |
| 1454 constants_dict.get()); |
1434 } | 1455 } |
1435 | 1456 |
1436 return constants_dict.release(); | 1457 return constants_dict.release(); |
1437 } | 1458 } |
1438 | 1459 |
1439 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1460 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1440 : WebUIController(web_ui) { | 1461 : WebUIController(web_ui) { |
1441 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1462 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1442 | 1463 |
1443 // Set up the chrome://net-internals/ source. | 1464 // Set up the chrome://net-internals/ source. |
1444 Profile* profile = Profile::FromWebUI(web_ui); | 1465 Profile* profile = Profile::FromWebUI(web_ui); |
1445 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1466 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1446 } | 1467 } |
OLD | NEW |