| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/protocol/tethering_handler.h" | 5 #include "content/browser/devtools/protocol/tethering_handler.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/ip_address.h" | 10 #include "net/base/ip_address.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 TetheringHandler::TetheringImpl::TetheringImpl( | 251 TetheringHandler::TetheringImpl::TetheringImpl( |
| 252 base::WeakPtr<TetheringHandler> handler, | 252 base::WeakPtr<TetheringHandler> handler, |
| 253 const CreateServerSocketCallback& socket_callback) | 253 const CreateServerSocketCallback& socket_callback) |
| 254 : handler_(handler), | 254 : handler_(handler), |
| 255 socket_callback_(socket_callback) { | 255 socket_callback_(socket_callback) { |
| 256 } | 256 } |
| 257 | 257 |
| 258 TetheringHandler::TetheringImpl::~TetheringImpl() { | 258 TetheringHandler::TetheringImpl::~TetheringImpl() { |
| 259 STLDeleteValues(&bound_sockets_); | 259 base::STLDeleteValues(&bound_sockets_); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void TetheringHandler::TetheringImpl::Bind(DevToolsCommandId command_id, | 262 void TetheringHandler::TetheringImpl::Bind(DevToolsCommandId command_id, |
| 263 uint16_t port) { | 263 uint16_t port) { |
| 264 if (bound_sockets_.find(port) != bound_sockets_.end()) { | 264 if (bound_sockets_.find(port) != bound_sockets_.end()) { |
| 265 SendInternalError(command_id, "Port already bound"); | 265 SendInternalError(command_id, "Port already bound"); |
| 266 return; | 266 return; |
| 267 } | 267 } |
| 268 | 268 |
| 269 BoundSocket::AcceptedCallback callback = base::Bind( | 269 BoundSocket::AcceptedCallback callback = base::Bind( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 391 } |
| 392 | 392 |
| 393 void TetheringHandler::SendInternalError(DevToolsCommandId command_id, | 393 void TetheringHandler::SendInternalError(DevToolsCommandId command_id, |
| 394 const std::string& message) { | 394 const std::string& message) { |
| 395 client_->SendError(command_id, Response::InternalError(message)); | 395 client_->SendError(command_id, Response::InternalError(message)); |
| 396 } | 396 } |
| 397 | 397 |
| 398 } // namespace tethering | 398 } // namespace tethering |
| 399 } // namespace devtools | 399 } // namespace devtools |
| 400 } // namespace content | 400 } // namespace content |
| OLD | NEW |