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

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

Issue 6119005: DevTools: migrate APU from dedicated commands to the inspector protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fixed. Created 9 years, 11 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 | « chrome/renderer/devtools_agent.h ('k') | no next file » | 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 <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Called on the Renderer thread. 76 // Called on the Renderer thread.
77 bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { 77 bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
78 bool handled = true; 78 bool handled = true;
79 IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message) 79 IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message)
80 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach) 80 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach)
81 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach) 81 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach)
82 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_FrontendLoaded, OnFrontendLoaded) 82 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_FrontendLoaded, OnFrontendLoaded)
83 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, 83 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend,
84 OnDispatchOnInspectorBackend) 84 OnDispatchOnInspectorBackend)
85 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement) 85 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement)
86 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_SetApuAgentEnabled,
87 OnSetApuAgentEnabled)
88 IPC_MESSAGE_UNHANDLED(handled = false) 86 IPC_MESSAGE_UNHANDLED(handled = false)
89 IPC_END_MESSAGE_MAP() 87 IPC_END_MESSAGE_MAP()
90 return handled; 88 return handled;
91 } 89 }
92 90
93 void DevToolsAgent::sendMessageToInspectorFrontend( 91 void DevToolsAgent::sendMessageToInspectorFrontend(
94 const WebKit::WebString& message) { 92 const WebKit::WebString& message) {
95 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient( 93 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
96 routing_id_, 94 routing_id_,
97 DevToolsClientMsg_DispatchOnInspectorFrontend(message.utf8())); 95 DevToolsClientMsg_DispatchOnInspectorFrontend(message.utf8()));
98 render_view_->Send(m); 96 render_view_->Send(m);
99 } 97 }
100 98
101 void DevToolsAgent::sendDebuggerOutput(const WebKit::WebString& data) { 99 void DevToolsAgent::sendDebuggerOutput(const WebKit::WebString& data) {
102 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient( 100 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
103 routing_id_, 101 routing_id_,
104 DevToolsClientMsg_DebuggerOutput(data.utf8())); 102 DevToolsClientMsg_DebuggerOutput(data.utf8()));
105 render_view_->Send(m); 103 render_view_->Send(m);
106 } 104 }
107 105
108 void DevToolsAgent::sendDispatchToAPU(const WebKit::WebString& data) {
109 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
110 routing_id_,
111 DevToolsClientMsg_DispatchToAPU(data.utf8()));
112 render_view_->Send(m);
113 }
114
115 int DevToolsAgent::hostIdentifier() { 106 int DevToolsAgent::hostIdentifier() {
116 return routing_id_; 107 return routing_id_;
117 } 108 }
118 109
119 void DevToolsAgent::runtimeFeatureStateChanged( 110 void DevToolsAgent::runtimeFeatureStateChanged(
120 const WebKit::WebString& feature, 111 const WebKit::WebString& feature,
121 bool enabled) { 112 bool enabled) {
122 render_view_->Send(new ViewHostMsg_DevToolsRuntimePropertyChanged( 113 render_view_->Send(new ViewHostMsg_DevToolsRuntimePropertyChanged(
123 routing_id_, 114 routing_id_,
124 feature.utf8(), 115 feature.utf8(),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 184 }
194 185
195 void DevToolsAgent::OnInspectElement(int x, int y) { 186 void DevToolsAgent::OnInspectElement(int x, int y) {
196 WebDevToolsAgent* web_agent = GetWebAgent(); 187 WebDevToolsAgent* web_agent = GetWebAgent();
197 if (web_agent) { 188 if (web_agent) {
198 web_agent->attach(); 189 web_agent->attach();
199 web_agent->inspectElementAt(WebPoint(x, y)); 190 web_agent->inspectElementAt(WebPoint(x, y));
200 } 191 }
201 } 192 }
202 193
203 void DevToolsAgent::OnSetApuAgentEnabled(bool enabled) {
204 WebDevToolsAgent* web_agent = GetWebAgent();
205 if (web_agent)
206 web_agent->setRuntimeProperty("apu-agent", enabled ?
207 WebString::fromUTF8("true") : WebString::fromUTF8("false"));
208 }
209
210 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { 194 WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
211 WebView* web_view = render_view_->webview(); 195 WebView* web_view = render_view_->webview();
212 if (!web_view) 196 if (!web_view)
213 return NULL; 197 return NULL;
214 return web_view->devToolsAgent(); 198 return web_view->devToolsAgent();
215 } 199 }
OLDNEW
« no previous file with comments | « chrome/renderer/devtools_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698