| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "content/common/devtools_messages.h" | 16 #include "content/common/devtools_messages.h" |
| 17 #include "content/common/frame_messages.h" | 17 #include "content/common/frame_messages.h" |
| 18 #include "content/public/common/manifest.h" | 18 #include "content/public/common/manifest.h" |
| 19 #include "content/renderer/devtools/devtools_client.h" | 19 #include "content/renderer/devtools/devtools_client.h" |
| 20 #include "content/renderer/devtools/devtools_cpu_throttler.h" | 20 #include "content/renderer/devtools/devtools_cpu_throttler.h" |
| 21 #include "content/renderer/manifest/manifest_manager.h" | 21 #include "content/renderer/manifest/manifest_manager.h" |
| 22 #include "content/renderer/render_frame_impl.h" | 22 #include "content/renderer/render_frame_impl.h" |
| 23 #include "content/renderer/render_widget.h" | 23 #include "content/renderer/render_widget.h" |
| 24 #include "ipc/ipc_channel.h" | 24 #include "ipc/ipc_channel.h" |
| 25 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 25 #include "third_party/WebKit/public/platform/WebPoint.h" | 26 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 26 #include "third_party/WebKit/public/platform/WebString.h" | 27 #include "third_party/WebKit/public/platform/WebString.h" |
| 27 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" | 28 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" |
| 28 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 29 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 29 | 30 |
| 30 using blink::WebDevToolsAgent; | 31 using blink::WebDevToolsAgent; |
| 31 using blink::WebDevToolsAgentClient; | 32 using blink::WebDevToolsAgentClient; |
| 32 using blink::WebLocalFrame; | 33 using blink::WebLocalFrame; |
| 33 using blink::WebPoint; | 34 using blink::WebPoint; |
| 34 using blink::WebString; | 35 using blink::WebString; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 weak_factory_.GetWeakPtr(), session_id, call_id)); | 256 weak_factory_.GetWeakPtr(), session_id, call_id)); |
| 256 return; | 257 return; |
| 257 } | 258 } |
| 258 GetWebAgent()->dispatchOnInspectorBackend(session_id, | 259 GetWebAgent()->dispatchOnInspectorBackend(session_id, |
| 259 call_id, | 260 call_id, |
| 260 WebString::fromUTF8(method), | 261 WebString::fromUTF8(method), |
| 261 WebString::fromUTF8(message)); | 262 WebString::fromUTF8(message)); |
| 262 } | 263 } |
| 263 | 264 |
| 264 void DevToolsAgent::OnInspectElement(int x, int y) { | 265 void DevToolsAgent::OnInspectElement(int x, int y) { |
| 265 GetWebAgent()->inspectElementAt(WebPoint(x, y)); | 266 blink::WebFloatRect point_rect(x, y, 0, 0); |
| 267 frame_->GetRenderWidget()->convertWindowToViewport(&point_rect); |
| 268 GetWebAgent()->inspectElementAt(WebPoint(point_rect.x, point_rect.y)); |
| 266 } | 269 } |
| 267 | 270 |
| 268 void DevToolsAgent::OnRequestNewWindowACK(bool success) { | 271 void DevToolsAgent::OnRequestNewWindowACK(bool success) { |
| 269 if (!success) | 272 if (!success) |
| 270 GetWebAgent()->failedToRequestDevTools(); | 273 GetWebAgent()->failedToRequestDevTools(); |
| 271 } | 274 } |
| 272 | 275 |
| 273 void DevToolsAgent::ContinueProgram() { | 276 void DevToolsAgent::ContinueProgram() { |
| 274 GetWebAgent()->continueProgram(); | 277 GetWebAgent()->continueProgram(); |
| 275 } | 278 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 result->Set("errors", errors.release()); | 326 result->Set("errors", errors.release()); |
| 324 response->Set("result", result.release()); | 327 response->Set("result", result.release()); |
| 325 | 328 |
| 326 std::string json_message; | 329 std::string json_message; |
| 327 base::JSONWriter::Write(*response, &json_message); | 330 base::JSONWriter::Write(*response, &json_message); |
| 328 SendChunkedProtocolMessage(this, routing_id(), session_id, call_id, | 331 SendChunkedProtocolMessage(this, routing_id(), session_id, call_id, |
| 329 json_message, std::string()); | 332 json_message, std::string()); |
| 330 } | 333 } |
| 331 | 334 |
| 332 } // namespace content | 335 } // namespace content |
| OLD | NEW |