| 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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 SendJavascriptCommand( | 1744 SendJavascriptCommand( |
| 1745 "receivedCompletedConnectionTestSuite", | 1745 "receivedCompletedConnectionTestSuite", |
| 1746 NULL); | 1746 NULL); |
| 1747 } | 1747 } |
| 1748 | 1748 |
| 1749 // Note that this can be called from ANY THREAD. | 1749 // Note that this can be called from ANY THREAD. |
| 1750 void NetInternalsMessageHandler::IOThreadImpl::SendJavascriptCommand( | 1750 void NetInternalsMessageHandler::IOThreadImpl::SendJavascriptCommand( |
| 1751 const std::string& command, | 1751 const std::string& command, |
| 1752 Value* arg) { | 1752 Value* arg) { |
| 1753 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 1753 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 1754 if (handler_ && !was_webui_deleted_) { | 1754 if (handler_.get() && !was_webui_deleted_) { |
| 1755 // We check |handler_| in case it was deleted on the UI thread earlier | 1755 // We check |handler_| in case it was deleted on the UI thread earlier |
| 1756 // while we were running on the IO thread. | 1756 // while we were running on the IO thread. |
| 1757 handler_->SendJavascriptCommand(command, arg); | 1757 handler_->SendJavascriptCommand(command, arg); |
| 1758 } else { | 1758 } else { |
| 1759 delete arg; | 1759 delete arg; |
| 1760 } | 1760 } |
| 1761 return; | 1761 return; |
| 1762 } | 1762 } |
| 1763 | 1763 |
| 1764 if (!BrowserThread::PostTask( | 1764 if (!BrowserThread::PostTask( |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1995 } | 1995 } |
| 1996 | 1996 |
| 1997 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1997 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1998 : WebUIController(web_ui) { | 1998 : WebUIController(web_ui) { |
| 1999 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1999 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 2000 | 2000 |
| 2001 // Set up the chrome://net-internals/ source. | 2001 // Set up the chrome://net-internals/ source. |
| 2002 Profile* profile = Profile::FromWebUI(web_ui); | 2002 Profile* profile = Profile::FromWebUI(web_ui); |
| 2003 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 2003 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 2004 } | 2004 } |
| OLD | NEW |