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

Side by Side Diff: chrome/browser/extensions/api/socket/socket.h

Issue 10580028: Experimental support for SSL in platform apps sockets. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/socket/socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 21 matching lines...) Expand all
32 RecvFromCompletionCallback; 32 RecvFromCompletionCallback;
33 33
34 // A Socket wraps a low-level socket and includes housekeeping information that 34 // A Socket wraps a low-level socket and includes housekeeping information that
35 // we need to manage it in the context of an extension. 35 // we need to manage it in the context of an extension.
36 class Socket : public APIResource { 36 class Socket : public APIResource {
37 public: 37 public:
38 virtual ~Socket(); 38 virtual ~Socket();
39 virtual void Connect(const std::string& address, 39 virtual void Connect(const std::string& address,
40 int port, 40 int port,
41 const CompletionCallback& callback) = 0; 41 const CompletionCallback& callback) = 0;
42 virtual void PerformSSLHandshake(const std::string& ssl_hostname,
43 int ssl_port,
44 const CompletionCallback& callback);
42 virtual void Disconnect() = 0; 45 virtual void Disconnect() = 0;
43 virtual int Bind(const std::string& address, int port) = 0; 46 virtual int Bind(const std::string& address, int port) = 0;
44 47
45 // The |callback| will be called with the number of bytes read into the 48 // The |callback| will be called with the number of bytes read into the
46 // buffer, or a negative number if an error occurred. 49 // buffer, or a negative number if an error occurred.
47 virtual void Read(int count, 50 virtual void Read(int count,
48 const ReadCompletionCallback& callback) = 0; 51 const ReadCompletionCallback& callback) = 0;
49 52
50 // The |callback| will be called with |byte_count| or a negative number if an 53 // The |callback| will be called with |byte_count| or a negative number if an
51 // error occurred. 54 // error occurred.
(...skipping 18 matching lines...) Expand all
70 static bool StringAndPortToIPEndPoint(const std::string& ip_address_str, 73 static bool StringAndPortToIPEndPoint(const std::string& ip_address_str,
71 int port, 74 int port,
72 net::IPEndPoint* ip_end_point); 75 net::IPEndPoint* ip_end_point);
73 static void IPEndPointToStringAndPort(const net::IPEndPoint& address, 76 static void IPEndPointToStringAndPort(const net::IPEndPoint& address,
74 std::string* ip_address_str, 77 std::string* ip_address_str,
75 int* port); 78 int* port);
76 79
77 protected: 80 protected:
78 explicit Socket(APIResourceEventNotifier* event_notifier); 81 explicit Socket(APIResourceEventNotifier* event_notifier);
79 82
83 bool write_queue_empty() const;
80 void WriteData(); 84 void WriteData();
81 virtual int WriteImpl(net::IOBuffer* io_buffer, 85 virtual int WriteImpl(net::IOBuffer* io_buffer,
82 int io_buffer_size, 86 int io_buffer_size,
83 const net::CompletionCallback& callback) = 0; 87 const net::CompletionCallback& callback) = 0;
84 virtual void OnWriteComplete(int result); 88 virtual void OnWriteComplete(int result);
85 89
86 const std::string address_; 90 const std::string address_;
87 int port_; 91 int port_;
88 bool is_connected_; 92 bool is_connected_;
89 93
(...skipping 12 matching lines...) Expand all
102 CompletionCallback callback; 106 CompletionCallback callback;
103 int bytes_written; 107 int bytes_written;
104 }; 108 };
105 std::queue<WriteRequest> write_queue_; 109 std::queue<WriteRequest> write_queue_;
106 scoped_refptr<net::IOBuffer> io_buffer_write_; 110 scoped_refptr<net::IOBuffer> io_buffer_write_;
107 }; 111 };
108 112
109 } // namespace extensions 113 } // namespace extensions
110 114
111 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ 115 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/socket/socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698