Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Side by Side Diff: content/browser/renderer_host/pepper_tcp_socket.cc

Issue 9405038: Add PPAPI interface for secure sockets in flash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "content/browser/renderer_host/pepper_tcp_socket.h" 5 #include "content/browser/renderer_host/pepper_tcp_socket.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "content/browser/renderer_host/pepper_message_filter.h" 13 #include "content/browser/renderer_host/pepper_message_filter.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "net/base/cert_verifier.h" 15 #include "net/base/cert_verifier.h"
16 #include "net/base/host_port_pair.h" 16 #include "net/base/host_port_pair.h"
17 #include "net/base/host_resolver.h" 17 #include "net/base/host_resolver.h"
18 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
19 #include "net/base/ip_endpoint.h" 19 #include "net/base/ip_endpoint.h"
20 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
21 #include "net/base/single_request_host_resolver.h" 21 #include "net/base/single_request_host_resolver.h"
22 #include "net/base/x509_certificate.h"
22 #include "net/socket/client_socket_factory.h" 23 #include "net/socket/client_socket_factory.h"
23 #include "net/socket/client_socket_handle.h" 24 #include "net/socket/client_socket_handle.h"
24 #include "net/socket/ssl_client_socket.h" 25 #include "net/socket/ssl_client_socket.h"
25 #include "net/socket/tcp_client_socket.h" 26 #include "net/socket/tcp_client_socket.h"
26 #include "ppapi/proxy/ppapi_messages.h" 27 #include "ppapi/proxy/ppapi_messages.h"
28 #include "ppapi/shared_impl/private/ppb_flash_x509_certificate_shared.h"
27 #include "ppapi/shared_impl/private/net_address_private_impl.h" 29 #include "ppapi/shared_impl/private/net_address_private_impl.h"
28 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" 30 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h"
29 31
30 using content::BrowserThread; 32 using content::BrowserThread;
31 using ppapi::NetAddressPrivateImpl; 33 using ppapi::NetAddressPrivateImpl;
32 34
33 PepperTCPSocket::PepperTCPSocket( 35 PepperTCPSocket::PepperTCPSocket(
34 PepperMessageFilter* manager, 36 PepperMessageFilter* manager,
35 int32 routing_id, 37 int32 routing_id,
36 uint32 plugin_dispatcher_id, 38 uint32 plugin_dispatcher_id,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 OnConnectCompleted(result); 197 OnConnectCompleted(result);
196 } 198 }
197 199
198 void PepperTCPSocket::SendConnectACKError() { 200 void PepperTCPSocket::SendConnectACKError() {
199 manager_->Send(new PpapiMsg_PPBTCPSocket_ConnectACK( 201 manager_->Send(new PpapiMsg_PPBTCPSocket_ConnectACK(
200 routing_id_, plugin_dispatcher_id_, socket_id_, false, 202 routing_id_, plugin_dispatcher_id_, socket_id_, false,
201 NetAddressPrivateImpl::kInvalidNetAddress, 203 NetAddressPrivateImpl::kInvalidNetAddress,
202 NetAddressPrivateImpl::kInvalidNetAddress)); 204 NetAddressPrivateImpl::kInvalidNetAddress));
203 } 205 }
204 206
207 // static
208 bool PepperTCPSocket::GetCertificateFields(
209 const net::X509Certificate& cert,
210 ppapi::PPB_X509Certificate_Fields* fields) {
211 // TODO(raymes,rsleevi): Implement this.
212 return true;
213 }
214
215 // static
216 bool PepperTCPSocket::GetCertificateFields(
217 const char* bytes,
218 uint32_t length,
219 ppapi::PPB_X509Certificate_Fields* fields) {
220 scoped_refptr<net::X509Certificate> cert =
221 net::X509Certificate::CreateFromBytes(bytes, length);
222 if (!cert.get())
223 return false;
224 return GetCertificateFields(*cert, fields);
225 }
226
205 void PepperTCPSocket::SendReadACKError() { 227 void PepperTCPSocket::SendReadACKError() {
206 manager_->Send(new PpapiMsg_PPBTCPSocket_ReadACK( 228 manager_->Send(new PpapiMsg_PPBTCPSocket_ReadACK(
207 routing_id_, plugin_dispatcher_id_, socket_id_, false, std::string())); 229 routing_id_, plugin_dispatcher_id_, socket_id_, false, std::string()));
208 } 230 }
209 231
210 void PepperTCPSocket::SendWriteACKError() { 232 void PepperTCPSocket::SendWriteACKError() {
211 manager_->Send(new PpapiMsg_PPBTCPSocket_WriteACK( 233 manager_->Send(new PpapiMsg_PPBTCPSocket_WriteACK(
212 routing_id_, plugin_dispatcher_id_, socket_id_, false, 0)); 234 routing_id_, plugin_dispatcher_id_, socket_id_, false, 0));
213 } 235 }
214 236
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 routing_id_, plugin_dispatcher_id_, socket_id_, true, result)); 315 routing_id_, plugin_dispatcher_id_, socket_id_, true, result));
294 } else { 316 } else {
295 SendWriteACKError(); 317 SendWriteACKError();
296 } 318 }
297 write_buffer_ = NULL; 319 write_buffer_ = NULL;
298 } 320 }
299 321
300 bool PepperTCPSocket::IsConnected() const { 322 bool PepperTCPSocket::IsConnected() const {
301 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED; 323 return connection_state_ == CONNECTED || connection_state_ == SSL_CONNECTED;
302 } 324 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper_tcp_socket.h ('k') | content/renderer/pepper/pepper_plugin_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698