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

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

Issue 1347043002: Move ChromeNetLog to //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 months 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 15 matching lines...) Expand all
26 #include "base/strings/string_split.h" 26 #include "base/strings/string_split.h"
27 #include "base/strings/string_util.h" 27 #include "base/strings/string_util.h"
28 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "base/values.h" 29 #include "base/values.h"
30 #include "chrome/browser/browser_process.h" 30 #include "chrome/browser/browser_process.h"
31 #include "chrome/browser/browsing_data/browsing_data_helper.h" 31 #include "chrome/browser/browsing_data/browsing_data_helper.h"
32 #include "chrome/browser/browsing_data/browsing_data_remover.h" 32 #include "chrome/browser/browsing_data/browsing_data_remover.h"
33 #include "chrome/browser/chrome_notification_types.h" 33 #include "chrome/browser/chrome_notification_types.h"
34 #include "chrome/browser/download/download_prefs.h" 34 #include "chrome/browser/download/download_prefs.h"
35 #include "chrome/browser/io_thread.h" 35 #include "chrome/browser/io_thread.h"
36 #include "chrome/browser/net/chrome_net_log.h"
37 #include "chrome/browser/net/chrome_network_delegate.h" 36 #include "chrome/browser/net/chrome_network_delegate.h"
38 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 37 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
39 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 38 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
40 #include "chrome/browser/prerender/prerender_manager.h" 39 #include "chrome/browser/prerender/prerender_manager.h"
41 #include "chrome/browser/prerender/prerender_manager_factory.h" 40 #include "chrome/browser/prerender/prerender_manager_factory.h"
42 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
43 #include "chrome/common/channel_info.h" 42 #include "chrome/common/channel_info.h"
44 #include "chrome/common/chrome_paths.h" 43 #include "chrome/common/chrome_paths.h"
45 #include "chrome/common/url_constants.h" 44 #include "chrome/common/url_constants.h"
46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h"
47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.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_serv ice.h" 47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h"
49 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h" 48 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h"
49 #include "components/net_log/chrome_net_log.h"
50 #include "components/onc/onc_constants.h" 50 #include "components/onc/onc_constants.h"
51 #include "components/url_formatter/url_fixer.h" 51 #include "components/url_formatter/url_fixer.h"
52 #include "components/version_info/version_info.h" 52 #include "components/version_info/version_info.h"
53 #include "content/public/browser/browser_thread.h" 53 #include "content/public/browser/browser_thread.h"
54 #include "content/public/browser/notification_details.h" 54 #include "content/public/browser/notification_details.h"
55 #include "content/public/browser/resource_dispatcher_host.h" 55 #include "content/public/browser/resource_dispatcher_host.h"
56 #include "content/public/browser/web_contents.h" 56 #include "content/public/browser/web_contents.h"
57 #include "content/public/browser/web_ui.h" 57 #include "content/public/browser/web_ui.h"
58 #include "content/public/browser/web_ui_data_source.h" 58 #include "content/public/browser/web_ui_data_source.h"
59 #include "content/public/browser/web_ui_message_handler.h" 59 #include "content/public/browser/web_ui_message_handler.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 void OnHSTSAdd(const base::ListValue* list); 294 void OnHSTSAdd(const base::ListValue* list);
295 void OnHSTSDelete(const base::ListValue* list); 295 void OnHSTSDelete(const base::ListValue* list);
296 void OnGetSessionNetworkStats(const base::ListValue* list); 296 void OnGetSessionNetworkStats(const base::ListValue* list);
297 void OnCloseIdleSockets(const base::ListValue* list); 297 void OnCloseIdleSockets(const base::ListValue* list);
298 void OnFlushSocketPools(const base::ListValue* list); 298 void OnFlushSocketPools(const base::ListValue* list);
299 #if defined(OS_WIN) 299 #if defined(OS_WIN)
300 void OnGetServiceProviders(const base::ListValue* list); 300 void OnGetServiceProviders(const base::ListValue* list);
301 #endif 301 #endif
302 void OnSetCaptureMode(const base::ListValue* list); 302 void OnSetCaptureMode(const base::ListValue* list);
303 303
304 // ChromeNetLog::ThreadSafeObserver implementation: 304 // NetLog::ThreadSafeObserver implementation:
305 void OnAddEntry(const net::NetLog::Entry& entry) override; 305 void OnAddEntry(const net::NetLog::Entry& entry) override;
306 306
307 // Helper that calls g_browser.receive in the renderer, passing in |command| 307 // Helper that calls g_browser.receive in the renderer, passing in |command|
308 // and |arg|. Takes ownership of |arg|. If the renderer is displaying a log 308 // and |arg|. Takes ownership of |arg|. If the renderer is displaying a log
309 // file, the message will be ignored. Note that this can be called from any 309 // file, the message will be ignored. Note that this can be called from any
310 // thread. 310 // thread.
311 void SendJavascriptCommand(const std::string& command, base::Value* arg); 311 void SendJavascriptCommand(const std::string& command, base::Value* arg);
312 312
313 private: 313 private:
314 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 314 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 DCHECK_CURRENTLY_ON(BrowserThread::IO); 666 DCHECK_CURRENTLY_ON(BrowserThread::IO);
667 667
668 // If currently watching the NetLog, temporarily stop watching it and flush 668 // If currently watching the NetLog, temporarily stop watching it and flush
669 // pending events, so they won't appear before the status events created for 669 // pending events, so they won't appear before the status events created for
670 // currently active network objects below. 670 // currently active network objects below.
671 if (net_log()) { 671 if (net_log()) {
672 net_log()->DeprecatedRemoveObserver(this); 672 net_log()->DeprecatedRemoveObserver(this);
673 PostPendingEntries(); 673 PostPendingEntries();
674 } 674 }
675 675
676 SendJavascriptCommand("receivedConstants", NetInternalsUI::GetConstants()); 676 SendJavascriptCommand(
677 "receivedConstants",
678 net_log::ChromeNetLog::GetConstants(
679 base::CommandLine::ForCurrentProcess()->GetCommandLineString(),
680 chrome::GetChannelString()));
677 681
678 PrePopulateEventList(); 682 PrePopulateEventList();
679 683
680 // Register with network stack to observe events. 684 // Register with network stack to observe events.
681 io_thread_->net_log()->DeprecatedAddObserver( 685 io_thread_->net_log()->DeprecatedAddObserver(
682 this, net::NetLogCaptureMode::IncludeCookiesAndCredentials()); 686 this, net::NetLogCaptureMode::IncludeCookiesAndCredentials());
683 } 687 }
684 688
685 void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo( 689 void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo(
686 const base::ListValue* list) { 690 const base::ListValue* list) {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1159
1156 } // namespace 1160 } // namespace
1157 1161
1158 1162
1159 //////////////////////////////////////////////////////////////////////////////// 1163 ////////////////////////////////////////////////////////////////////////////////
1160 // 1164 //
1161 // NetInternalsUI 1165 // NetInternalsUI
1162 // 1166 //
1163 //////////////////////////////////////////////////////////////////////////////// 1167 ////////////////////////////////////////////////////////////////////////////////
1164 1168
1165 // static
1166 base::Value* NetInternalsUI::GetConstants() {
1167 scoped_ptr<base::DictionaryValue> constants_dict = net::GetNetConstants();
1168 DCHECK(constants_dict);
1169
1170 // Add a dictionary with the version of the client and its command line
1171 // arguments.
1172 {
1173 base::DictionaryValue* dict = new base::DictionaryValue();
1174
1175 // We have everything we need to send the right values.
1176 dict->SetString("name", version_info::GetProductName());
1177 dict->SetString("version", version_info::GetVersionNumber());
1178 dict->SetString("cl", version_info::GetLastChange());
1179 dict->SetString("version_mod", chrome::GetChannelString());
1180 dict->SetString("official", version_info::IsOfficialBuild() ? "official"
1181 : "unofficial");
1182 dict->SetString("os_type", version_info::GetOSType());
1183 dict->SetString(
1184 "command_line",
1185 base::CommandLine::ForCurrentProcess()->GetCommandLineString());
1186
1187 constants_dict->Set("clientInfo", dict);
1188
1189 data_reduction_proxy::DataReductionProxyEventStore::AddConstants(
1190 constants_dict.get());
1191 }
1192
1193 return constants_dict.release();
1194 }
1195
1196 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1169 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1197 : WebUIController(web_ui) { 1170 : WebUIController(web_ui) {
1198 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1171 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1199 1172
1200 // Set up the chrome://net-internals/ source. 1173 // Set up the chrome://net-internals/ source.
1201 Profile* profile = Profile::FromWebUI(web_ui); 1174 Profile* profile = Profile::FromWebUI(web_ui);
1202 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1175 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1203 } 1176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698