| 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" |  | 
| 26 #include "third_party/WebKit/public/platform/WebPoint.h" | 25 #include "third_party/WebKit/public/platform/WebPoint.h" | 
| 27 #include "third_party/WebKit/public/platform/WebString.h" | 26 #include "third_party/WebKit/public/platform/WebString.h" | 
| 28 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" | 27 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" | 
| 29 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 28 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 
| 30 | 29 | 
| 31 using blink::WebDevToolsAgent; | 30 using blink::WebDevToolsAgent; | 
| 32 using blink::WebDevToolsAgentClient; | 31 using blink::WebDevToolsAgentClient; | 
| 33 using blink::WebLocalFrame; | 32 using blink::WebLocalFrame; | 
| 34 using blink::WebPoint; | 33 using blink::WebPoint; | 
| 35 using blink::WebString; | 34 using blink::WebString; | 
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 256         weak_factory_.GetWeakPtr(), session_id, call_id)); | 255         weak_factory_.GetWeakPtr(), session_id, call_id)); | 
| 257     return; | 256     return; | 
| 258   } | 257   } | 
| 259   GetWebAgent()->dispatchOnInspectorBackend(session_id, | 258   GetWebAgent()->dispatchOnInspectorBackend(session_id, | 
| 260                                             call_id, | 259                                             call_id, | 
| 261                                             WebString::fromUTF8(method), | 260                                             WebString::fromUTF8(method), | 
| 262                                             WebString::fromUTF8(message)); | 261                                             WebString::fromUTF8(message)); | 
| 263 } | 262 } | 
| 264 | 263 | 
| 265 void DevToolsAgent::OnInspectElement(int x, int y) { | 264 void DevToolsAgent::OnInspectElement(int x, int y) { | 
| 266   blink::WebFloatRect point_rect(x, y, 0, 0); | 265   GetWebAgent()->inspectElementAt(WebPoint(x, y)); | 
| 267   frame_->GetRenderWidget()->convertWindowToViewport(&point_rect); |  | 
| 268   GetWebAgent()->inspectElementAt(WebPoint(point_rect.x, point_rect.y)); |  | 
| 269 } | 266 } | 
| 270 | 267 | 
| 271 void DevToolsAgent::OnRequestNewWindowACK(bool success) { | 268 void DevToolsAgent::OnRequestNewWindowACK(bool success) { | 
| 272   if (!success) | 269   if (!success) | 
| 273     GetWebAgent()->failedToRequestDevTools(); | 270     GetWebAgent()->failedToRequestDevTools(); | 
| 274 } | 271 } | 
| 275 | 272 | 
| 276 void DevToolsAgent::ContinueProgram() { | 273 void DevToolsAgent::ContinueProgram() { | 
| 277   GetWebAgent()->continueProgram(); | 274   GetWebAgent()->continueProgram(); | 
| 278 } | 275 } | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 326   result->Set("errors", errors.release()); | 323   result->Set("errors", errors.release()); | 
| 327   response->Set("result", result.release()); | 324   response->Set("result", result.release()); | 
| 328 | 325 | 
| 329   std::string json_message; | 326   std::string json_message; | 
| 330   base::JSONWriter::Write(*response, &json_message); | 327   base::JSONWriter::Write(*response, &json_message); | 
| 331   SendChunkedProtocolMessage(this, routing_id(), session_id, call_id, | 328   SendChunkedProtocolMessage(this, routing_id(), session_id, call_id, | 
| 332                              json_message, std::string()); | 329                              json_message, std::string()); | 
| 333 } | 330 } | 
| 334 | 331 | 
| 335 }  // namespace content | 332 }  // namespace content | 
| OLD | NEW | 
|---|