OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/devtools/adb/android_usb_socket.h" | 5 #include "chrome/browser/devtools/adb/android_usb_socket.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return net::ERR_SOCKET_NOT_CONNECTED; | 130 return net::ERR_SOCKET_NOT_CONNECTED; |
131 | 131 |
132 if (length > kMaxPayload) | 132 if (length > kMaxPayload) |
133 length = kMaxPayload; | 133 length = kMaxPayload; |
134 write_requests_.push_back(IORequest(NULL, length, callback)); | 134 write_requests_.push_back(IORequest(NULL, length, callback)); |
135 device_->Send(AdbMessage::kCommandWRTE, local_id_, remote_id_, | 135 device_->Send(AdbMessage::kCommandWRTE, local_id_, remote_id_, |
136 std::string(buffer->data(), length)); | 136 std::string(buffer->data(), length)); |
137 return net::ERR_IO_PENDING; | 137 return net::ERR_IO_PENDING; |
138 } | 138 } |
139 | 139 |
140 bool AndroidUsbSocket::SetReceiveBufferSize(int32 size) { | 140 int AndroidUsbSocket::SetReceiveBufferSize(int32 size) { |
141 NOTIMPLEMENTED(); | 141 NOTIMPLEMENTED(); |
142 return false; | 142 return net::ERR_NOT_IMPLEMENTED; |
143 } | 143 } |
144 | 144 |
145 bool AndroidUsbSocket::SetSendBufferSize(int32 size) { | 145 int AndroidUsbSocket::SetSendBufferSize(int32 size) { |
146 NOTIMPLEMENTED(); | 146 NOTIMPLEMENTED(); |
147 return false; | 147 return net::ERR_NOT_IMPLEMENTED; |
148 } | 148 } |
149 | 149 |
150 int AndroidUsbSocket::Connect(const net::CompletionCallback& callback) { | 150 int AndroidUsbSocket::Connect(const net::CompletionCallback& callback) { |
151 DCHECK(CalledOnValidThread()); | 151 DCHECK(CalledOnValidThread()); |
152 if (device_->terminated()) | 152 if (device_->terminated()) |
153 return net::ERR_FAILED; | 153 return net::ERR_FAILED; |
154 connect_callback_ = callback; | 154 connect_callback_ = callback; |
155 device_->Send(AdbMessage::kCommandOPEN, local_id_, 0, command_); | 155 device_->Send(AdbMessage::kCommandOPEN, local_id_, 0, command_); |
156 return net::ERR_IO_PENDING; | 156 return net::ERR_IO_PENDING; |
157 } | 157 } |
(...skipping 15 matching lines...) Expand all Loading... |
173 } | 173 } |
174 | 174 |
175 int AndroidUsbSocket::GetPeerAddress(net::IPEndPoint* address) const { | 175 int AndroidUsbSocket::GetPeerAddress(net::IPEndPoint* address) const { |
176 net::IPAddressNumber ip(net::kIPv4AddressSize); | 176 net::IPAddressNumber ip(net::kIPv4AddressSize); |
177 *address = net::IPEndPoint(ip, 0); | 177 *address = net::IPEndPoint(ip, 0); |
178 return net::OK; | 178 return net::OK; |
179 } | 179 } |
180 | 180 |
181 int AndroidUsbSocket::GetLocalAddress(net::IPEndPoint* address) const { | 181 int AndroidUsbSocket::GetLocalAddress(net::IPEndPoint* address) const { |
182 NOTIMPLEMENTED(); | 182 NOTIMPLEMENTED(); |
183 return net::ERR_FAILED; | 183 return net::ERR_NOT_IMPLEMENTED; |
184 } | 184 } |
185 | 185 |
186 const net::BoundNetLog& AndroidUsbSocket::NetLog() const { | 186 const net::BoundNetLog& AndroidUsbSocket::NetLog() const { |
187 return net_log_; | 187 return net_log_; |
188 } | 188 } |
189 | 189 |
190 void AndroidUsbSocket::SetSubresourceSpeculation() { | 190 void AndroidUsbSocket::SetSubresourceSpeculation() { |
191 NOTIMPLEMENTED(); | 191 NOTIMPLEMENTED(); |
192 } | 192 } |
193 | 193 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 void AndroidUsbSocket::RespondToWriters() { | 240 void AndroidUsbSocket::RespondToWriters() { |
241 if (!write_requests_.empty()) { | 241 if (!write_requests_.empty()) { |
242 IORequest write_request = write_requests_.front(); | 242 IORequest write_request = write_requests_.front(); |
243 write_requests_.pop_front(); | 243 write_requests_.pop_front(); |
244 write_request.callback.Run(write_request.length); | 244 write_request.callback.Run(write_request.length); |
245 } | 245 } |
246 } | 246 } |
OLD | NEW |