// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ #define WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ #include #include #include #include "webkit/glue/devtools/devtools_rpc.h" #include "webkit/glue/devtools/dom_agent.h" #include "webkit/glue/devtools/net_agent.h" #include "webkit/glue/devtools/tools_agent.h" #include "webkit/glue/webdevtoolsagent.h" namespace WebCore { class Document; class Node; class String; } class DebuggerAgentDelegateStub; class DebuggerAgentImpl; class DomAgentImpl; class NetAgentImpl; class Value; class WebDevToolsAgentDelegate; class WebFrame; class WebFrame; class WebViewImpl; class WebDevToolsAgentImpl : public WebDevToolsAgent, public ToolsAgent, public DevToolsRpc::Delegate { public: WebDevToolsAgentImpl(WebViewImpl* web_view_impl, WebDevToolsAgentDelegate* delegate); virtual ~WebDevToolsAgentImpl(); // ToolsAgent implementation. virtual void HighlightDOMNode(int node_id); virtual void HideDOMNodeHighlight(); virtual void EvaluateJavaScript(int call_id, const String& js); virtual void ExecuteUtilityFunction( int call_id, const WebCore::String& function_name, int node_id, const WebCore::String& json_args); virtual void ClearConsoleMessages(); // WebDevToolsAgent implementation. virtual void Attach(); virtual void Detach(); virtual void DispatchMessageFromClient(const std::string& raw_msg); virtual void InspectElement(int x, int y); // DevToolsRpc::Delegate implementation. void SendRpcMessage(const std::string& raw_msg); // Methods called by the glue. void SetMainFrameDocumentReady(bool ready); void DidCommitLoadForFrame(WebViewImpl* webview, WebFrame* frame, bool is_new_navigation); void AddMessageToConsole( const WebCore::String& message, const WebCore::String& source_id, unsigned int line_no); int host_id() { return host_id_; } NetAgentImpl* net_agent_impl() { return net_agent_impl_.get(); } private: struct ConsoleMessage { ConsoleMessage(const String& m, const String& sid, unsigned li) : message(m), source_id(sid), line_no(li) { } WebCore::String message; WebCore::String source_id; unsigned int line_no; }; int host_id_; WebDevToolsAgentDelegate* delegate_; WebViewImpl* web_view_impl_; WebCore::Document* document_; OwnPtr debugger_agent_delegate_stub_; OwnPtr dom_agent_delegate_stub_; OwnPtr net_agent_delegate_stub_; OwnPtr tools_agent_delegate_stub_; OwnPtr debugger_agent_impl_; OwnPtr dom_agent_impl_; OwnPtr net_agent_impl_; Vector console_log_; bool attached_; DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl); }; #endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_