| 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/guid.h" | 10 #include "base/guid.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 void DevToolsAgentHostImpl::InnerDetach() { | 147 void DevToolsAgentHostImpl::InnerDetach() { |
| 148 Detach(); | 148 Detach(); |
| 149 io_context_.DiscardAllStreams(); | 149 io_context_.DiscardAllStreams(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool DevToolsAgentHostImpl::IsAttached() { | 152 bool DevToolsAgentHostImpl::IsAttached() { |
| 153 return !!client_; | 153 return !!client_; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void DevToolsAgentHostImpl::InspectElement(int x, int y) { | 156 void DevToolsAgentHostImpl::InspectElement( |
| 157 DevToolsAgentHostClient* client, |
| 158 int x, |
| 159 int y) { |
| 160 if (!client_ || client_ != client) |
| 161 return; |
| 162 InspectElement(x, y); |
| 157 } | 163 } |
| 158 | 164 |
| 159 std::string DevToolsAgentHostImpl::GetId() { | 165 std::string DevToolsAgentHostImpl::GetId() { |
| 160 return id_; | 166 return id_; |
| 161 } | 167 } |
| 162 | 168 |
| 163 BrowserContext* DevToolsAgentHostImpl::GetBrowserContext() { | 169 BrowserContext* DevToolsAgentHostImpl::GetBrowserContext() { |
| 164 return nullptr; | 170 return nullptr; |
| 165 } | 171 } |
| 166 | 172 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 188 if (!client_) | 194 if (!client_) |
| 189 return; | 195 return; |
| 190 | 196 |
| 191 scoped_refptr<DevToolsAgentHostImpl> protect(this); | 197 scoped_refptr<DevToolsAgentHostImpl> protect(this); |
| 192 // Clear |client_| before notifying it. | 198 // Clear |client_| before notifying it. |
| 193 DevToolsAgentHostClient* client = client_; | 199 DevToolsAgentHostClient* client = client_; |
| 194 client_ = NULL; | 200 client_ = NULL; |
| 195 client->AgentHostClosed(this, false); | 201 client->AgentHostClosed(this, false); |
| 196 } | 202 } |
| 197 | 203 |
| 204 void DevToolsAgentHostImpl::InspectElement(int x, int y) { |
| 205 } |
| 206 |
| 198 void DevToolsAgentHostImpl::SendMessageToClient(int session_id, | 207 void DevToolsAgentHostImpl::SendMessageToClient(int session_id, |
| 199 const std::string& message) { | 208 const std::string& message) { |
| 200 if (!client_) | 209 if (!client_) |
| 201 return; | 210 return; |
| 202 // Filter any messages from previous sessions. | 211 // Filter any messages from previous sessions. |
| 203 if (session_id != session_id_) | 212 if (session_id != session_id_) |
| 204 return; | 213 return; |
| 205 client_->DispatchProtocolMessage(this, message); | 214 client_->DispatchProtocolMessage(this, message); |
| 206 } | 215 } |
| 207 | 216 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 312 |
| 304 if (chunk.is_last) { | 313 if (chunk.is_last) { |
| 305 CHECK(message_buffer_.size() == message_buffer_size_); | 314 CHECK(message_buffer_.size() == message_buffer_size_); |
| 306 callback_.Run(chunk.session_id, message_buffer_); | 315 callback_.Run(chunk.session_id, message_buffer_); |
| 307 message_buffer_ = std::string(); | 316 message_buffer_ = std::string(); |
| 308 message_buffer_size_ = 0; | 317 message_buffer_size_ = 0; |
| 309 } | 318 } |
| 310 } | 319 } |
| 311 | 320 |
| 312 } // namespace content | 321 } // namespace content |
| OLD | NEW |