| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 : public base::RefCountedThreadSafe< | 205 : public base::RefCountedThreadSafe< |
| 206 NetInternalsMessageHandler::IOThreadImpl, | 206 NetInternalsMessageHandler::IOThreadImpl, |
| 207 BrowserThread::DeleteOnUIThread>, | 207 BrowserThread::DeleteOnUIThread>, |
| 208 public ChromeNetLog::ThreadSafeObserver, | 208 public ChromeNetLog::ThreadSafeObserver, |
| 209 public ConnectionTester::Delegate { | 209 public ConnectionTester::Delegate { |
| 210 public: | 210 public: |
| 211 // Type for methods that can be used as MessageHandler callbacks. | 211 // Type for methods that can be used as MessageHandler callbacks. |
| 212 typedef void (IOThreadImpl::*MessageHandler)(const ListValue*); | 212 typedef void (IOThreadImpl::*MessageHandler)(const ListValue*); |
| 213 | 213 |
| 214 // Creates a proxy for |handler| that will live on the IO thread. | 214 // Creates a proxy for |handler| that will live on the IO thread. |
| 215 // |handler| is a weak pointer, since it is possible for the WebUIMessageHandl
er | 215 // |handler| is a weak pointer, since it is possible for the |
| 216 // to be deleted on the UI thread while we were executing on the IO thread. | 216 // WebUIMessageHandler to be deleted on the UI thread while we were executing |
| 217 // |io_thread| is the global IOThread (it is passed in as an argument since | 217 // on the IO thread. |io_thread| is the global IOThread (it is passed in as |
| 218 // we need to grab it from the UI thread). | 218 // an argument since we need to grab it from the UI thread). |
| 219 IOThreadImpl( | 219 IOThreadImpl( |
| 220 const base::WeakPtr<NetInternalsMessageHandler>& handler, | 220 const base::WeakPtr<NetInternalsMessageHandler>& handler, |
| 221 IOThread* io_thread, | 221 IOThread* io_thread, |
| 222 URLRequestContextGetter* context_getter); | 222 URLRequestContextGetter* context_getter); |
| 223 | 223 |
| 224 ~IOThreadImpl(); | 224 ~IOThreadImpl(); |
| 225 | 225 |
| 226 // Creates a callback that will run |method| on the IO thread. | 226 // Creates a callback that will run |method| on the IO thread. |
| 227 // | 227 // |
| 228 // This can be used with DOMUI::RegisterMessageCallback() to bind to a method | 228 // This can be used with DOMUI::RegisterMessageCallback() to bind to a method |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 // NetInternalsUI | 1217 // NetInternalsUI |
| 1218 // | 1218 // |
| 1219 //////////////////////////////////////////////////////////////////////////////// | 1219 //////////////////////////////////////////////////////////////////////////////// |
| 1220 | 1220 |
| 1221 NetInternalsUI::NetInternalsUI(TabContents* contents) : DOMUI(contents) { | 1221 NetInternalsUI::NetInternalsUI(TabContents* contents) : DOMUI(contents) { |
| 1222 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); | 1222 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); |
| 1223 | 1223 |
| 1224 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); | 1224 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); |
| 1225 | 1225 |
| 1226 // Set up the chrome://net-internals/ source. | 1226 // Set up the chrome://net-internals/ source. |
| 1227 BrowserThread::PostTask( | 1227 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 1228 BrowserThread::IO, FROM_HERE, | |
| 1229 NewRunnableMethod( | |
| 1230 ChromeURLDataManager::GetInstance(), | |
| 1231 &ChromeURLDataManager::AddDataSource, | |
| 1232 make_scoped_refptr(html_source))); | |
| 1233 } | 1228 } |
| OLD | NEW |