Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 775773002: Add data reduction proxy debug info to net-internals#bandwidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr CR updates Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"
49 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h"
47 #include "components/onc/onc_constants.h" 50 #include "components/onc/onc_constants.h"
48 #include "components/url_fixer/url_fixer.h" 51 #include "components/url_fixer/url_fixer.h"
49 #include "content/public/browser/browser_thread.h" 52 #include "content/public/browser/browser_thread.h"
50 #include "content/public/browser/notification_details.h" 53 #include "content/public/browser/notification_details.h"
51 #include "content/public/browser/resource_dispatcher_host.h" 54 #include "content/public/browser/resource_dispatcher_host.h"
52 #include "content/public/browser/web_contents.h" 55 #include "content/public/browser/web_contents.h"
53 #include "content/public/browser/web_ui.h" 56 #include "content/public/browser/web_ui.h"
54 #include "content/public/browser/web_ui_data_source.h" 57 #include "content/public/browser/web_ui_data_source.h"
55 #include "content/public/browser/web_ui_message_handler.h" 58 #include "content/public/browser/web_ui_message_handler.h"
56 #include "grit/net_internals_resources.h" 59 #include "grit/net_internals_resources.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Takes ownership of |arg|. If the renderer is displaying a log file, the 211 // Takes ownership of |arg|. If the renderer is displaying a log file, the
209 // message will be ignored. 212 // message will be ignored.
210 void SendJavascriptCommand(const std::string& command, base::Value* arg); 213 void SendJavascriptCommand(const std::string& command, base::Value* arg);
211 214
212 // Javascript message handlers. 215 // Javascript message handlers.
213 void OnRendererReady(const base::ListValue* list); 216 void OnRendererReady(const base::ListValue* list);
214 void OnClearBrowserCache(const base::ListValue* list); 217 void OnClearBrowserCache(const base::ListValue* list);
215 void OnGetPrerenderInfo(const base::ListValue* list); 218 void OnGetPrerenderInfo(const base::ListValue* list);
216 void OnGetHistoricNetworkStats(const base::ListValue* list); 219 void OnGetHistoricNetworkStats(const base::ListValue* list);
217 void OnGetExtensionInfo(const base::ListValue* list); 220 void OnGetExtensionInfo(const base::ListValue* list);
221 void OnGetDataReductionProxyInfo(const base::ListValue* list);
218 #if defined(OS_CHROMEOS) 222 #if defined(OS_CHROMEOS)
219 void OnRefreshSystemLogs(const base::ListValue* list); 223 void OnRefreshSystemLogs(const base::ListValue* list);
220 void OnGetSystemLog(const base::ListValue* list); 224 void OnGetSystemLog(const base::ListValue* list);
221 void OnImportONCFile(const base::ListValue* list); 225 void OnImportONCFile(const base::ListValue* list);
222 void OnStoreDebugLogs(const base::ListValue* list); 226 void OnStoreDebugLogs(const base::ListValue* list);
223 void OnStoreDebugLogsCompleted(const base::FilePath& log_path, 227 void OnStoreDebugLogsCompleted(const base::FilePath& log_path,
224 bool succeeded); 228 bool succeeded);
225 void OnSetNetworkDebugMode(const base::ListValue* list); 229 void OnSetNetworkDebugMode(const base::ListValue* list);
226 void OnSetNetworkDebugModeCompleted(const std::string& subsystem, 230 void OnSetNetworkDebugModeCompleted(const std::string& subsystem,
227 bool succeeded); 231 bool succeeded);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 base::Bind(&NetInternalsMessageHandler::OnGetPrerenderInfo, 576 base::Bind(&NetInternalsMessageHandler::OnGetPrerenderInfo,
573 base::Unretained(this))); 577 base::Unretained(this)));
574 web_ui()->RegisterMessageCallback( 578 web_ui()->RegisterMessageCallback(
575 "getHistoricNetworkStats", 579 "getHistoricNetworkStats",
576 base::Bind(&NetInternalsMessageHandler::OnGetHistoricNetworkStats, 580 base::Bind(&NetInternalsMessageHandler::OnGetHistoricNetworkStats,
577 base::Unretained(this))); 581 base::Unretained(this)));
578 web_ui()->RegisterMessageCallback( 582 web_ui()->RegisterMessageCallback(
579 "getExtensionInfo", 583 "getExtensionInfo",
580 base::Bind(&NetInternalsMessageHandler::OnGetExtensionInfo, 584 base::Bind(&NetInternalsMessageHandler::OnGetExtensionInfo,
581 base::Unretained(this))); 585 base::Unretained(this)));
586 web_ui()->RegisterMessageCallback(
587 "getDataReductionProxyInfo",
588 base::Bind(&NetInternalsMessageHandler::OnGetDataReductionProxyInfo,
589 base::Unretained(this)));
582 #if defined(OS_CHROMEOS) 590 #if defined(OS_CHROMEOS)
583 web_ui()->RegisterMessageCallback( 591 web_ui()->RegisterMessageCallback(
584 "refreshSystemLogs", 592 "refreshSystemLogs",
585 base::Bind(&NetInternalsMessageHandler::OnRefreshSystemLogs, 593 base::Bind(&NetInternalsMessageHandler::OnRefreshSystemLogs,
586 base::Unretained(this))); 594 base::Unretained(this)));
587 web_ui()->RegisterMessageCallback( 595 web_ui()->RegisterMessageCallback(
588 "getSystemLog", 596 "getSystemLog",
589 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog, 597 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog,
590 base::Unretained(this))); 598 base::Unretained(this)));
591 web_ui()->RegisterMessageCallback( 599 web_ui()->RegisterMessageCallback(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 bool enabled = extension_service->IsExtensionEnabled((*it)->id()); 686 bool enabled = extension_service->IsExtensionEnabled((*it)->id());
679 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); 687 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info);
680 extension_list->Append(extension_info); 688 extension_list->Append(extension_info);
681 } 689 }
682 } 690 }
683 } 691 }
684 #endif 692 #endif
685 SendJavascriptCommand("receivedExtensionInfo", extension_list); 693 SendJavascriptCommand("receivedExtensionInfo", extension_list);
686 } 694 }
687 695
696 void NetInternalsMessageHandler::OnGetDataReductionProxyInfo(
697 const base::ListValue* list) {
698 DCHECK_CURRENTLY_ON(BrowserThread::UI);
699 Profile* profile = Profile::FromWebUI(web_ui());
700 DataReductionProxyChromeSettings* data_reduction_proxy_settings =
701 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile);
702 data_reduction_proxy::DataReductionProxyEventStore* event_store =
703 data_reduction_proxy_settings->GetEventStore();
704 SendJavascriptCommand(
705 "receivedDataReductionProxyInfo",
706 (event_store == nullptr) ? nullptr : event_store->GetSummaryValue());
707 }
708
688 #if defined(OS_CHROMEOS) 709 #if defined(OS_CHROMEOS)
689 //////////////////////////////////////////////////////////////////////////////// 710 ////////////////////////////////////////////////////////////////////////////////
690 // 711 //
691 // NetInternalsMessageHandler::SystemLogsGetter 712 // NetInternalsMessageHandler::SystemLogsGetter
692 // 713 //
693 //////////////////////////////////////////////////////////////////////////////// 714 ////////////////////////////////////////////////////////////////////////////////
694 715
695 NetInternalsMessageHandler::SystemLogsGetter::SystemLogsGetter( 716 NetInternalsMessageHandler::SystemLogsGetter::SystemLogsGetter(
696 NetInternalsMessageHandler* handler, 717 NetInternalsMessageHandler* handler,
697 chromeos::system::SyslogsProvider* syslogs_provider) 718 chromeos::system::SyslogsProvider* syslogs_provider)
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 dict->SetString("cl", version_info.LastChange()); 1445 dict->SetString("cl", version_info.LastChange());
1425 dict->SetString("version_mod", 1446 dict->SetString("version_mod",
1426 chrome::VersionInfo::GetVersionStringModifier()); 1447 chrome::VersionInfo::GetVersionStringModifier());
1427 dict->SetString("official", 1448 dict->SetString("official",
1428 version_info.IsOfficialBuild() ? "official" : "unofficial"); 1449 version_info.IsOfficialBuild() ? "official" : "unofficial");
1429 dict->SetString("os_type", version_info.OSType()); 1450 dict->SetString("os_type", version_info.OSType());
1430 dict->SetString("command_line", 1451 dict->SetString("command_line",
1431 CommandLine::ForCurrentProcess()->GetCommandLineString()); 1452 CommandLine::ForCurrentProcess()->GetCommandLineString());
1432 1453
1433 constants_dict->Set("clientInfo", dict); 1454 constants_dict->Set("clientInfo", dict);
1455
1456 data_reduction_proxy::DataReductionProxyEventStore::AddConstants(
1457 constants_dict.get());
1434 } 1458 }
1435 1459
1436 return constants_dict.release(); 1460 return constants_dict.release();
1437 } 1461 }
1438 1462
1439 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1463 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1440 : WebUIController(web_ui) { 1464 : WebUIController(web_ui) {
1441 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1465 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1442 1466
1443 // Set up the chrome://net-internals/ source. 1467 // Set up the chrome://net-internals/ source.
1444 Profile* profile = Profile::FromWebUI(web_ui); 1468 Profile* profile = Profile::FromWebUI(web_ui);
1445 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1469 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1446 } 1470 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/main.js ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698