| 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_TCP_SOCKET_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SOCKET_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SOCKET_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SOCKET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "net/base/address_list.h" | 14 #include "net/base/address_list.h" |
| 15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 16 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
| 17 | 17 |
| 18 namespace ppapi { |
| 19 class PPB_X509Certificate_Fields; |
| 20 } |
| 21 |
| 18 class PepperMessageFilter; | 22 class PepperMessageFilter; |
| 19 struct PP_NetAddress_Private; | 23 struct PP_NetAddress_Private; |
| 20 | 24 |
| 21 namespace net { | 25 namespace net { |
| 22 class IOBuffer; | 26 class IOBuffer; |
| 23 class SingleRequestHostResolver; | 27 class SingleRequestHostResolver; |
| 24 class StreamSocket; | 28 class StreamSocket; |
| 29 class X509Certificate; |
| 25 } | 30 } |
| 26 | 31 |
| 27 // PepperTCPSocket is used by PepperMessageFilter to handle requests from | 32 // PepperTCPSocket is used by PepperMessageFilter to handle requests from |
| 28 // the Pepper TCP socket API (PPB_TCPSocket_Private). | 33 // the Pepper TCP socket API (PPB_TCPSocket_Private). |
| 29 class PepperTCPSocket { | 34 class PepperTCPSocket { |
| 30 public: | 35 public: |
| 31 PepperTCPSocket(PepperMessageFilter* manager, | 36 PepperTCPSocket(PepperMessageFilter* manager, |
| 32 int32 routing_id, | 37 int32 routing_id, |
| 33 uint32 plugin_dispatcher_id, | 38 uint32 plugin_dispatcher_id, |
| 34 uint32 socket_id); | 39 uint32 socket_id); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 int routing_id() { return routing_id_; } | 50 int routing_id() { return routing_id_; } |
| 46 | 51 |
| 47 void Connect(const std::string& host, uint16_t port); | 52 void Connect(const std::string& host, uint16_t port); |
| 48 void ConnectWithNetAddress(const PP_NetAddress_Private& net_addr); | 53 void ConnectWithNetAddress(const PP_NetAddress_Private& net_addr); |
| 49 void SSLHandshake(const std::string& server_name, uint16_t server_port); | 54 void SSLHandshake(const std::string& server_name, uint16_t server_port); |
| 50 void Read(int32 bytes_to_read); | 55 void Read(int32 bytes_to_read); |
| 51 void Write(const std::string& data); | 56 void Write(const std::string& data); |
| 52 | 57 |
| 53 void SendConnectACKError(); | 58 void SendConnectACKError(); |
| 54 | 59 |
| 60 static bool GetCertificateFields(const net::X509Certificate& cert, |
| 61 ppapi::PPB_X509Certificate_Fields* fields); |
| 62 static bool GetCertificateFields(const char* bytes, |
| 63 uint32_t length, |
| 64 ppapi::PPB_X509Certificate_Fields* fields); |
| 65 |
| 55 private: | 66 private: |
| 56 enum ConnectionState { | 67 enum ConnectionState { |
| 57 // Before a connection is successfully established (including a previous | 68 // Before a connection is successfully established (including a previous |
| 58 // connect request failed). | 69 // connect request failed). |
| 59 BEFORE_CONNECT, | 70 BEFORE_CONNECT, |
| 60 // There is a connect request that is pending. | 71 // There is a connect request that is pending. |
| 61 CONNECT_IN_PROGRESS, | 72 CONNECT_IN_PROGRESS, |
| 62 // A connection has been successfully established. | 73 // A connection has been successfully established. |
| 63 CONNECTED, | 74 CONNECTED, |
| 64 // There is an SSL handshake request that is pending. | 75 // There is an SSL handshake request that is pending. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 107 |
| 97 scoped_ptr<net::StreamSocket> socket_; | 108 scoped_ptr<net::StreamSocket> socket_; |
| 98 | 109 |
| 99 scoped_refptr<net::IOBuffer> read_buffer_; | 110 scoped_refptr<net::IOBuffer> read_buffer_; |
| 100 scoped_refptr<net::IOBuffer> write_buffer_; | 111 scoped_refptr<net::IOBuffer> write_buffer_; |
| 101 | 112 |
| 102 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocket); | 113 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocket); |
| 103 }; | 114 }; |
| 104 | 115 |
| 105 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SOCKET_H_ | 116 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SOCKET_H_ |
| OLD | NEW |