Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: webkit/glue/webdevtoolsagent_impl.h

Issue 113836: DevTools: introduce bound object on the agent side. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/inspector_client_impl.cc ('k') | webkit/glue/webdevtoolsagent_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
12 11
13 #include "v8.h" 12 #include "v8.h"
14 #include "webkit/glue/devtools/devtools_rpc.h" 13 #include "webkit/glue/devtools/devtools_rpc.h"
15 #include "webkit/glue/devtools/dom_agent.h" 14 #include "webkit/glue/devtools/dom_agent.h"
16 #include "webkit/glue/devtools/net_agent.h"
17 #include "webkit/glue/devtools/tools_agent.h" 15 #include "webkit/glue/devtools/tools_agent.h"
18 #include "webkit/glue/webdevtoolsagent.h" 16 #include "webkit/glue/webdevtoolsagent.h"
19 17
20 namespace WebCore { 18 namespace WebCore {
21 class Document; 19 class Document;
22 class Node; 20 class Node;
23 class String; 21 class String;
24 } 22 }
25 23
24 class BoundObject;
26 class DebuggerAgentDelegateStub; 25 class DebuggerAgentDelegateStub;
27 class DebuggerAgentImpl; 26 class DebuggerAgentImpl;
28 class DomAgentImpl; 27 class DomAgentImpl;
29 class NetAgentImpl; 28 class NetAgentImpl;
30 class Value; 29 class Value;
31 class WebDevToolsAgentDelegate; 30 class WebDevToolsAgentDelegate;
32 class WebFrame; 31 class WebFrame;
33 class WebFrameImpl; 32 class WebFrameImpl;
34 class WebViewImpl; 33 class WebViewImpl;
35 34
36 class WebDevToolsAgentImpl 35 class WebDevToolsAgentImpl
37 : public WebDevToolsAgent, 36 : public WebDevToolsAgent,
38 public ToolsAgent, 37 public ToolsAgent,
39 public DevToolsRpc::Delegate { 38 public DevToolsRpc::Delegate {
40 public: 39 public:
41 WebDevToolsAgentImpl(WebViewImpl* web_view_impl, 40 WebDevToolsAgentImpl(WebViewImpl* web_view_impl,
42 WebDevToolsAgentDelegate* delegate); 41 WebDevToolsAgentDelegate* delegate);
43 virtual ~WebDevToolsAgentImpl(); 42 virtual ~WebDevToolsAgentImpl();
44 43
45 // ToolsAgent implementation. 44 // ToolsAgent implementation.
46 virtual void HighlightDOMNode(int node_id); 45 virtual void HighlightDOMNode(int node_id);
47 virtual void HideDOMNodeHighlight(); 46 virtual void HideDOMNodeHighlight();
48 virtual void EvaluateJavaScript(int call_id, const String& js); 47 virtual void EvaluateJavaScript(int call_id, const String& js);
49 virtual void ExecuteUtilityFunction( 48 virtual void ExecuteUtilityFunction(
50 int call_id, 49 int call_id,
51 const WebCore::String& function_name, 50 const WebCore::String& function_name,
52 int node_id, 51 int node_id,
53 const WebCore::String& json_args); 52 const WebCore::String& json_args);
54 virtual void ClearConsoleMessages(); 53 virtual void ClearConsoleMessages();
54 virtual void GetResourceContent(
55 int call_id,
56 int identifier);
55 57
56 // WebDevToolsAgent implementation. 58 // WebDevToolsAgent implementation.
57 virtual void Attach(); 59 virtual void Attach();
58 virtual void Detach(); 60 virtual void Detach();
59 virtual void DispatchMessageFromClient(const std::string& raw_msg); 61 virtual void DispatchMessageFromClient(const std::string& raw_msg);
60 virtual void InspectElement(int x, int y); 62 virtual void InspectElement(int x, int y);
61 63
62 // DevToolsRpc::Delegate implementation. 64 // DevToolsRpc::Delegate implementation.
63 void SendRpcMessage(const std::string& raw_msg); 65 void SendRpcMessage(const std::string& raw_msg);
64 66
65 // Methods called by the glue. 67 // Methods called by the glue.
66 void SetMainFrameDocumentReady(bool ready); 68 void SetMainFrameDocumentReady(bool ready);
67 void DidCommitLoadForFrame(WebViewImpl* webview, 69 void DidCommitLoadForFrame(WebViewImpl* webview,
68 WebFrame* frame, 70 WebFrame* frame,
69 bool is_new_navigation); 71 bool is_new_navigation);
70 void AddMessageToConsole(
71 int source,
72 int level,
73 const WebCore::String& message,
74 unsigned int line_no,
75 const WebCore::String& source_id);
76 72
77 void WindowObjectCleared(WebFrameImpl* webframe); 73 void WindowObjectCleared(WebFrameImpl* webframe);
78 74
79 void ForceRepaint(); 75 void ForceRepaint();
80 76
81 int host_id() { return host_id_; } 77 int host_id() { return host_id_; }
82 NetAgentImpl* net_agent_impl() { return net_agent_impl_.get(); }
83 78
84 private: 79 private:
85 struct ConsoleMessage { 80 static v8::Handle<v8::Value> JsDispatchOnClient(const v8::Arguments& args);
86 ConsoleMessage(
87 int src, int lvl, const String& m, unsigned li, const String& sid)
88 : source(src),
89 level(lvl),
90 text(m),
91 line_no(li),
92 source_id(sid) {
93 }
94 int source;
95 int level;
96 WebCore::String text;
97 WebCore::String source_id;
98 unsigned int line_no;
99 };
100
101 static void Serialize(const ConsoleMessage& message, DictionaryValue* value);
102 81
103 int host_id_; 82 int host_id_;
104 WebDevToolsAgentDelegate* delegate_; 83 WebDevToolsAgentDelegate* delegate_;
105 WebViewImpl* web_view_impl_; 84 WebViewImpl* web_view_impl_;
106 WebCore::Document* document_; 85 WebCore::Document* document_;
107 OwnPtr<DebuggerAgentDelegateStub> debugger_agent_delegate_stub_; 86 OwnPtr<DebuggerAgentDelegateStub> debugger_agent_delegate_stub_;
108 OwnPtr<DomAgentDelegateStub> dom_agent_delegate_stub_; 87 OwnPtr<DomAgentDelegateStub> dom_agent_delegate_stub_;
109 OwnPtr<NetAgentDelegateStub> net_agent_delegate_stub_;
110 OwnPtr<ToolsAgentDelegateStub> tools_agent_delegate_stub_; 88 OwnPtr<ToolsAgentDelegateStub> tools_agent_delegate_stub_;
111 OwnPtr<DebuggerAgentImpl> debugger_agent_impl_; 89 OwnPtr<DebuggerAgentImpl> debugger_agent_impl_;
112 OwnPtr<DomAgentImpl> dom_agent_impl_; 90 OwnPtr<DomAgentImpl> dom_agent_impl_;
113 OwnPtr<NetAgentImpl> net_agent_impl_;
114 Vector<ConsoleMessage> console_log_;
115 bool attached_; 91 bool attached_;
116 // TODO(pfeldman): This should not be needed once GC styles issue is fixed 92 // TODO(pfeldman): This should not be needed once GC styles issue is fixed
117 // for matching rules. 93 // for matching rules.
118 v8::Persistent<v8::Context> utility_context_; 94 v8::Persistent<v8::Context> utility_context_;
95 OwnPtr<BoundObject> web_inspector_stub_;
119 DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl); 96 DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl);
120 }; 97 };
121 98
122 #endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_ 99 #endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/glue/inspector_client_impl.cc ('k') | webkit/glue/webdevtoolsagent_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698