| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "Document.h" | 9 #include "Document.h" |
| 10 #include "EventListener.h" | 10 #include "EventListener.h" |
| 11 #include "InspectorController.h" | 11 #include "InspectorController.h" |
| 12 #include "InspectorFrontend.h" | 12 #include "InspectorFrontend.h" |
| 13 #include "InspectorResource.h" | 13 #include "InspectorResource.h" |
| 14 #include "Node.h" | 14 #include "Node.h" |
| 15 #include "Page.h" | 15 #include "Page.h" |
| 16 #include "PlatformString.h" | 16 #include "PlatformString.h" |
| 17 #include "ScriptObject.h" | 17 #include "ScriptObject.h" |
| 18 #include "ScriptState.h" | 18 #include "ScriptState.h" |
| 19 #include "ScriptValue.h" | 19 #include "ScriptValue.h" |
| 20 #include "V8Binding.h" | 20 #include "V8Binding.h" |
| 21 #include "V8Proxy.h" | 21 #include "V8Proxy.h" |
| 22 #include <wtf/OwnPtr.h> | 22 #include <wtf/OwnPtr.h> |
| 23 #undef LOG | 23 #undef LOG |
| 24 | 24 |
| 25 #include "base/values.h" | |
| 26 #include "webkit/api/public/WebDataSource.h" | 25 #include "webkit/api/public/WebDataSource.h" |
| 27 #include "webkit/api/public/WebURL.h" | 26 #include "webkit/api/public/WebURL.h" |
| 28 #include "webkit/api/public/WebURLRequest.h" | 27 #include "webkit/api/public/WebURLRequest.h" |
| 29 #include "webkit/glue/devtools/bound_object.h" | 28 #include "webkit/glue/devtools/bound_object.h" |
| 30 #include "webkit/glue/devtools/debugger_agent_impl.h" | 29 #include "webkit/glue/devtools/debugger_agent_impl.h" |
| 31 #include "webkit/glue/devtools/debugger_agent_manager.h" | 30 #include "webkit/glue/devtools/debugger_agent_manager.h" |
| 32 #include "webkit/glue/glue_util.h" | 31 #include "webkit/glue/glue_util.h" |
| 33 #include "webkit/glue/webdevtoolsagent_delegate.h" | 32 #include "webkit/glue/webdevtoolsagent_delegate.h" |
| 34 #include "webkit/glue/webdevtoolsagent_impl.h" | 33 #include "webkit/glue/webdevtoolsagent_impl.h" |
| 35 #include "webkit/glue/webview_impl.h" | 34 #include "webkit/glue/webview_impl.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (resource.get()) { | 183 if (resource.get()) { |
| 185 content = resource->sourceString(); | 184 content = resource->sourceString(); |
| 186 } | 185 } |
| 187 } | 186 } |
| 188 tools_agent_native_delegate_stub_->DidGetResourceContent(call_id, content); | 187 tools_agent_native_delegate_stub_->DidGetResourceContent(call_id, content); |
| 189 } | 188 } |
| 190 | 189 |
| 191 void WebDevToolsAgentImpl::DispatchMessageFromClient( | 190 void WebDevToolsAgentImpl::DispatchMessageFromClient( |
| 192 const std::string& class_name, | 191 const std::string& class_name, |
| 193 const std::string& method_name, | 192 const std::string& method_name, |
| 194 const std::string& raw_msg) { | 193 const std::string& param1, |
| 195 OwnPtr<ListValue> message( | 194 const std::string& param2, |
| 196 static_cast<ListValue*>(DevToolsRpc::ParseMessage(raw_msg))); | 195 const std::string& param3) { |
| 197 if (ToolsAgentDispatch::Dispatch( | 196 if (ToolsAgentDispatch::Dispatch( |
| 198 this, class_name, method_name, *message.get())) { | 197 this, class_name, method_name, param1, param2, param3)) { |
| 199 return; | 198 return; |
| 200 } | 199 } |
| 201 | 200 |
| 202 if (!attached_) { | 201 if (!attached_) { |
| 203 return; | 202 return; |
| 204 } | 203 } |
| 205 | 204 |
| 206 if (debugger_agent_impl_.get() && | 205 if (debugger_agent_impl_.get() && |
| 207 DebuggerAgentDispatch::Dispatch( | 206 DebuggerAgentDispatch::Dispatch( |
| 208 debugger_agent_impl_.get(), class_name, method_name, | 207 debugger_agent_impl_.get(), class_name, method_name, |
| 209 *message.get())) { | 208 param1, param2, param3)) { |
| 210 return; | 209 return; |
| 211 } | 210 } |
| 212 } | 211 } |
| 213 | 212 |
| 214 void WebDevToolsAgentImpl::InspectElement(int x, int y) { | 213 void WebDevToolsAgentImpl::InspectElement(int x, int y) { |
| 215 Node* node = web_view_impl_->GetNodeForWindowPos(x, y); | 214 Node* node = web_view_impl_->GetNodeForWindowPos(x, y); |
| 216 if (!node) { | 215 if (!node) { |
| 217 return; | 216 return; |
| 218 } | 217 } |
| 219 InspectorController* ic = web_view_impl_->page()->inspectorController(); | 218 InspectorController* ic = web_view_impl_->page()->inspectorController(); |
| 220 ic->inspect(node); | 219 ic->inspect(node); |
| 221 } | 220 } |
| 222 | 221 |
| 223 void WebDevToolsAgentImpl::SendRpcMessage( | 222 void WebDevToolsAgentImpl::SendRpcMessage( |
| 224 const std::string& class_name, | 223 const std::string& class_name, |
| 225 const std::string& method_name, | 224 const std::string& method_name, |
| 226 const std::string& raw_msg) { | 225 const std::string& param1, |
| 227 delegate_->SendMessageToClient(class_name, method_name, raw_msg); | 226 const std::string& param2, |
| 227 const std::string& param3) { |
| 228 delegate_->SendMessageToClient(class_name, method_name, param1, param2, |
| 229 param3); |
| 228 } | 230 } |
| 229 | 231 |
| 230 void WebDevToolsAgentImpl::InitDevToolsAgentHost() { | 232 void WebDevToolsAgentImpl::InitDevToolsAgentHost() { |
| 231 devtools_agent_host_.set( | 233 devtools_agent_host_.set( |
| 232 new BoundObject(utility_context_, this, "DevToolsAgentHost")); | 234 new BoundObject(utility_context_, this, "DevToolsAgentHost")); |
| 233 devtools_agent_host_->AddProtoFunction( | 235 devtools_agent_host_->AddProtoFunction( |
| 234 "dispatch", | 236 "dispatch", |
| 235 WebDevToolsAgentImpl::JsDispatchOnClient); | 237 WebDevToolsAgentImpl::JsDispatchOnClient); |
| 236 devtools_agent_host_->Build(); | 238 devtools_agent_host_->Build(); |
| 237 | 239 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 263 const std::string& command, | 265 const std::string& command, |
| 264 int caller_id) { | 266 int caller_id) { |
| 265 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id); | 267 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id); |
| 266 } | 268 } |
| 267 | 269 |
| 268 // static | 270 // static |
| 269 void WebDevToolsAgent::SetMessageLoopDispatchHandler( | 271 void WebDevToolsAgent::SetMessageLoopDispatchHandler( |
| 270 MessageLoopDispatchHandler handler) { | 272 MessageLoopDispatchHandler handler) { |
| 271 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); | 273 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); |
| 272 } | 274 } |
| OLD | NEW |