| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_agent.h" | 5 #include "content/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 "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/process.h" | 11 #include "base/process.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "content/common/content_switches.h" | 13 #include "content/common/content_switches.h" |
| 14 #include "content/renderer/devtools_agent_filter.h" | 14 #include "content/renderer/devtools_agent_filter.h" |
| 15 #include "content/renderer/devtools_client.h" | 15 #include "content/renderer/devtools_client.h" |
| 16 #include "content/common/devtools_messages.h" | 16 #include "content/common/devtools_messages.h" |
| 17 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
| 18 #include "content/renderer/render_view.h" | 18 #include "content/renderer/render_view_impl.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 23 | 23 |
| 24 using WebKit::WebDevToolsAgent; | 24 using WebKit::WebDevToolsAgent; |
| 25 using WebKit::WebDevToolsAgentClient; | 25 using WebKit::WebDevToolsAgentClient; |
| 26 using WebKit::WebPoint; | 26 using WebKit::WebPoint; |
| 27 using WebKit::WebString; | 27 using WebKit::WebString; |
| 28 using WebKit::WebCString; | 28 using WebKit::WebCString; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 49 } | 49 } |
| 50 private: | 50 private: |
| 51 MessageLoop* message_loop_; | 51 MessageLoop* message_loop_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 // static | 56 // static |
| 57 std::map<int, DevToolsAgent*> DevToolsAgent::agent_for_routing_id_; | 57 std::map<int, DevToolsAgent*> DevToolsAgent::agent_for_routing_id_; |
| 58 | 58 |
| 59 DevToolsAgent::DevToolsAgent(RenderView* render_view) | 59 DevToolsAgent::DevToolsAgent(RenderViewImpl* render_view) |
| 60 : content::RenderViewObserver(render_view), | 60 : content::RenderViewObserver(render_view), |
| 61 is_attached_(false) { | 61 is_attached_(false) { |
| 62 agent_for_routing_id_[routing_id()] = this; | 62 agent_for_routing_id_[routing_id()] = this; |
| 63 | 63 |
| 64 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 64 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 65 expose_v8_debugger_protocol_ = cmd->HasSwitch(switches::kRemoteShellPort); | 65 expose_v8_debugger_protocol_ = cmd->HasSwitch(switches::kRemoteShellPort); |
| 66 | 66 |
| 67 render_view->webview()->setDevToolsAgentClient(this); | 67 render_view->webview()->setDevToolsAgentClient(this); |
| 68 render_view->webview()->devToolsAgent()->setProcessId( | 68 render_view->webview()->devToolsAgent()->setProcessId( |
| 69 base::Process::Current().pid()); | 69 base::Process::Current().pid()); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 void DevToolsAgent::OnNavigate() { | 191 void DevToolsAgent::OnNavigate() { |
| 192 WebDevToolsAgent* web_agent = GetWebAgent(); | 192 WebDevToolsAgent* web_agent = GetWebAgent(); |
| 193 if (web_agent) { | 193 if (web_agent) { |
| 194 web_agent->didNavigate(); | 194 web_agent->didNavigate(); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 void DevToolsAgent::OnSetupDevToolsClient() { | 198 void DevToolsAgent::OnSetupDevToolsClient() { |
| 199 new DevToolsClient(static_cast<RenderView*>(render_view())); | 199 new DevToolsClient(static_cast<RenderViewImpl*>(render_view())); |
| 200 } | 200 } |
| 201 | 201 |
| 202 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { | 202 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { |
| 203 WebView* web_view = render_view()->GetWebView(); | 203 WebView* web_view = render_view()->GetWebView(); |
| 204 if (!web_view) | 204 if (!web_view) |
| 205 return NULL; | 205 return NULL; |
| 206 return web_view->devToolsAgent(); | 206 return web_view->devToolsAgent(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool DevToolsAgent::IsAttached() { | 209 bool DevToolsAgent::IsAttached() { |
| 210 return is_attached_; | 210 return is_attached_; |
| 211 } | 211 } |
| OLD | NEW |