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" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/log/net_log_source.h" |
12 #include "net/socket/server_socket.h" | 13 #include "net/socket/server_socket.h" |
13 #include "net/socket/stream_socket.h" | 14 #include "net/socket/stream_socket.h" |
14 #include "net/socket/tcp_server_socket.h" | 15 #include "net/socket/tcp_server_socket.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 namespace devtools { | 18 namespace devtools { |
18 namespace tethering { | 19 namespace tethering { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 }; | 155 }; |
155 | 156 |
156 class BoundSocket { | 157 class BoundSocket { |
157 public: | 158 public: |
158 typedef base::Callback<void(uint16_t, const std::string&)> AcceptedCallback; | 159 typedef base::Callback<void(uint16_t, const std::string&)> AcceptedCallback; |
159 | 160 |
160 BoundSocket(AcceptedCallback accepted_callback, | 161 BoundSocket(AcceptedCallback accepted_callback, |
161 const CreateServerSocketCallback& socket_callback) | 162 const CreateServerSocketCallback& socket_callback) |
162 : accepted_callback_(accepted_callback), | 163 : accepted_callback_(accepted_callback), |
163 socket_callback_(socket_callback), | 164 socket_callback_(socket_callback), |
164 socket_(new net::TCPServerSocket(NULL, net::NetLog::Source())), | 165 socket_(new net::TCPServerSocket(NULL, net::NetLogSource())), |
165 port_(0) { | 166 port_(0) { |
166 } | 167 } |
167 | 168 |
168 virtual ~BoundSocket() { | 169 virtual ~BoundSocket() { |
169 } | 170 } |
170 | 171 |
171 bool Listen(uint16_t port) { | 172 bool Listen(uint16_t port) { |
172 port_ = port; | 173 port_ = port; |
173 net::IPEndPoint end_point(net::IPAddress::IPv4Localhost(), port); | 174 net::IPEndPoint end_point(net::IPAddress::IPv4Localhost(), port); |
174 int result = socket_->Listen(end_point, kListenBacklog); | 175 int result = socket_->Listen(end_point, kListenBacklog); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 392 } |
392 | 393 |
393 void TetheringHandler::SendInternalError(DevToolsCommandId command_id, | 394 void TetheringHandler::SendInternalError(DevToolsCommandId command_id, |
394 const std::string& message) { | 395 const std::string& message) { |
395 client_->SendError(command_id, Response::InternalError(message)); | 396 client_->SendError(command_id, Response::InternalError(message)); |
396 } | 397 } |
397 | 398 |
398 } // namespace tethering | 399 } // namespace tethering |
399 } // namespace devtools | 400 } // namespace devtools |
400 } // namespace content | 401 } // namespace content |
OLD | NEW |