| 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/browser/devtools/devtools_agent_host_impl.h" | 5 #include "content/browser/devtools/devtools_agent_host_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 InnerDetachClient(); | 267 InnerDetachClient(); |
| 268 client->AgentHostClosed(this, replaced); | 268 client->AgentHostClosed(this, replaced); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void DevToolsAgentHostImpl::InspectElement( | 271 void DevToolsAgentHostImpl::InspectElement( |
| 272 DevToolsSession* session, | 272 DevToolsSession* session, |
| 273 int x, | 273 int x, |
| 274 int y) { | 274 int y) { |
| 275 } | 275 } |
| 276 | 276 |
| 277 void DevToolsAgentHostImpl::SendMessageToClient(int session_id, | |
| 278 const std::string& message) { | |
| 279 // Filter any messages from previous sessions. | |
| 280 if (!session_ || session_id != session_->session_id()) | |
| 281 return; | |
| 282 session_->client()->DispatchProtocolMessage(this, message); | |
| 283 } | |
| 284 | |
| 285 // static | 277 // static |
| 286 void DevToolsAgentHost::DetachAllClients() { | 278 void DevToolsAgentHost::DetachAllClients() { |
| 287 if (g_instances == NULL) | 279 if (g_instances == NULL) |
| 288 return; | 280 return; |
| 289 | 281 |
| 290 // Make a copy, since detaching may lead to agent destruction, which | 282 // Make a copy, since detaching may lead to agent destruction, which |
| 291 // removes it from the instances. | 283 // removes it from the instances. |
| 292 Instances copy = g_instances.Get(); | 284 Instances copy = g_instances.Get(); |
| 293 for (Instances::iterator it(copy.begin()); it != copy.end(); ++it) { | 285 for (Instances::iterator it(copy.begin()); it != copy.end(); ++it) { |
| 294 DevToolsAgentHostImpl* agent_host = it->second; | 286 DevToolsAgentHostImpl* agent_host = it->second; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (message_buffer_.size() != message_buffer_size_) | 396 if (message_buffer_.size() != message_buffer_size_) |
| 405 return false; | 397 return false; |
| 406 callback_.Run(chunk.session_id, message_buffer_); | 398 callback_.Run(chunk.session_id, message_buffer_); |
| 407 message_buffer_ = std::string(); | 399 message_buffer_ = std::string(); |
| 408 message_buffer_size_ = 0; | 400 message_buffer_size_ = 0; |
| 409 } | 401 } |
| 410 return true; | 402 return true; |
| 411 } | 403 } |
| 412 | 404 |
| 413 } // namespace content | 405 } // namespace content |
| OLD | NEW |