OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/devtools/devtools_agent.h" | 5 #include "content/renderer/devtools/devtools_agent.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) { | 212 void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) { |
213 TRACE_EVENT0("devtools", "DevToolsAgent::OnDispatchOnInspectorBackend"); | 213 TRACE_EVENT0("devtools", "DevToolsAgent::OnDispatchOnInspectorBackend"); |
214 WebDevToolsAgent* web_agent = GetWebAgent(); | 214 WebDevToolsAgent* web_agent = GetWebAgent(); |
215 if (web_agent) | 215 if (web_agent) |
216 web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message)); | 216 web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message)); |
217 } | 217 } |
218 | 218 |
219 void DevToolsAgent::OnInspectElement( | 219 void DevToolsAgent::OnInspectElement( |
220 const std::string& host_id, int x, int y) { | 220 const std::string& host_id, int x, int y) { |
221 WebDevToolsAgent* web_agent = GetWebAgent(); | 221 WebDevToolsAgent* web_agent = GetWebAgent(); |
222 if (web_agent) { | 222 if (web_agent) { |
dgozman
2015/11/13 19:21:57
Can you check that we are attached already?
kozy
2015/11/15 00:39:05
Done.
| |
223 web_agent->attach(WebString::fromUTF8(host_id)); | |
224 web_agent->inspectElementAt(WebPoint(x, y)); | 223 web_agent->inspectElementAt(WebPoint(x, y)); |
225 is_attached_ = true; | 224 is_attached_ = true; |
dgozman
2015/11/13 19:21:57
Remove this.
kozy
2015/11/15 00:39:05
Done.
| |
226 } | 225 } |
227 } | 226 } |
228 | 227 |
229 void DevToolsAgent::AddMessageToConsole(ConsoleMessageLevel level, | 228 void DevToolsAgent::AddMessageToConsole(ConsoleMessageLevel level, |
230 const std::string& message) { | 229 const std::string& message) { |
231 WebLocalFrame* web_frame = frame_->GetWebFrame(); | 230 WebLocalFrame* web_frame = frame_->GetWebFrame(); |
232 if (!web_frame) | 231 if (!web_frame) |
233 return; | 232 return; |
234 | 233 |
235 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog; | 234 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { | 269 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { |
271 WebLocalFrame* web_frame = frame_->GetWebFrame(); | 270 WebLocalFrame* web_frame = frame_->GetWebFrame(); |
272 return web_frame ? web_frame->devToolsAgent() : nullptr; | 271 return web_frame ? web_frame->devToolsAgent() : nullptr; |
273 } | 272 } |
274 | 273 |
275 bool DevToolsAgent::IsAttached() { | 274 bool DevToolsAgent::IsAttached() { |
276 return is_attached_; | 275 return is_attached_; |
277 } | 276 } |
278 | 277 |
279 } // namespace content | 278 } // namespace content |
OLD | NEW |