OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_H_ | 5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_H_ |
6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_H_ | 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/debugger/devtools_remote_message.h" | 11 #include "chrome/browser/debugger/devtools_remote_message.h" |
12 #include "net/base/listen_socket.h" | 12 #include "net/base/listen_socket.h" |
13 | 13 |
14 class DevToolsRemoteListener; | 14 class DevToolsRemoteListener; |
15 | 15 |
16 // Listens to remote debugger incoming connections, handles the V8ARDP protocol | 16 // Listens to remote debugger incoming connections, handles the V8ARDP protocol |
17 // socket input and invokes the message handler when appropriate. | 17 // socket input and invokes the message handler when appropriate. |
18 class DevToolsRemoteListenSocket : public ListenSocket, | 18 class DevToolsRemoteListenSocket : public ListenSocket, |
19 public ListenSocket::ListenSocketDelegate { | 19 public ListenSocket::ListenSocketDelegate { |
20 public: | 20 public: |
21 // Listen on port for the specified IP address. Use 127.0.0.1 to only | 21 // Listen on port for the specified IP address. Use 127.0.0.1 to only |
22 // accept local connections. | 22 // accept local connections. |
23 static DevToolsRemoteListenSocket* Listen( | 23 static DevToolsRemoteListenSocket* Listen( |
24 const std::string& ip, | 24 const std::string& ip, |
25 int port, | 25 int port, |
26 DevToolsRemoteListener* message_listener); | 26 DevToolsRemoteListener* message_listener); |
27 | 27 |
28 protected: | 28 protected: |
29 virtual void Listen() { ListenSocket::Listen(); } | 29 virtual void Listen(); |
30 virtual void Accept(); | 30 virtual void Accept(); |
31 virtual void Close(); | 31 virtual void Close(); |
32 virtual void SendInternal(const char* bytes, int len); | 32 virtual void SendInternal(const char* bytes, int len); |
33 | 33 |
34 private: | 34 private: |
35 virtual ~DevToolsRemoteListenSocket(); | 35 virtual ~DevToolsRemoteListenSocket(); |
36 | 36 |
37 // ListenSocket::ListenSocketDelegate interface | 37 // ListenSocket::ListenSocketDelegate interface |
38 virtual void DidAccept(ListenSocket *server, ListenSocket *connection); | 38 virtual void DidAccept(ListenSocket *server, ListenSocket *connection); |
39 virtual void DidRead(ListenSocket *connection, const char* data, int len); | 39 virtual void DidRead(ListenSocket *connection, const char* data, int len); |
(...skipping 20 matching lines...) Expand all Loading... |
60 std::string protocol_field_; | 60 std::string protocol_field_; |
61 std::string payload_; | 61 std::string payload_; |
62 int32 remaining_payload_length_; | 62 int32 remaining_payload_length_; |
63 DevToolsRemoteListener* message_listener_; | 63 DevToolsRemoteListener* message_listener_; |
64 bool cr_received_; | 64 bool cr_received_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteListenSocket); | 66 DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteListenSocket); |
67 }; | 67 }; |
68 | 68 |
69 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_H_ | 69 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_H_ |
OLD | NEW |