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 #ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ |
6 #define WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ | 6 #define WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <wtf/OwnPtr.h> | 10 #include <wtf/OwnPtr.h> |
| 11 #include <wtf/Vector.h> |
11 | 12 |
12 #include "webkit/glue/devtools/devtools_rpc.h" | 13 #include "webkit/glue/devtools/devtools_rpc.h" |
13 #include "webkit/glue/devtools/dom_agent.h" | 14 #include "webkit/glue/devtools/dom_agent.h" |
14 #include "webkit/glue/devtools/net_agent.h" | 15 #include "webkit/glue/devtools/net_agent.h" |
15 #include "webkit/glue/devtools/tools_agent.h" | 16 #include "webkit/glue/devtools/tools_agent.h" |
16 #include "webkit/glue/webdevtoolsagent.h" | 17 #include "webkit/glue/webdevtoolsagent.h" |
17 | 18 |
18 namespace WebCore { | 19 namespace WebCore { |
19 class Document; | 20 class Document; |
20 class Node; | 21 class Node; |
(...skipping 21 matching lines...) Expand all Loading... |
42 | 43 |
43 // ToolsAgent implementation. | 44 // ToolsAgent implementation. |
44 virtual void HighlightDOMNode(int node_id); | 45 virtual void HighlightDOMNode(int node_id); |
45 virtual void HideDOMNodeHighlight(); | 46 virtual void HideDOMNodeHighlight(); |
46 virtual void EvaluateJavaScript(int call_id, const String& js); | 47 virtual void EvaluateJavaScript(int call_id, const String& js); |
47 virtual void ExecuteUtilityFunction( | 48 virtual void ExecuteUtilityFunction( |
48 int call_id, | 49 int call_id, |
49 const WebCore::String& function_name, | 50 const WebCore::String& function_name, |
50 int node_id, | 51 int node_id, |
51 const WebCore::String& json_args); | 52 const WebCore::String& json_args); |
| 53 virtual void ClearConsoleMessages(); |
52 | 54 |
53 // WebDevToolsAgent implementation. | 55 // WebDevToolsAgent implementation. |
54 virtual void Attach(); | 56 virtual void Attach(); |
55 virtual void Detach(); | 57 virtual void Detach(); |
56 virtual void DispatchMessageFromClient(const std::string& raw_msg); | 58 virtual void DispatchMessageFromClient(const std::string& raw_msg); |
57 virtual void InspectElement(int x, int y); | 59 virtual void InspectElement(int x, int y); |
58 | 60 |
59 // DevToolsRpc::Delegate implementation. | 61 // DevToolsRpc::Delegate implementation. |
60 void SendRpcMessage(const std::string& raw_msg); | 62 void SendRpcMessage(const std::string& raw_msg); |
61 | 63 |
62 // Methods called by the glue. | 64 // Methods called by the glue. |
63 void SetMainFrameDocumentReady(bool ready); | 65 void SetMainFrameDocumentReady(bool ready); |
64 void DidCommitLoadForFrame(WebViewImpl* webview, | 66 void DidCommitLoadForFrame(WebViewImpl* webview, |
65 WebFrame* frame, | 67 WebFrame* frame, |
66 bool is_new_navigation); | 68 bool is_new_navigation); |
| 69 void AddMessageToConsole( |
| 70 const WebCore::String& message, |
| 71 const WebCore::String& source_id, |
| 72 unsigned int line_no); |
67 | 73 |
68 NetAgentImpl* net_agent_impl() { return net_agent_impl_.get(); } | 74 NetAgentImpl* net_agent_impl() { return net_agent_impl_.get(); } |
69 | 75 |
70 private: | 76 private: |
| 77 struct ConsoleMessage { |
| 78 ConsoleMessage(const String& m, const String& sid, unsigned li) |
| 79 : message(m), |
| 80 source_id(sid), |
| 81 line_no(li) { |
| 82 } |
| 83 WebCore::String message; |
| 84 WebCore::String source_id; |
| 85 unsigned int line_no; |
| 86 }; |
71 WebDevToolsAgentDelegate* delegate_; | 87 WebDevToolsAgentDelegate* delegate_; |
72 WebViewImpl* web_view_impl_; | 88 WebViewImpl* web_view_impl_; |
73 WebCore::Document* document_; | 89 WebCore::Document* document_; |
74 OwnPtr<DebuggerAgentDelegateStub> debugger_agent_delegate_stub_; | 90 OwnPtr<DebuggerAgentDelegateStub> debugger_agent_delegate_stub_; |
75 OwnPtr<DomAgentDelegateStub> dom_agent_delegate_stub_; | 91 OwnPtr<DomAgentDelegateStub> dom_agent_delegate_stub_; |
76 OwnPtr<NetAgentDelegateStub> net_agent_delegate_stub_; | 92 OwnPtr<NetAgentDelegateStub> net_agent_delegate_stub_; |
77 OwnPtr<ToolsAgentDelegateStub> tools_agent_delegate_stub_; | 93 OwnPtr<ToolsAgentDelegateStub> tools_agent_delegate_stub_; |
78 OwnPtr<DebuggerAgentImpl> debugger_agent_impl_; | 94 OwnPtr<DebuggerAgentImpl> debugger_agent_impl_; |
79 OwnPtr<DomAgentImpl> dom_agent_impl_; | 95 OwnPtr<DomAgentImpl> dom_agent_impl_; |
80 OwnPtr<NetAgentImpl> net_agent_impl_; | 96 OwnPtr<NetAgentImpl> net_agent_impl_; |
| 97 Vector<ConsoleMessage> console_log_; |
81 bool attached_; | 98 bool attached_; |
82 DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl); | 99 DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl); |
83 }; | 100 }; |
84 | 101 |
85 #endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ | 102 #endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ |
OLD | NEW |