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

Side by Side Diff: net/socket_stream/socket_stream.h

Issue 10854063: Clean-up inline members of nested classes (net/) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a NET_EXPOR_PRIVATE Created 8 years, 4 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
« no previous file with comments | « net/socket/tcp_client_socket_libevent.cc ('k') | net/socket_stream/socket_stream.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 NET_SOCKET_STREAM_SOCKET_STREAM_H_ 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_
6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // SetUserData(key, data). 53 // SetUserData(key, data).
54 class UserData { 54 class UserData {
55 public: 55 public:
56 UserData() {} 56 UserData() {}
57 virtual ~UserData() {} 57 virtual ~UserData() {}
58 }; 58 };
59 59
60 class NET_EXPORT Delegate { 60 class NET_EXPORT Delegate {
61 public: 61 public:
62 virtual int OnStartOpenConnection(SocketStream* socket, 62 virtual int OnStartOpenConnection(SocketStream* socket,
63 const CompletionCallback& callback) { 63 const CompletionCallback& callback);
64 return OK;
65 }
66 64
67 // Called when socket stream has been connected. The socket stream accepts 65 // Called when socket stream has been connected. The socket stream accepts
68 // at most |max_pending_send_allowed| so that a client of the socket stream 66 // at most |max_pending_send_allowed| so that a client of the socket stream
69 // should keep track of how much it has pending and shouldn't go over 67 // should keep track of how much it has pending and shouldn't go over
70 // |max_pending_send_allowed| bytes. 68 // |max_pending_send_allowed| bytes.
71 virtual void OnConnected(SocketStream* socket, 69 virtual void OnConnected(SocketStream* socket,
72 int max_pending_send_allowed) = 0; 70 int max_pending_send_allowed) = 0;
73 71
74 // Called when |amount_sent| bytes of data are sent. 72 // Called when |amount_sent| bytes of data are sent.
75 virtual void OnSentData(SocketStream* socket, 73 virtual void OnSentData(SocketStream* socket,
76 int amount_sent) = 0; 74 int amount_sent) = 0;
77 75
78 // Called when |len| bytes of |data| are received. 76 // Called when |len| bytes of |data| are received.
79 virtual void OnReceivedData(SocketStream* socket, 77 virtual void OnReceivedData(SocketStream* socket,
80 const char* data, int len) = 0; 78 const char* data, int len) = 0;
81 79
82 // Called when the socket stream has been closed. 80 // Called when the socket stream has been closed.
83 virtual void OnClose(SocketStream* socket) = 0; 81 virtual void OnClose(SocketStream* socket) = 0;
84 82
85 // Called when proxy authentication required. 83 // Called when proxy authentication required.
86 // The delegate should call RestartWithAuth() if credential for |auth_info| 84 // The delegate should call RestartWithAuth() if credential for |auth_info|
87 // is found in password database, or call Close() to close the connection. 85 // is found in password database, or call Close() to close the connection.
88 virtual void OnAuthRequired(SocketStream* socket, 86 virtual void OnAuthRequired(SocketStream* socket,
89 AuthChallengeInfo* auth_info) { 87 AuthChallengeInfo* auth_info);
90 // By default, no credential is available and close the connection.
91 socket->Close();
92 }
93 88
94 // Called when using SSL and the server responds with a certificate with an 89 // Called when using SSL and the server responds with a certificate with an
95 // error. The delegate should call CancelBecauseOfCertError() or 90 // error. The delegate should call CancelBecauseOfCertError() or
96 // ContinueDespiteCertError() to resume connection handling. 91 // ContinueDespiteCertError() to resume connection handling.
97 virtual void OnSSLCertificateError(SocketStream* socket, 92 virtual void OnSSLCertificateError(SocketStream* socket,
98 const SSLInfo& ssl_info, 93 const SSLInfo& ssl_info,
99 bool fatal) { 94 bool fatal);
100 socket->CancelWithSSLError(ssl_info);
101 }
102 95
103 // Called when an error occured. 96 // Called when an error occured.
104 // This is only for error reporting to the delegate. 97 // This is only for error reporting to the delegate.
105 // |error| is net::Error. 98 // |error| is net::Error.
106 virtual void OnError(const SocketStream* socket, int error) {} 99 virtual void OnError(const SocketStream* socket, int error) {}
107 100
108 // Called when reading cookies to allow the delegate to block access to the 101 // Called when reading cookies to allow the delegate to block access to the
109 // cookie. 102 // cookie.
110 virtual bool CanGetCookies(SocketStream* socket, const GURL& url) { 103 virtual bool CanGetCookies(SocketStream* socket, const GURL& url);
111 return true;
112 }
113 104
114 // Called when a cookie is set to allow the delegate to block access to the 105 // Called when a cookie is set to allow the delegate to block access to the
115 // cookie. 106 // cookie.
116 virtual bool CanSetCookie(SocketStream* request, 107 virtual bool CanSetCookie(SocketStream* request,
117 const GURL& url, 108 const GURL& url,
118 const std::string& cookie_line, 109 const std::string& cookie_line,
119 CookieOptions* options) { 110 CookieOptions* options);
120 return true;
121 }
122 111
123 protected: 112 protected:
124 virtual ~Delegate() {} 113 virtual ~Delegate() {}
125 }; 114 };
126 115
127 SocketStream(const GURL& url, Delegate* delegate); 116 SocketStream(const GURL& url, Delegate* delegate);
128 117
129 // The user data allows the clients to associate data with this job. 118 // The user data allows the clients to associate data with this job.
130 // Multiple user data values can be stored under different keys. 119 // Multiple user data values can be stored under different keys.
131 // This job will TAKE OWNERSHIP of the given data pointer, and will 120 // This job will TAKE OWNERSHIP of the given data pointer, and will
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 public: 193 public:
205 RequestHeaders() : IOBuffer() {} 194 RequestHeaders() : IOBuffer() {}
206 195
207 void SetDataOffset(size_t offset) { 196 void SetDataOffset(size_t offset) {
208 data_ = const_cast<char*>(headers_.data()) + offset; 197 data_ = const_cast<char*>(headers_.data()) + offset;
209 } 198 }
210 199
211 std::string headers_; 200 std::string headers_;
212 201
213 private: 202 private:
214 virtual ~RequestHeaders() { data_ = NULL; } 203 virtual ~RequestHeaders();
215 }; 204 };
216 205
217 class ResponseHeaders : public IOBuffer { 206 class ResponseHeaders : public IOBuffer {
218 public: 207 public:
219 ResponseHeaders(); 208 ResponseHeaders();
220 209
221 void SetDataOffset(size_t offset) { data_ = headers_.get() + offset; } 210 void SetDataOffset(size_t offset) { data_ = headers_.get() + offset; }
222 char* headers() const { return headers_.get(); } 211 char* headers() const { return headers_.get(); }
223 void Reset() { headers_.reset(); } 212 void Reset() { headers_.reset(); }
224 void Realloc(size_t new_size); 213 void Realloc(size_t new_size);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 bool server_closed_; 376 bool server_closed_;
388 377
389 scoped_ptr<SocketStreamMetrics> metrics_; 378 scoped_ptr<SocketStreamMetrics> metrics_;
390 379
391 DISALLOW_COPY_AND_ASSIGN(SocketStream); 380 DISALLOW_COPY_AND_ASSIGN(SocketStream);
392 }; 381 };
393 382
394 } // namespace net 383 } // namespace net
395 384
396 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ 385 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_
OLDNEW
« no previous file with comments | « net/socket/tcp_client_socket_libevent.cc ('k') | net/socket_stream/socket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698