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 #ifndef CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/socket/tcp_client_socket.h" | 10 #include "net/socket/tcp_client_socket.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const std::string& socket_name, | 24 const std::string& socket_name, |
25 const std::string& request, | 25 const std::string& request, |
26 const CommandCallback& callback); | 26 const CommandCallback& callback); |
27 | 27 |
28 static void HttpQuery(int port, | 28 static void HttpQuery(int port, |
29 const std::string& serial, | 29 const std::string& serial, |
30 const std::string& socket_name, | 30 const std::string& socket_name, |
31 const std::string& request, | 31 const std::string& request, |
32 const SocketCallback& callback); | 32 const SocketCallback& callback); |
33 | 33 |
| 34 AdbClientSocket(const std::string& host, int port); |
| 35 ~AdbClientSocket(); |
| 36 |
| 37 protected: |
| 38 void Connect(const net::CompletionCallback& callback); |
| 39 |
| 40 void SendCommand(const std::string& command, |
| 41 bool is_void, |
| 42 const CommandCallback& callback); |
| 43 |
| 44 scoped_ptr<net::TCPClientSocket> socket_; |
| 45 |
34 private: | 46 private: |
35 AdbClientSocket(); | 47 void ReadResponse(const CommandCallback& callback, bool is_void, int result); |
36 ~AdbClientSocket(); | 48 |
| 49 void OnResponseHeader(const CommandCallback& callback, |
| 50 bool is_void, |
| 51 scoped_refptr<net::IOBuffer> response_buffer, |
| 52 int result); |
| 53 |
| 54 void OnResponseData(const CommandCallback& callback, |
| 55 const std::string& response, |
| 56 scoped_refptr<net::IOBuffer> response_buffer, |
| 57 int bytes_left, |
| 58 int result); |
| 59 |
| 60 std::string host_; |
| 61 int port_; |
37 | 62 |
38 DISALLOW_COPY_AND_ASSIGN(AdbClientSocket); | 63 DISALLOW_COPY_AND_ASSIGN(AdbClientSocket); |
39 }; | 64 }; |
40 | 65 |
41 #endif // CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_ | 66 #endif // CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_ |
OLD | NEW |