| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/debugger/devtools_http_protocol_handler.h" | 5 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
| 10 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 11 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 12 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
| 14 #include "chrome/browser/browser_thread.h" | 16 #include "chrome/browser/browser_thread.h" |
| 15 #include "chrome/browser/debugger/devtools_client_host.h" | 17 #include "chrome/browser/debugger/devtools_client_host.h" |
| 16 #include "chrome/browser/debugger/devtools_manager.h" | 18 #include "chrome/browser/debugger/devtools_manager.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/ui/browser.h" | |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 22 #include "chrome/common/devtools_messages.h" | 23 #include "chrome/common/devtools_messages.h" |
| 23 #include "chrome/common/net/url_request_context_getter.h" | 24 #include "chrome/common/net/url_request_context_getter.h" |
| 24 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 25 #include "net/base/io_buffer.h" | 26 #include "net/base/io_buffer.h" |
| 26 #include "net/base/listen_socket.h" | 27 #include "net/base/listen_socket.h" |
| 27 #include "net/server/http_server_request_info.h" | 28 #include "net/server/http_server_request_info.h" |
| 28 #include "net/url_request/url_request_context.h" | 29 #include "net/url_request/url_request_context.h" |
| 29 | 30 |
| 30 const int kBufferSize = 16 * 1024; | 31 const int kBufferSize = 16 * 1024; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 60 DevToolsClientHost::NotifyCloseListener(); | 61 DevToolsClientHost::NotifyCloseListener(); |
| 61 } | 62 } |
| 62 private: | 63 private: |
| 63 // Message handling routines | 64 // Message handling routines |
| 64 void OnDispatchOnInspectorFrontend(const std::string& data) { | 65 void OnDispatchOnInspectorFrontend(const std::string& data) { |
| 65 socket_->SendOverWebSocket(data); | 66 socket_->SendOverWebSocket(data); |
| 66 } | 67 } |
| 67 HttpListenSocket* socket_; | 68 HttpListenSocket* socket_; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } | 71 } // namespace |
| 71 | 72 |
| 72 DevToolsHttpProtocolHandler::~DevToolsHttpProtocolHandler() { | 73 DevToolsHttpProtocolHandler::~DevToolsHttpProtocolHandler() { |
| 73 // Stop() must be called prior to this being called | 74 // Stop() must be called prior to this being called |
| 74 DCHECK(server_.get() == NULL); | 75 DCHECK(server_.get() == NULL); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void DevToolsHttpProtocolHandler::Start() { | 78 void DevToolsHttpProtocolHandler::Start() { |
| 78 BrowserThread::PostTask( | 79 BrowserThread::PostTask( |
| 79 BrowserThread::IO, FROM_HERE, | 80 BrowserThread::IO, FROM_HERE, |
| 80 NewRunnableMethod(this, &DevToolsHttpProtocolHandler::Init)); | 81 NewRunnableMethod(this, &DevToolsHttpProtocolHandler::Init)); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 TabStripModel* model = (*it)->tabstrip_model(); | 428 TabStripModel* model = (*it)->tabstrip_model(); |
| 428 for (int i = 0, size = model->count(); i < size; ++i) { | 429 for (int i = 0, size = model->count(); i < size; ++i) { |
| 429 NavigationController& controller = | 430 NavigationController& controller = |
| 430 model->GetTabContentsAt(i)->controller(); | 431 model->GetTabContentsAt(i)->controller(); |
| 431 if (controller.session_id().id() == session_id) | 432 if (controller.session_id().id() == session_id) |
| 432 return controller.tab_contents(); | 433 return controller.tab_contents(); |
| 433 } | 434 } |
| 434 } | 435 } |
| 435 return NULL; | 436 return NULL; |
| 436 } | 437 } |
| OLD | NEW |