| 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/inspectable_tab_proxy.h" | 5 #include "chrome/browser/debugger/inspectable_tab_proxy.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 // The remote debugger has detached. | 24 // The remote debugger has detached. |
| 25 void DevToolsClientHostImpl::Close() { | 25 void DevToolsClientHostImpl::Close() { |
| 26 NotifyCloseListener(); | 26 NotifyCloseListener(); |
| 27 delete this; | 27 delete this; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void DevToolsClientHostImpl::SendMessageToClient( | 30 void DevToolsClientHostImpl::SendMessageToClient( |
| 31 const IPC::Message& msg) { | 31 const IPC::Message& msg) { |
| 32 // TODO(prybin): Restore FrameNavigate. |
| 32 IPC_BEGIN_MESSAGE_MAP(DevToolsClientHostImpl, msg) | 33 IPC_BEGIN_MESSAGE_MAP(DevToolsClientHostImpl, msg) |
| 33 IPC_MESSAGE_HANDLER(DevToolsClientMsg_RpcMessage, OnRpcMessage); | 34 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DebuggerOutput, OnDebuggerOutput); |
| 34 IPC_MESSAGE_UNHANDLED_ERROR() | 35 IPC_MESSAGE_UNHANDLED_ERROR() |
| 35 IPC_END_MESSAGE_MAP() | 36 IPC_END_MESSAGE_MAP() |
| 36 } | 37 } |
| 37 | 38 |
| 38 void DevToolsClientHostImpl::OnRpcMessage(const DevToolsMessageData& data) { | |
| 39 static const std::string kDebuggerAgentDelegate = "DebuggerAgentDelegate"; | |
| 40 static const std::string kToolsAgentDelegate = "ToolsAgentDelegate"; | |
| 41 static const std::string kDebuggerOutput = "debuggerOutput"; | |
| 42 static const std::string kFrameNavigate = "frameNavigate"; | |
| 43 | 39 |
| 44 if (data.class_name == kDebuggerAgentDelegate && | 40 void DevToolsClientHostImpl::OnDebuggerOutput(const std::string& data) { |
| 45 data.method_name == kDebuggerOutput) { | 41 service_->DebuggerOutput(id_, data); |
| 46 DebuggerOutput(data.arguments[0]); | |
| 47 } else if (data.class_name == kToolsAgentDelegate && | |
| 48 data.method_name == kFrameNavigate) { | |
| 49 FrameNavigate(data.arguments[0]); | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 void DevToolsClientHostImpl::DebuggerOutput(const std::string& msg) { | |
| 54 service_->DebuggerOutput(id_, msg); | |
| 55 } | 42 } |
| 56 | 43 |
| 57 void DevToolsClientHostImpl::FrameNavigate(const std::string& url) { | 44 void DevToolsClientHostImpl::FrameNavigate(const std::string& url) { |
| 58 service_->FrameNavigate(id_, url); | 45 service_->FrameNavigate(id_, url); |
| 59 } | 46 } |
| 60 | 47 |
| 61 void DevToolsClientHostImpl::TabClosed() { | 48 void DevToolsClientHostImpl::TabClosed() { |
| 62 service_->TabClosed(id_); | 49 service_->TabClosed(id_); |
| 63 } | 50 } |
| 64 | 51 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return client_host; | 83 return client_host; |
| 97 } | 84 } |
| 98 | 85 |
| 99 void InspectableTabProxy::OnRemoteDebuggerDetached() { | 86 void InspectableTabProxy::OnRemoteDebuggerDetached() { |
| 100 while (id_to_client_host_map_.size() > 0) { | 87 while (id_to_client_host_map_.size() > 0) { |
| 101 IdToClientHostMap::iterator it = id_to_client_host_map_.begin(); | 88 IdToClientHostMap::iterator it = id_to_client_host_map_.begin(); |
| 102 it->second->debugger_remote_service()->DetachFromTab( | 89 it->second->debugger_remote_service()->DetachFromTab( |
| 103 base::IntToString(it->first), NULL); | 90 base::IntToString(it->first), NULL); |
| 104 } | 91 } |
| 105 } | 92 } |
| OLD | NEW |