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

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

Issue 9379002: Move socket API restriction check to browser process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
(...skipping 16 matching lines...) Expand all
27 // PepperTCPSocket is used by PepperMessageFilter to handle requests from 27 // PepperTCPSocket is used by PepperMessageFilter to handle requests from
28 // the Pepper TCP socket API (PPB_TCPSocket_Private). 28 // the Pepper TCP socket API (PPB_TCPSocket_Private).
29 class PepperTCPSocket { 29 class PepperTCPSocket {
30 public: 30 public:
31 PepperTCPSocket(PepperMessageFilter* manager, 31 PepperTCPSocket(PepperMessageFilter* manager,
32 int32 routing_id, 32 int32 routing_id,
33 uint32 plugin_dispatcher_id, 33 uint32 plugin_dispatcher_id,
34 uint32 socket_id); 34 uint32 socket_id);
35 ~PepperTCPSocket(); 35 ~PepperTCPSocket();
36 36
37 int routing_id() { return routing_id_; }
38
37 void Connect(const std::string& host, uint16_t port); 39 void Connect(const std::string& host, uint16_t port);
38 void ConnectWithNetAddress(const PP_NetAddress_Private& net_addr); 40 void ConnectWithNetAddress(const PP_NetAddress_Private& net_addr);
39 void SSLHandshake(const std::string& server_name, uint16_t server_port); 41 void SSLHandshake(const std::string& server_name, uint16_t server_port);
40 void Read(int32 bytes_to_read); 42 void Read(int32 bytes_to_read);
41 void Write(const std::string& data); 43 void Write(const std::string& data);
42 44
45 void SendConnectACKError();
46
43 private: 47 private:
44 enum ConnectionState { 48 enum ConnectionState {
45 // Before a connection is successfully established (including a previous 49 // Before a connection is successfully established (including a previous
46 // connect request failed). 50 // connect request failed).
47 BEFORE_CONNECT, 51 BEFORE_CONNECT,
48 // There is a connect request that is pending. 52 // There is a connect request that is pending.
49 CONNECT_IN_PROGRESS, 53 CONNECT_IN_PROGRESS,
50 // A connection has been successfully established. 54 // A connection has been successfully established.
51 CONNECTED, 55 CONNECTED,
52 // There is an SSL handshake request that is pending. 56 // There is an SSL handshake request that is pending.
53 SSL_HANDSHAKE_IN_PROGRESS, 57 SSL_HANDSHAKE_IN_PROGRESS,
54 // An SSL connection has been successfully established. 58 // An SSL connection has been successfully established.
55 SSL_CONNECTED, 59 SSL_CONNECTED,
56 // An SSL handshake has failed. 60 // An SSL handshake has failed.
57 SSL_HANDSHAKE_FAILED 61 SSL_HANDSHAKE_FAILED
58 }; 62 };
59 63
60 void StartConnect(const net::AddressList& addresses); 64 void StartConnect(const net::AddressList& addresses);
61 65
62 void SendConnectACKError();
63 void SendReadACKError(); 66 void SendReadACKError();
64 void SendWriteACKError(); 67 void SendWriteACKError();
65 void SendSSLHandshakeACK(bool succeeded); 68 void SendSSLHandshakeACK(bool succeeded);
66 69
67 void OnResolveCompleted(int result); 70 void OnResolveCompleted(int result);
68 void OnConnectCompleted(int result); 71 void OnConnectCompleted(int result);
69 void OnSSLHandshakeCompleted(int result); 72 void OnSSLHandshakeCompleted(int result);
70 void OnReadCompleted(int result); 73 void OnReadCompleted(int result);
71 void OnWriteCompleted(int result); 74 void OnWriteCompleted(int result);
72 75
(...skipping 12 matching lines...) Expand all
85 88
86 scoped_ptr<net::StreamSocket> socket_; 89 scoped_ptr<net::StreamSocket> socket_;
87 90
88 scoped_refptr<net::IOBuffer> read_buffer_; 91 scoped_refptr<net::IOBuffer> read_buffer_;
89 scoped_refptr<net::IOBuffer> write_buffer_; 92 scoped_refptr<net::IOBuffer> write_buffer_;
90 93
91 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocket); 94 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocket);
92 }; 95 };
93 96
94 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SOCKET_H_ 97 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SOCKET_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper_message_filter.cc ('k') | content/browser/renderer_host/pepper_udp_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698