| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer/devtools_agent.h" | 5 #include "chrome/renderer/devtools_agent.h" |
| 6 | 6 |
| 7 #include "chrome/common/devtools_messages.h" | 7 #include "chrome/common/devtools_messages.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "chrome/renderer/render_view.h" | 9 #include "chrome/renderer/render_view.h" |
| 10 #include "webkit/glue/webdevtoolsagent.h" | 10 #include "webkit/glue/webdevtoolsagent.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach) | 37 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach) |
| 38 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage) | 38 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage) |
| 39 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement) | 39 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement) |
| 40 IPC_MESSAGE_UNHANDLED(handled = false) | 40 IPC_MESSAGE_UNHANDLED(handled = false) |
| 41 IPC_END_MESSAGE_MAP() | 41 IPC_END_MESSAGE_MAP() |
| 42 return handled; | 42 return handled; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void DevToolsAgent::SendMessageToClient(const std::string& class_name, | 45 void DevToolsAgent::SendMessageToClient(const std::string& class_name, |
| 46 const std::string& method_name, | 46 const std::string& method_name, |
| 47 const std::string& raw_msg) { | 47 const std::string& param1, |
| 48 const std::string& param2, |
| 49 const std::string& param3) { |
| 48 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient( | 50 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient( |
| 49 routing_id_, | 51 routing_id_, |
| 50 DevToolsClientMsg_RpcMessage(class_name, method_name, raw_msg)); | 52 DevToolsClientMsg_RpcMessage(class_name, method_name, param1, param2, |
| 53 param3)); |
| 51 view_->Send(m); | 54 view_->Send(m); |
| 52 } | 55 } |
| 53 | 56 |
| 54 int DevToolsAgent::GetHostId() { | 57 int DevToolsAgent::GetHostId() { |
| 55 return routing_id_; | 58 return routing_id_; |
| 56 } | 59 } |
| 57 | 60 |
| 58 void DevToolsAgent::ForceRepaint() { | 61 void DevToolsAgent::ForceRepaint() { |
| 59 view_->GenerateFullRepaint(); | 62 view_->GenerateFullRepaint(); |
| 60 } | 63 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 78 | 81 |
| 79 void DevToolsAgent::OnDetach() { | 82 void DevToolsAgent::OnDetach() { |
| 80 WebDevToolsAgent* web_agent = GetWebAgent(); | 83 WebDevToolsAgent* web_agent = GetWebAgent(); |
| 81 if (web_agent) { | 84 if (web_agent) { |
| 82 web_agent->Detach(); | 85 web_agent->Detach(); |
| 83 } | 86 } |
| 84 } | 87 } |
| 85 | 88 |
| 86 void DevToolsAgent::OnRpcMessage(const std::string& class_name, | 89 void DevToolsAgent::OnRpcMessage(const std::string& class_name, |
| 87 const std::string& method_name, | 90 const std::string& method_name, |
| 88 const std::string& raw_msg) { | 91 const std::string& param1, |
| 92 const std::string& param2, |
| 93 const std::string& param3) { |
| 89 WebDevToolsAgent* web_agent = GetWebAgent(); | 94 WebDevToolsAgent* web_agent = GetWebAgent(); |
| 90 if (web_agent) { | 95 if (web_agent) { |
| 91 web_agent->DispatchMessageFromClient(class_name, method_name, raw_msg); | 96 web_agent->DispatchMessageFromClient(class_name, method_name, param1, |
| 97 param2, param3); |
| 92 } | 98 } |
| 93 } | 99 } |
| 94 | 100 |
| 95 void DevToolsAgent::OnInspectElement(int x, int y) { | 101 void DevToolsAgent::OnInspectElement(int x, int y) { |
| 96 WebDevToolsAgent* web_agent = GetWebAgent(); | 102 WebDevToolsAgent* web_agent = GetWebAgent(); |
| 97 if (web_agent) { | 103 if (web_agent) { |
| 98 web_agent->Attach(); | 104 web_agent->Attach(); |
| 99 web_agent->InspectElement(x, y); | 105 web_agent->InspectElement(x, y); |
| 100 } | 106 } |
| 101 } | 107 } |
| 102 | 108 |
| 103 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { | 109 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { |
| 104 WebView* web_view = view_->webview(); | 110 WebView* web_view = view_->webview(); |
| 105 if (!web_view) | 111 if (!web_view) |
| 106 return NULL; | 112 return NULL; |
| 107 return web_view->GetWebDevToolsAgent(); | 113 return web_view->GetWebDevToolsAgent(); |
| 108 } | 114 } |
| OLD | NEW |