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

Side by Side Diff: chrome/renderer/devtools_agent.cc

Issue 3005044: DevTools: Get rid of DevTools RPC. (Closed)
Patch Set: More files removed Created 10 years, 4 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
« no previous file with comments | « chrome/renderer/devtools_agent.h ('k') | chrome/renderer/devtools_agent_filter.h » ('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 #include "chrome/renderer/devtools_agent.h" 5 #include "chrome/renderer/devtools_agent.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/devtools_messages.h" 9 #include "chrome/common/devtools_messages.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
11 #include "chrome/renderer/devtools_agent_filter.h" 11 #include "chrome/renderer/devtools_agent_filter.h"
12 #include "chrome/renderer/render_view.h" 12 #include "chrome/renderer/render_view.h"
13 #include "grit/webkit_chromium_resources.h" 13 #include "grit/webkit_chromium_resources.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" 14 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h"
15 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsMessageData.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
17 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 16 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
18 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 17 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
19 #include "webkit/glue/devtools_message_data.h" 18 #include "webkit/glue/devtools_message_data.h"
20 #include "webkit/glue/webkit_glue.h" 19 #include "webkit/glue/webkit_glue.h"
21 20
22 using WebKit::WebDevToolsAgent; 21 using WebKit::WebDevToolsAgent;
23 using WebKit::WebDevToolsAgentClient; 22 using WebKit::WebDevToolsAgentClient;
24 using WebKit::WebPoint; 23 using WebKit::WebPoint;
25 using WebKit::WebString; 24 using WebKit::WebString;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 web_agent->didNavigate(); 72 web_agent->didNavigate();
74 } 73 }
75 } 74 }
76 75
77 // Called on the Renderer thread. 76 // Called on the Renderer thread.
78 bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { 77 bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
79 bool handled = true; 78 bool handled = true;
80 IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message) 79 IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message)
81 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach) 80 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach)
82 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach) 81 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach)
83 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage) 82 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend,
83 OnDispatchOnInspectorBackend)
84 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement) 84 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement)
85 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_SetApuAgentEnabled, 85 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_SetApuAgentEnabled,
86 OnSetApuAgentEnabled) 86 OnSetApuAgentEnabled)
87 IPC_MESSAGE_UNHANDLED(handled = false) 87 IPC_MESSAGE_UNHANDLED(handled = false)
88 IPC_END_MESSAGE_MAP() 88 IPC_END_MESSAGE_MAP()
89 return handled; 89 return handled;
90 } 90 }
91 91
92 void DevToolsAgent::sendMessageToFrontend( 92 void DevToolsAgent::sendMessageToInspectorFrontend(
93 const WebKit::WebDevToolsMessageData& data) { 93 const WebKit::WebString& message) {
94 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient( 94 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
95 routing_id_, 95 routing_id_,
96 DevToolsClientMsg_RpcMessage(DevToolsMessageData(data))); 96 DevToolsClientMsg_DispatchOnInspectorFrontend(message.utf8()));
97 render_view_->Send(m); 97 render_view_->Send(m);
98 } 98 }
99 99
100 void DevToolsAgent::sendDebuggerOutput(const WebKit::WebString& data) {
101 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
102 routing_id_,
103 DevToolsClientMsg_DebuggerOutput(data.utf8()));
104 render_view_->Send(m);
105 }
106
107 void DevToolsAgent::sendDispatchToAPU(const WebKit::WebString& data) {
108 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
109 routing_id_,
110 DevToolsClientMsg_DispatchToAPU(data.utf8()));
111 render_view_->Send(m);
112 }
113
100 int DevToolsAgent::hostIdentifier() { 114 int DevToolsAgent::hostIdentifier() {
101 return routing_id_; 115 return routing_id_;
102 } 116 }
103 117
104 void DevToolsAgent::forceRepaint() { 118 void DevToolsAgent::forceRepaint() {
105 render_view_->GenerateFullRepaint(); 119 render_view_->GenerateFullRepaint();
106 } 120 }
107 121
108 void DevToolsAgent::runtimeFeatureStateChanged(const WebKit::WebString& feature, 122 void DevToolsAgent::runtimeFeatureStateChanged(const WebKit::WebString& feature,
109 bool enabled) { 123 bool enabled) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 176 }
163 } 177 }
164 178
165 void DevToolsAgent::OnDetach() { 179 void DevToolsAgent::OnDetach() {
166 WebDevToolsAgent* web_agent = GetWebAgent(); 180 WebDevToolsAgent* web_agent = GetWebAgent();
167 if (web_agent) { 181 if (web_agent) {
168 web_agent->detach(); 182 web_agent->detach();
169 } 183 }
170 } 184 }
171 185
172 void DevToolsAgent::OnRpcMessage(const DevToolsMessageData& data) { 186 void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) {
173 WebDevToolsAgent* web_agent = GetWebAgent(); 187 WebDevToolsAgent* web_agent = GetWebAgent();
174 if (web_agent) { 188 if (web_agent)
175 web_agent->dispatchMessageFromFrontend(data.ToWebDevToolsMessageData()); 189 web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message));
176 }
177 } 190 }
178 191
179 void DevToolsAgent::OnInspectElement(int x, int y) { 192 void DevToolsAgent::OnInspectElement(int x, int y) {
180 WebDevToolsAgent* web_agent = GetWebAgent(); 193 WebDevToolsAgent* web_agent = GetWebAgent();
181 if (web_agent) { 194 if (web_agent) {
182 web_agent->attach(); 195 web_agent->attach();
183 web_agent->inspectElementAt(WebPoint(x, y)); 196 web_agent->inspectElementAt(WebPoint(x, y));
184 } 197 }
185 } 198 }
186 199
187 void DevToolsAgent::OnSetApuAgentEnabled(bool enabled) { 200 void DevToolsAgent::OnSetApuAgentEnabled(bool enabled) {
188 WebDevToolsAgent* web_agent = GetWebAgent(); 201 WebDevToolsAgent* web_agent = GetWebAgent();
189 if (web_agent) 202 if (web_agent)
190 web_agent->setRuntimeFeatureEnabled("apu-agent", enabled); 203 web_agent->setRuntimeFeatureEnabled("apu-agent", enabled);
191 } 204 }
192 205
193 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { 206 WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
194 WebView* web_view = render_view_->webview(); 207 WebView* web_view = render_view_->webview();
195 if (!web_view) 208 if (!web_view)
196 return NULL; 209 return NULL;
197 return web_view->devToolsAgent(); 210 return web_view->devToolsAgent();
198 } 211 }
OLDNEW
« no previous file with comments | « chrome/renderer/devtools_agent.h ('k') | chrome/renderer/devtools_agent_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698