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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // | 219 // |
220 // TODO(eroman): Can we start on the IO thread to begin with? | 220 // TODO(eroman): Can we start on the IO thread to begin with? |
221 class NetInternalsMessageHandler | 221 class NetInternalsMessageHandler |
222 : public WebUIMessageHandler, | 222 : public WebUIMessageHandler, |
223 public base::SupportsWeakPtr<NetInternalsMessageHandler> { | 223 public base::SupportsWeakPtr<NetInternalsMessageHandler> { |
224 public: | 224 public: |
225 NetInternalsMessageHandler(); | 225 NetInternalsMessageHandler(); |
226 virtual ~NetInternalsMessageHandler(); | 226 virtual ~NetInternalsMessageHandler(); |
227 | 227 |
228 // WebUIMessageHandler implementation. | 228 // WebUIMessageHandler implementation. |
229 virtual void RegisterMessages() OVERRIDE; | 229 virtual void RegisterMessages() override; |
230 | 230 |
231 // Calls g_browser.receive in the renderer, passing in |command| and |arg|. | 231 // Calls g_browser.receive in the renderer, passing in |command| and |arg|. |
232 // Takes ownership of |arg|. If the renderer is displaying a log file, the | 232 // Takes ownership of |arg|. If the renderer is displaying a log file, the |
233 // message will be ignored. | 233 // message will be ignored. |
234 void SendJavascriptCommand(const std::string& command, base::Value* arg); | 234 void SendJavascriptCommand(const std::string& command, base::Value* arg); |
235 | 235 |
236 // Javascript message handlers. | 236 // Javascript message handlers. |
237 void OnRendererReady(const base::ListValue* list); | 237 void OnRendererReady(const base::ListValue* list); |
238 void OnClearBrowserCache(const base::ListValue* list); | 238 void OnClearBrowserCache(const base::ListValue* list); |
239 void OnGetPrerenderInfo(const base::ListValue* list); | 239 void OnGetPrerenderInfo(const base::ListValue* list); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 void OnGetSpdySessionInfo(const base::ListValue* list); | 403 void OnGetSpdySessionInfo(const base::ListValue* list); |
404 void OnGetSpdyStatus(const base::ListValue* list); | 404 void OnGetSpdyStatus(const base::ListValue* list); |
405 void OnGetSpdyAlternateProtocolMappings(const base::ListValue* list); | 405 void OnGetSpdyAlternateProtocolMappings(const base::ListValue* list); |
406 void OnGetQuicInfo(const base::ListValue* list); | 406 void OnGetQuicInfo(const base::ListValue* list); |
407 #if defined(OS_WIN) | 407 #if defined(OS_WIN) |
408 void OnGetServiceProviders(const base::ListValue* list); | 408 void OnGetServiceProviders(const base::ListValue* list); |
409 #endif | 409 #endif |
410 void OnSetLogLevel(const base::ListValue* list); | 410 void OnSetLogLevel(const base::ListValue* list); |
411 | 411 |
412 // ChromeNetLog::ThreadSafeObserver implementation: | 412 // ChromeNetLog::ThreadSafeObserver implementation: |
413 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | 413 virtual void OnAddEntry(const net::NetLog::Entry& entry) override; |
414 | 414 |
415 // ConnectionTester::Delegate implementation: | 415 // ConnectionTester::Delegate implementation: |
416 virtual void OnStartConnectionTestSuite() OVERRIDE; | 416 virtual void OnStartConnectionTestSuite() override; |
417 virtual void OnStartConnectionTestExperiment( | 417 virtual void OnStartConnectionTestExperiment( |
418 const ConnectionTester::Experiment& experiment) OVERRIDE; | 418 const ConnectionTester::Experiment& experiment) override; |
419 virtual void OnCompletedConnectionTestExperiment( | 419 virtual void OnCompletedConnectionTestExperiment( |
420 const ConnectionTester::Experiment& experiment, | 420 const ConnectionTester::Experiment& experiment, |
421 int result) OVERRIDE; | 421 int result) override; |
422 virtual void OnCompletedConnectionTestSuite() OVERRIDE; | 422 virtual void OnCompletedConnectionTestSuite() override; |
423 | 423 |
424 // Helper that calls g_browser.receive in the renderer, passing in |command| | 424 // Helper that calls g_browser.receive in the renderer, passing in |command| |
425 // and |arg|. Takes ownership of |arg|. If the renderer is displaying a log | 425 // and |arg|. Takes ownership of |arg|. If the renderer is displaying a log |
426 // file, the message will be ignored. Note that this can be called from any | 426 // file, the message will be ignored. Note that this can be called from any |
427 // thread. | 427 // thread. |
428 void SendJavascriptCommand(const std::string& command, base::Value* arg); | 428 void SendJavascriptCommand(const std::string& command, base::Value* arg); |
429 | 429 |
430 private: | 430 private: |
431 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 431 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
432 friend class base::DeleteHelper<IOThreadImpl>; | 432 friend class base::DeleteHelper<IOThreadImpl>; |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 } | 1729 } |
1730 | 1730 |
1731 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1731 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1732 : WebUIController(web_ui) { | 1732 : WebUIController(web_ui) { |
1733 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1733 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1734 | 1734 |
1735 // Set up the chrome://net-internals/ source. | 1735 // Set up the chrome://net-internals/ source. |
1736 Profile* profile = Profile::FromWebUI(web_ui); | 1736 Profile* profile = Profile::FromWebUI(web_ui); |
1737 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1737 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1738 } | 1738 } |
OLD | NEW |