OLD | NEW |
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 // DevToolsAgent belongs to the inspectable renderer and provides Glue's | 5 // DevToolsAgent belongs to the inspectable renderer and provides Glue's |
6 // agents with the communication capabilities. All messages from/to Glue's | 6 // agents with the communication capabilities. All messages from/to Glue's |
7 // agents infrastructure are flowing through this comminucation agent. | 7 // agents infrastructure are flowing through this comminucation agent. |
8 // | 8 // |
9 // DevToolsAgent is registered as an IPC filter in order to be able to | 9 // DevToolsAgent is registered as an IPC filter in order to be able to |
10 // dispatch messages while on the IO thread. The reason for that is that while | 10 // dispatch messages while on the IO thread. The reason for that is that while |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void DevToolsAgent::SendMessageToClient(const std::string& raw_msg) { | 170 void DevToolsAgent::SendMessageToClient(const std::string& raw_msg) { |
171 Send(DevToolsClientMsg_RpcMessage(raw_msg)); | 171 Send(DevToolsClientMsg_RpcMessage(raw_msg)); |
172 } | 172 } |
173 | 173 |
174 void DevToolsAgent::OnRpcMessage(const std::string& raw_msg) { | 174 void DevToolsAgent::OnRpcMessage(const std::string& raw_msg) { |
175 view_loop_->PostTask(FROM_HERE, NewRunnableMethod( | 175 view_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
176 this, &DevToolsAgent::DispatchRpcMessage, raw_msg)); | 176 this, &DevToolsAgent::DispatchRpcMessage, raw_msg)); |
177 } | 177 } |
178 | 178 |
179 void DevToolsAgent::OnInspectElement(int x, int y) { | 179 void DevToolsAgent::OnInspectElement(int x, int y) { |
180 WebDevToolsAgent* web_agent = view_->webview()->GetWebDevToolsAgent(); | 180 view_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
181 web_agent->InspectElement(x, y); | 181 this, &DevToolsAgent::InspectElement, x, y)); |
182 } | 182 } |
183 | 183 |
184 void DevToolsAgent::DispatchRpcMessage(const std::string& raw_msg) { | 184 void DevToolsAgent::DispatchRpcMessage(const std::string& raw_msg) { |
185 WebDevToolsAgent* web_agent = view_->webview()->GetWebDevToolsAgent(); | 185 if (!view_) |
| 186 return; |
| 187 WebView* web_view = view_->webview(); |
| 188 if (!web_view) |
| 189 return; |
| 190 WebDevToolsAgent* web_agent = web_view->GetWebDevToolsAgent(); |
186 web_agent->DispatchMessageFromClient(raw_msg); | 191 web_agent->DispatchMessageFromClient(raw_msg); |
187 } | 192 } |
| 193 |
| 194 void DevToolsAgent::InspectElement(int x, int y) { |
| 195 if (!view_) |
| 196 return; |
| 197 WebView* web_view = view_->webview(); |
| 198 if (!web_view) |
| 199 return; |
| 200 WebDevToolsAgent* web_agent = web_view->GetWebDevToolsAgent(); |
| 201 web_agent->InspectElement(x, y); |
| 202 } |
OLD | NEW |