| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "net/base/address_list.h" | 13 #include "net/base/address_list.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
| 16 | 16 |
| 17 namespace ppapi { | 17 namespace ppapi { |
| 18 class PPB_X509Certificate_Fields; | 18 class PPB_X509Certificate_Fields; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class PepperMessageFilter; | 21 class PepperMessageFilter; |
| 22 struct PP_NetAddress_Private; | 22 struct PP_NetAddress_Private; |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 class DrainableIOBuffer; | 25 class DrainableIOBuffer; |
| 26 class HostResolver; |
| 26 class IOBuffer; | 27 class IOBuffer; |
| 27 class SingleRequestHostResolver; | 28 class SingleRequestHostResolver; |
| 28 class StreamSocket; | 29 class StreamSocket; |
| 29 class X509Certificate; | 30 class X509Certificate; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // PepperTCPSocket is used by PepperMessageFilter to handle requests from | 33 // PepperTCPSocket is used by PepperMessageFilter to handle requests from |
| 33 // the Pepper TCP socket API (PPB_TCPSocket_Private). | 34 // the Pepper TCP socket API (PPB_TCPSocket_Private). |
| 34 class PepperTCPSocket { | 35 class PepperTCPSocket { |
| 35 public: | 36 public: |
| 36 PepperTCPSocket(PepperMessageFilter* manager, | 37 PepperTCPSocket(PepperMessageFilter* manager, |
| 37 int32 routing_id, | 38 int32 routing_id, |
| 38 uint32 plugin_dispatcher_id, | 39 uint32 plugin_dispatcher_id, |
| 39 uint32 socket_id); | 40 uint32 socket_id); |
| 40 | 41 |
| 41 // Used for creation already connected sockets. Takes ownership of | 42 // Used for creation already connected sockets. Takes ownership of |
| 42 // |socket|. | 43 // |socket|. |
| 43 PepperTCPSocket(PepperMessageFilter* manager, | 44 PepperTCPSocket(PepperMessageFilter* manager, |
| 44 int32 routing_id, | 45 int32 routing_id, |
| 45 uint32 plugin_dispatcher_id, | 46 uint32 plugin_dispatcher_id, |
| 46 uint32 socket_id, | 47 uint32 socket_id, |
| 47 net::StreamSocket* socket); | 48 net::StreamSocket* socket); |
| 48 ~PepperTCPSocket(); | 49 ~PepperTCPSocket(); |
| 49 | 50 |
| 50 int routing_id() { return routing_id_; } | 51 int routing_id() { return routing_id_; } |
| 51 | 52 |
| 52 void Connect(const std::string& host, uint16_t port); | 53 void Connect(const std::string& host, uint16_t port, |
| 54 net::HostResolver* host_resolver); |
| 53 void ConnectWithNetAddress(const PP_NetAddress_Private& net_addr); | 55 void ConnectWithNetAddress(const PP_NetAddress_Private& net_addr); |
| 54 void SSLHandshake( | 56 void SSLHandshake( |
| 55 const std::string& server_name, | 57 const std::string& server_name, |
| 56 uint16_t server_port, | 58 uint16_t server_port, |
| 57 const std::vector<std::vector<char> >& trusted_certs, | 59 const std::vector<std::vector<char> >& trusted_certs, |
| 58 const std::vector<std::vector<char> >& untrusted_certs); | 60 const std::vector<std::vector<char> >& untrusted_certs); |
| 59 void Read(int32 bytes_to_read); | 61 void Read(int32 bytes_to_read); |
| 60 void Write(const std::string& data); | 62 void Write(const std::string& data); |
| 61 | 63 |
| 62 void SendConnectACKError(); | 64 void SendConnectACKError(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // rather have our |Write()| do so whenever possible. To do this, we may have | 127 // rather have our |Write()| do so whenever possible. To do this, we may have |
| 126 // to call the former multiple times for each of the latter. This entails | 128 // to call the former multiple times for each of the latter. This entails |
| 127 // using a |DrainableIOBuffer|, which requires an underlying base |IOBuffer|. | 129 // using a |DrainableIOBuffer|, which requires an underlying base |IOBuffer|. |
| 128 scoped_refptr<net::IOBuffer> write_buffer_base_; | 130 scoped_refptr<net::IOBuffer> write_buffer_base_; |
| 129 scoped_refptr<net::DrainableIOBuffer> write_buffer_; | 131 scoped_refptr<net::DrainableIOBuffer> write_buffer_; |
| 130 | 132 |
| 131 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocket); | 133 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocket); |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_H_ | 136 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_H_ |
| OLD | NEW |