OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "ppapi/c/dev/ppb_tcp_socket_dev.h" | 13 #include "ppapi/c/ppb_tcp_socket.h" |
14 #include "ppapi/c/private/ppb_net_address_private.h" | 14 #include "ppapi/c/private/ppb_net_address_private.h" |
15 #include "ppapi/shared_impl/resource.h" | 15 #include "ppapi/shared_impl/resource.h" |
16 #include "ppapi/shared_impl/tracked_callback.h" | 16 #include "ppapi/shared_impl/tracked_callback.h" |
17 | 17 |
18 namespace ppapi { | 18 namespace ppapi { |
19 | 19 |
20 class PPB_X509Certificate_Fields; | 20 class PPB_X509Certificate_Fields; |
21 class PPB_X509Certificate_Private_Shared; | 21 class PPB_X509Certificate_Private_Shared; |
22 class SocketOptionData; | 22 class SocketOptionData; |
23 | 23 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 virtual void SendConnect(const std::string& host, uint16_t port) = 0; | 59 virtual void SendConnect(const std::string& host, uint16_t port) = 0; |
60 virtual void SendConnectWithNetAddress(const PP_NetAddress_Private& addr) = 0; | 60 virtual void SendConnectWithNetAddress(const PP_NetAddress_Private& addr) = 0; |
61 virtual void SendSSLHandshake( | 61 virtual void SendSSLHandshake( |
62 const std::string& server_name, | 62 const std::string& server_name, |
63 uint16_t server_port, | 63 uint16_t server_port, |
64 const std::vector<std::vector<char> >& trusted_certs, | 64 const std::vector<std::vector<char> >& trusted_certs, |
65 const std::vector<std::vector<char> >& untrusted_certs) = 0; | 65 const std::vector<std::vector<char> >& untrusted_certs) = 0; |
66 virtual void SendRead(int32_t bytes_to_read) = 0; | 66 virtual void SendRead(int32_t bytes_to_read) = 0; |
67 virtual void SendWrite(const std::string& buffer) = 0; | 67 virtual void SendWrite(const std::string& buffer) = 0; |
68 virtual void SendDisconnect() = 0; | 68 virtual void SendDisconnect() = 0; |
69 virtual void SendSetOption(PP_TCPSocket_Option_Dev name, | 69 virtual void SendSetOption(PP_TCPSocket_Option name, |
70 const SocketOptionData& value) = 0; | 70 const SocketOptionData& value) = 0; |
71 | 71 |
72 virtual Resource* GetOwnerResource() = 0; | 72 virtual Resource* GetOwnerResource() = 0; |
73 | 73 |
74 // Used to override PP_Error codes received from the browser side. | 74 // Used to override PP_Error codes received from the browser side. |
75 virtual int32_t OverridePPError(int32_t pp_error); | 75 virtual int32_t OverridePPError(int32_t pp_error); |
76 | 76 |
77 protected: | 77 protected: |
78 enum ConnectionState { | 78 enum ConnectionState { |
79 // Before a connection is successfully established (including a connect | 79 // Before a connection is successfully established (including a connect |
(...skipping 24 matching lines...) Expand all Loading... |
104 PP_Resource GetServerCertificateImpl(); | 104 PP_Resource GetServerCertificateImpl(); |
105 PP_Bool AddChainBuildingCertificateImpl(PP_Resource certificate, | 105 PP_Bool AddChainBuildingCertificateImpl(PP_Resource certificate, |
106 PP_Bool trusted); | 106 PP_Bool trusted); |
107 int32_t ReadImpl(char* buffer, | 107 int32_t ReadImpl(char* buffer, |
108 int32_t bytes_to_read, | 108 int32_t bytes_to_read, |
109 scoped_refptr<TrackedCallback> callback); | 109 scoped_refptr<TrackedCallback> callback); |
110 int32_t WriteImpl(const char* buffer, | 110 int32_t WriteImpl(const char* buffer, |
111 int32_t bytes_to_write, | 111 int32_t bytes_to_write, |
112 scoped_refptr<TrackedCallback> callback); | 112 scoped_refptr<TrackedCallback> callback); |
113 void DisconnectImpl(); | 113 void DisconnectImpl(); |
114 int32_t SetOptionImpl(PP_TCPSocket_Option_Dev name, | 114 int32_t SetOptionImpl(PP_TCPSocket_Option name, |
115 const PP_Var& value, | 115 const PP_Var& value, |
116 scoped_refptr<TrackedCallback> callback); | 116 scoped_refptr<TrackedCallback> callback); |
117 | 117 |
118 void Init(uint32 socket_id); | 118 void Init(uint32 socket_id); |
119 bool IsConnected() const; | 119 bool IsConnected() const; |
120 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback); | 120 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback); |
121 | 121 |
122 ResourceObjectType resource_type_; | 122 ResourceObjectType resource_type_; |
123 | 123 |
124 uint32 socket_id_; | 124 uint32 socket_id_; |
(...skipping 16 matching lines...) Expand all Loading... |
141 std::vector<std::vector<char> > trusted_certificates_; | 141 std::vector<std::vector<char> > trusted_certificates_; |
142 std::vector<std::vector<char> > untrusted_certificates_; | 142 std::vector<std::vector<char> > untrusted_certificates_; |
143 | 143 |
144 private: | 144 private: |
145 DISALLOW_COPY_AND_ASSIGN(TCPSocketShared); | 145 DISALLOW_COPY_AND_ASSIGN(TCPSocketShared); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace ppapi | 148 } // namespace ppapi |
149 | 149 |
150 #endif // PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ | 150 #endif // PPAPI_SHARED_IMPL_TCP_SOCKET_SHARED_H_ |
OLD | NEW |