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

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

Issue 734263003: Move data reduction proxy logic out of chrome and android webview network delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 25 matching lines...) Expand all
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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 value = prerender_manager->GetAsValue(); 659 value = prerender_manager->GetAsValue();
659 } 660 }
660 SendJavascriptCommand("receivedPrerenderInfo", value); 661 SendJavascriptCommand("receivedPrerenderInfo", value);
661 } 662 }
662 663
663 void NetInternalsMessageHandler::OnGetHistoricNetworkStats( 664 void NetInternalsMessageHandler::OnGetHistoricNetworkStats(
664 const base::ListValue* list) { 665 const base::ListValue* list) {
665 DCHECK_CURRENTLY_ON(BrowserThread::UI); 666 DCHECK_CURRENTLY_ON(BrowserThread::UI);
666 Profile* profile = Profile::FromWebUI(web_ui()); 667 Profile* profile = Profile::FromWebUI(web_ui());
667 base::Value* historic_network_info = 668 base::Value* historic_network_info =
668 ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue( 669 data_reduction_proxy::DataReductionProxyNetworkDelegate::
669 profile->GetPrefs()); 670 HistoricNetworkStatsInfoToValue(profile->GetPrefs());
670 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info); 671 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info);
671 } 672 }
672 673
673 void NetInternalsMessageHandler::OnGetExtensionInfo( 674 void NetInternalsMessageHandler::OnGetExtensionInfo(
674 const base::ListValue* list) { 675 const base::ListValue* list) {
675 DCHECK_CURRENTLY_ON(BrowserThread::UI); 676 DCHECK_CURRENTLY_ON(BrowserThread::UI);
676 base::ListValue* extension_list = new base::ListValue(); 677 base::ListValue* extension_list = new base::ListValue();
677 #if defined(ENABLE_EXTENSIONS) 678 #if defined(ENABLE_EXTENSIONS)
678 Profile* profile = Profile::FromWebUI(web_ui()); 679 Profile* profile = Profile::FromWebUI(web_ui());
679 extensions::ExtensionSystem* extension_system = 680 extensions::ExtensionSystem* extension_system =
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1072 }
1072 1073
1073 void NetInternalsMessageHandler::IOThreadImpl::OnGetSessionNetworkStats( 1074 void NetInternalsMessageHandler::IOThreadImpl::OnGetSessionNetworkStats(
1074 const base::ListValue* list) { 1075 const base::ListValue* list) {
1075 DCHECK(!list); 1076 DCHECK(!list);
1076 net::HttpNetworkSession* http_network_session = 1077 net::HttpNetworkSession* http_network_session =
1077 GetHttpNetworkSession(main_context_getter_->GetURLRequestContext()); 1078 GetHttpNetworkSession(main_context_getter_->GetURLRequestContext());
1078 1079
1079 base::Value* network_info = NULL; 1080 base::Value* network_info = NULL;
1080 if (http_network_session) { 1081 if (http_network_session) {
1081 ChromeNetworkDelegate* net_delegate = 1082 data_reduction_proxy::DataReductionProxyNetworkDelegate* net_delegate =
1082 static_cast<ChromeNetworkDelegate*>( 1083 static_cast<data_reduction_proxy::DataReductionProxyNetworkDelegate*>(
1083 http_network_session->network_delegate()); 1084 http_network_session->network_delegate());
1084 if (net_delegate) { 1085 if (net_delegate) {
1085 network_info = net_delegate->SessionNetworkStatsInfoToValue(); 1086 network_info = net_delegate->SessionNetworkStatsInfoToValue();
1086 } 1087 }
1087 } 1088 }
1088 SendJavascriptCommand("receivedSessionNetworkStats", network_info); 1089 SendJavascriptCommand("receivedSessionNetworkStats", network_info);
1089 } 1090 }
1090 1091
1091 void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools( 1092 void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools(
1092 const base::ListValue* list) { 1093 const base::ListValue* list) {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 } 1488 }
1488 1489
1489 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1490 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1490 : WebUIController(web_ui) { 1491 : WebUIController(web_ui) {
1491 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1492 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1492 1493
1493 // Set up the chrome://net-internals/ source. 1494 // Set up the chrome://net-internals/ source.
1494 Profile* profile = Profile::FromWebUI(web_ui); 1495 Profile* profile = Profile::FromWebUI(web_ui);
1495 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1496 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1496 } 1497 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698