| 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 "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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 virtual void DispatchOnInspectorFrontend(const std::string& data) { | 62 virtual void DispatchOnInspectorFrontend(const std::string& data) { |
| 63 BrowserThread::PostTask( | 63 BrowserThread::PostTask( |
| 64 BrowserThread::IO, | 64 BrowserThread::IO, |
| 65 FROM_HERE, | 65 FROM_HERE, |
| 66 base::Bind(&net::HttpServer::SendOverWebSocket, | 66 base::Bind(&net::HttpServer::SendOverWebSocket, |
| 67 server_, | 67 server_, |
| 68 connection_id_, | 68 connection_id_, |
| 69 data)); | 69 data)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 virtual void TabReplaced(TabContents* new_tab) { | 72 virtual void TabReplaced(WebContents* new_tab) { |
| 73 } | 73 } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 virtual void FrameNavigating(const std::string& url) {} | 76 virtual void FrameNavigating(const std::string& url) {} |
| 77 net::HttpServer* server_; | 77 net::HttpServer* server_; |
| 78 int connection_id_; | 78 int connection_id_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 static int next_id = 1; | 81 static int next_id = 1; |
| 82 | 82 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 DevToolsHttpHandlerDelegate* delegate, | 275 DevToolsHttpHandlerDelegate* delegate, |
| 276 int connection_id, | 276 int connection_id, |
| 277 const net::HttpServerRequestInfo& info) { | 277 const net::HttpServerRequestInfo& info) { |
| 278 typedef DevToolsHttpHandlerDelegate::InspectableTabs Tabs; | 278 typedef DevToolsHttpHandlerDelegate::InspectableTabs Tabs; |
| 279 Tabs inspectable_tabs = delegate->GetInspectableTabs(); | 279 Tabs inspectable_tabs = delegate->GetInspectableTabs(); |
| 280 | 280 |
| 281 PageList page_list; | 281 PageList page_list; |
| 282 for (Tabs::iterator it = inspectable_tabs.begin(); | 282 for (Tabs::iterator it = inspectable_tabs.begin(); |
| 283 it != inspectable_tabs.end(); ++it) { | 283 it != inspectable_tabs.end(); ++it) { |
| 284 | 284 |
| 285 TabContents* tab_contents = *it; | 285 WebContents* web_contents = *it; |
| 286 NavigationController& controller = tab_contents->GetController(); | 286 NavigationController& controller = web_contents->GetController(); |
| 287 | 287 |
| 288 NavigationEntry* entry = controller.GetActiveEntry(); | 288 NavigationEntry* entry = controller.GetActiveEntry(); |
| 289 if (entry == NULL || !entry->GetURL().is_valid()) | 289 if (entry == NULL || !entry->GetURL().is_valid()) |
| 290 continue; | 290 continue; |
| 291 | 291 |
| 292 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( | 292 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
| 293 tab_contents->GetRenderViewHost()); | 293 web_contents->GetRenderViewHost()); |
| 294 DevToolsClientHost* client_host = DevToolsManager::GetInstance()-> | 294 DevToolsClientHost* client_host = DevToolsManager::GetInstance()-> |
| 295 GetDevToolsClientHostFor(agent); | 295 GetDevToolsClientHostFor(agent); |
| 296 PageInfo page_info; | 296 PageInfo page_info; |
| 297 page_info.id = TabContentsIDHelper::GetID(tab_contents); | 297 page_info.id = TabContentsIDHelper::GetID( |
| 298 static_cast<TabContents*>(web_contents)); |
| 298 page_info.attached = client_host != NULL; | 299 page_info.attached = client_host != NULL; |
| 299 page_info.url = entry->GetURL().spec(); | 300 page_info.url = entry->GetURL().spec(); |
| 300 page_info.title = UTF16ToUTF8(net::EscapeForHTML(entry->GetTitle())); | 301 page_info.title = UTF16ToUTF8(net::EscapeForHTML(entry->GetTitle())); |
| 301 page_info.thumbnail_url = "/thumb/" + entry->GetURL().spec(); | 302 page_info.thumbnail_url = "/thumb/" + entry->GetURL().spec(); |
| 302 page_info.favicon_url = entry->GetFavicon().url.spec(); | 303 page_info.favicon_url = entry->GetFavicon().url.spec(); |
| 303 page_list.push_back(page_info); | 304 page_list.push_back(page_info); |
| 304 } | 305 } |
| 305 return page_list; | 306 return page_list; |
| 306 } | 307 } |
| 307 | 308 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 void DevToolsHttpHandlerImpl::AcceptWebSocket( | 547 void DevToolsHttpHandlerImpl::AcceptWebSocket( |
| 547 int connection_id, | 548 int connection_id, |
| 548 const net::HttpServerRequestInfo& request) { | 549 const net::HttpServerRequestInfo& request) { |
| 549 BrowserThread::PostTask( | 550 BrowserThread::PostTask( |
| 550 BrowserThread::IO, FROM_HERE, | 551 BrowserThread::IO, FROM_HERE, |
| 551 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), | 552 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), |
| 552 connection_id, request)); | 553 connection_id, request)); |
| 553 } | 554 } |
| 554 | 555 |
| 555 } // namespace content | 556 } // namespace content |
| OLD | NEW |