| 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 "content/browser/debugger/devtools_http_handler_impl.h" | 5 #include "content/browser/debugger/devtools_http_handler_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 public: | 50 public: |
| 51 DevToolsClientHostImpl( | 51 DevToolsClientHostImpl( |
| 52 net::HttpServer* server, | 52 net::HttpServer* server, |
| 53 int connection_id) | 53 int connection_id) |
| 54 : server_(server), | 54 : server_(server), |
| 55 connection_id_(connection_id) { | 55 connection_id_(connection_id) { |
| 56 } | 56 } |
| 57 ~DevToolsClientHostImpl() {} | 57 ~DevToolsClientHostImpl() {} |
| 58 | 58 |
| 59 // DevToolsClientHost interface | 59 // DevToolsClientHost interface |
| 60 virtual void InspectedTabClosing() { | 60 virtual void InspectedContentsClosing() { |
| 61 BrowserThread::PostTask( | 61 BrowserThread::PostTask( |
| 62 BrowserThread::IO, | 62 BrowserThread::IO, |
| 63 FROM_HERE, | 63 FROM_HERE, |
| 64 base::Bind(&net::HttpServer::Close, server_, connection_id_)); | 64 base::Bind(&net::HttpServer::Close, server_, connection_id_)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void DispatchOnInspectorFrontend(const std::string& data) { | 67 virtual void DispatchOnInspectorFrontend(const std::string& data) { |
| 68 BrowserThread::PostTask( | 68 BrowserThread::PostTask( |
| 69 BrowserThread::IO, | 69 BrowserThread::IO, |
| 70 FROM_HERE, | 70 FROM_HERE, |
| 71 base::Bind(&net::HttpServer::SendOverWebSocket, | 71 base::Bind(&net::HttpServer::SendOverWebSocket, |
| 72 server_, | 72 server_, |
| 73 connection_id_, | 73 connection_id_, |
| 74 data)); | 74 data)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual void TabReplaced(WebContents* new_tab) { | 77 virtual void ContentsReplaced(WebContents* new_contents) { |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 virtual void FrameNavigating(const std::string& url) {} | 81 virtual void FrameNavigating(const std::string& url) {} |
| 82 net::HttpServer* server_; | 82 net::HttpServer* server_; |
| 83 int connection_id_; | 83 int connection_id_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace | 86 } // namespace |
| 87 | 87 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 285 } |
| 286 | 286 |
| 287 DevToolsHttpHandlerImpl::PageList DevToolsHttpHandlerImpl::GeneratePageList() { | 287 DevToolsHttpHandlerImpl::PageList DevToolsHttpHandlerImpl::GeneratePageList() { |
| 288 ResetRenderViewHostBinding(); | 288 ResetRenderViewHostBinding(); |
| 289 PageList page_list; | 289 PageList page_list; |
| 290 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); | 290 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); |
| 291 !it.IsAtEnd(); it.Advance()) { | 291 !it.IsAtEnd(); it.Advance()) { |
| 292 RenderProcessHost* render_process_host = it.GetCurrentValue(); | 292 RenderProcessHost* render_process_host = it.GetCurrentValue(); |
| 293 DCHECK(render_process_host); | 293 DCHECK(render_process_host); |
| 294 | 294 |
| 295 // Ignore processes that don't have a connection, such as crashed tabs. | 295 // Ignore processes that don't have a connection, such as crashed contents. |
| 296 if (!render_process_host->HasConnection()) | 296 if (!render_process_host->HasConnection()) |
| 297 continue; | 297 continue; |
| 298 | 298 |
| 299 RenderProcessHost::RenderWidgetHostsIterator rwit( | 299 RenderProcessHost::RenderWidgetHostsIterator rwit( |
| 300 render_process_host->GetRenderWidgetHostsIterator()); | 300 render_process_host->GetRenderWidgetHostsIterator()); |
| 301 for (; !rwit.IsAtEnd(); rwit.Advance()) { | 301 for (; !rwit.IsAtEnd(); rwit.Advance()) { |
| 302 const RenderWidgetHost* widget = rwit.GetCurrentValue(); | 302 const RenderWidgetHost* widget = rwit.GetCurrentValue(); |
| 303 DCHECK(widget); | 303 DCHECK(widget); |
| 304 if (!widget || !widget->IsRenderView()) | 304 if (!widget || !widget->IsRenderView()) |
| 305 continue; | 305 continue; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 RenderViewHost* DevToolsHttpHandlerImpl::GetBoundRenderViewHost(size_t id) { | 599 RenderViewHost* DevToolsHttpHandlerImpl::GetBoundRenderViewHost(size_t id) { |
| 600 return RenderViewHost::FromID(targets_[id].first, | 600 return RenderViewHost::FromID(targets_[id].first, |
| 601 targets_[id].second); | 601 targets_[id].second); |
| 602 } | 602 } |
| 603 | 603 |
| 604 void DevToolsHttpHandlerImpl::ResetRenderViewHostBinding() { | 604 void DevToolsHttpHandlerImpl::ResetRenderViewHostBinding() { |
| 605 targets_.clear(); | 605 targets_.clear(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 } // namespace content | 608 } // namespace content |
| OLD | NEW |