| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/dom_ui/net_internals_ui.h" | 5 #include "chrome/browser/dom_ui/net_internals_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 : public base::RefCountedThreadSafe< | 203 : public base::RefCountedThreadSafe< |
| 204 NetInternalsMessageHandler::IOThreadImpl, | 204 NetInternalsMessageHandler::IOThreadImpl, |
| 205 BrowserThread::DeleteOnUIThread>, | 205 BrowserThread::DeleteOnUIThread>, |
| 206 public ChromeNetLog::ThreadSafeObserver, | 206 public ChromeNetLog::ThreadSafeObserver, |
| 207 public ConnectionTester::Delegate { | 207 public ConnectionTester::Delegate { |
| 208 public: | 208 public: |
| 209 // Type for methods that can be used as MessageHandler callbacks. | 209 // Type for methods that can be used as MessageHandler callbacks. |
| 210 typedef void (IOThreadImpl::*MessageHandler)(const ListValue*); | 210 typedef void (IOThreadImpl::*MessageHandler)(const ListValue*); |
| 211 | 211 |
| 212 // Creates a proxy for |handler| that will live on the IO thread. | 212 // Creates a proxy for |handler| that will live on the IO thread. |
| 213 // |handler| is a weak pointer, since it is possible for the | 213 // |handler| is a weak pointer, since it is possible for the WebUIMessageHandl
er |
| 214 // WebUIMessageHandler to be deleted on the UI thread while we were executing | 214 // to be deleted on the UI thread while we were executing on the IO thread. |
| 215 // on the IO thread. |io_thread| is the global IOThread (it is passed in as | 215 // |io_thread| is the global IOThread (it is passed in as an argument since |
| 216 // an argument since we need to grab it from the UI thread). | 216 // we need to grab it from the UI thread). |
| 217 IOThreadImpl( | 217 IOThreadImpl( |
| 218 const base::WeakPtr<NetInternalsMessageHandler>& handler, | 218 const base::WeakPtr<NetInternalsMessageHandler>& handler, |
| 219 IOThread* io_thread, | 219 IOThread* io_thread, |
| 220 URLRequestContextGetter* context_getter); | 220 URLRequestContextGetter* context_getter); |
| 221 | 221 |
| 222 ~IOThreadImpl(); | 222 ~IOThreadImpl(); |
| 223 | 223 |
| 224 // Creates a callback that will run |method| on the IO thread. | 224 // Creates a callback that will run |method| on the IO thread. |
| 225 // | 225 // |
| 226 // This can be used with DOMUI::RegisterMessageCallback() to bind to a method | 226 // This can be used with DOMUI::RegisterMessageCallback() to bind to a method |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 // NetInternalsUI | 1155 // NetInternalsUI |
| 1156 // | 1156 // |
| 1157 //////////////////////////////////////////////////////////////////////////////// | 1157 //////////////////////////////////////////////////////////////////////////////// |
| 1158 | 1158 |
| 1159 NetInternalsUI::NetInternalsUI(TabContents* contents) : DOMUI(contents) { | 1159 NetInternalsUI::NetInternalsUI(TabContents* contents) : DOMUI(contents) { |
| 1160 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); | 1160 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); |
| 1161 | 1161 |
| 1162 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); | 1162 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); |
| 1163 | 1163 |
| 1164 // Set up the chrome://net-internals/ source. | 1164 // Set up the chrome://net-internals/ source. |
| 1165 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 1165 BrowserThread::PostTask( |
| 1166 BrowserThread::IO, FROM_HERE, |
| 1167 NewRunnableMethod( |
| 1168 ChromeURLDataManager::GetInstance(), |
| 1169 &ChromeURLDataManager::AddDataSource, |
| 1170 make_scoped_refptr(html_source))); |
| 1166 } | 1171 } |
| OLD | NEW |