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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #include "net/base/net_errors.h" | 68 #include "net/base/net_errors.h" |
69 #include "net/disk_cache/disk_cache.h" | 69 #include "net/disk_cache/disk_cache.h" |
70 #include "net/dns/host_cache.h" | 70 #include "net/dns/host_cache.h" |
71 #include "net/dns/host_resolver.h" | 71 #include "net/dns/host_resolver.h" |
72 #include "net/http/http_cache.h" | 72 #include "net/http/http_cache.h" |
73 #include "net/http/http_network_layer.h" | 73 #include "net/http/http_network_layer.h" |
74 #include "net/http/http_network_session.h" | 74 #include "net/http/http_network_session.h" |
75 #include "net/http/http_server_properties.h" | 75 #include "net/http/http_server_properties.h" |
76 #include "net/http/http_stream_factory.h" | 76 #include "net/http/http_stream_factory.h" |
77 #include "net/http/transport_security_state.h" | 77 #include "net/http/transport_security_state.h" |
| 78 #include "net/log/net_log.h" |
| 79 #include "net/log/net_log_capture_mode.h" |
| 80 #include "net/log/net_log_entry.h" |
78 #include "net/log/net_log_util.h" | 81 #include "net/log/net_log_util.h" |
79 #include "net/log/write_to_file_net_log_observer.h" | 82 #include "net/log/write_to_file_net_log_observer.h" |
80 #include "net/proxy/proxy_service.h" | 83 #include "net/proxy/proxy_service.h" |
81 #include "net/url_request/url_request_context.h" | 84 #include "net/url_request/url_request_context.h" |
82 #include "net/url_request/url_request_context_getter.h" | 85 #include "net/url_request/url_request_context_getter.h" |
83 | 86 |
84 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
85 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" | 88 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" |
86 #include "chrome/browser/chromeos/net/onc_utils.h" | 89 #include "chrome/browser/chromeos/net/onc_utils.h" |
87 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 90 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 void OnHSTSDelete(const base::ListValue* list); | 302 void OnHSTSDelete(const base::ListValue* list); |
300 void OnGetSessionNetworkStats(const base::ListValue* list); | 303 void OnGetSessionNetworkStats(const base::ListValue* list); |
301 void OnCloseIdleSockets(const base::ListValue* list); | 304 void OnCloseIdleSockets(const base::ListValue* list); |
302 void OnFlushSocketPools(const base::ListValue* list); | 305 void OnFlushSocketPools(const base::ListValue* list); |
303 #if defined(OS_WIN) | 306 #if defined(OS_WIN) |
304 void OnGetServiceProviders(const base::ListValue* list); | 307 void OnGetServiceProviders(const base::ListValue* list); |
305 #endif | 308 #endif |
306 void OnSetCaptureMode(const base::ListValue* list); | 309 void OnSetCaptureMode(const base::ListValue* list); |
307 | 310 |
308 // NetLog::ThreadSafeObserver implementation: | 311 // NetLog::ThreadSafeObserver implementation: |
309 void OnAddEntry(const net::NetLog::Entry& entry) override; | 312 void OnAddEntry(const net::NetLogEntry& entry) override; |
310 | 313 |
311 // Helper that calls g_browser.receive in the renderer, passing in |command| | 314 // Helper that calls g_browser.receive in the renderer, passing in |command| |
312 // and |arg|. If the renderer is displaying a log file, the message will be | 315 // and |arg|. If the renderer is displaying a log file, the message will be |
313 // ignored. Note that this can be called from any thread. | 316 // ignored. Note that this can be called from any thread. |
314 void SendJavascriptCommand(const std::string& command, | 317 void SendJavascriptCommand(const std::string& command, |
315 std::unique_ptr<base::Value> arg); | 318 std::unique_ptr<base::Value> arg); |
316 | 319 |
317 private: | 320 private: |
318 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 321 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
319 friend class base::DeleteHelper<IOThreadImpl>; | 322 friend class base::DeleteHelper<IOThreadImpl>; |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 } else { | 1094 } else { |
1092 NOTREACHED(); | 1095 NOTREACHED(); |
1093 } | 1096 } |
1094 | 1097 |
1095 net_log()->SetObserverCaptureMode(this, mode); | 1098 net_log()->SetObserverCaptureMode(this, mode); |
1096 } | 1099 } |
1097 | 1100 |
1098 // Note that unlike other methods of IOThreadImpl, this function | 1101 // Note that unlike other methods of IOThreadImpl, this function |
1099 // can be called from ANY THREAD. | 1102 // can be called from ANY THREAD. |
1100 void NetInternalsMessageHandler::IOThreadImpl::OnAddEntry( | 1103 void NetInternalsMessageHandler::IOThreadImpl::OnAddEntry( |
1101 const net::NetLog::Entry& entry) { | 1104 const net::NetLogEntry& entry) { |
1102 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 1105 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
1103 base::Bind(&IOThreadImpl::AddEntryToQueue, this, | 1106 base::Bind(&IOThreadImpl::AddEntryToQueue, this, |
1104 base::Passed(entry.ToValue()))); | 1107 base::Passed(entry.ToValue()))); |
1105 } | 1108 } |
1106 | 1109 |
1107 // Note that this can be called from ANY THREAD. | 1110 // Note that this can be called from ANY THREAD. |
1108 void NetInternalsMessageHandler::IOThreadImpl::SendJavascriptCommand( | 1111 void NetInternalsMessageHandler::IOThreadImpl::SendJavascriptCommand( |
1109 const std::string& command, | 1112 const std::string& command, |
1110 std::unique_ptr<base::Value> arg) { | 1113 std::unique_ptr<base::Value> arg) { |
1111 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 1114 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 //////////////////////////////////////////////////////////////////////////////// | 1172 //////////////////////////////////////////////////////////////////////////////// |
1170 | 1173 |
1171 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1174 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1172 : WebUIController(web_ui) { | 1175 : WebUIController(web_ui) { |
1173 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1176 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1174 | 1177 |
1175 // Set up the chrome://net-internals/ source. | 1178 // Set up the chrome://net-internals/ source. |
1176 Profile* profile = Profile::FromWebUI(web_ui); | 1179 Profile* profile = Profile::FromWebUI(web_ui); |
1177 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1180 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1178 } | 1181 } |
OLD | NEW |