OLD | NEW |
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 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "base/task.h" | 17 #include "base/task.h" |
18 #include "net/base/address_list.h" | 18 #include "net/base/address_list.h" |
19 #include "net/base/completion_callback.h" | 19 #include "net/base/completion_callback.h" |
20 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
21 #include "net/base/net_api.h" | 21 #include "net/base/net_export.h" |
22 #include "net/base/net_log.h" | 22 #include "net/base/net_log.h" |
23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
24 #include "net/base/ssl_config_service.h" | 24 #include "net/base/ssl_config_service.h" |
25 #include "net/http/http_auth.h" | 25 #include "net/http/http_auth.h" |
26 #include "net/http/http_auth_cache.h" | 26 #include "net/http/http_auth_cache.h" |
27 #include "net/http/http_auth_handler.h" | 27 #include "net/http/http_auth_handler.h" |
28 #include "net/proxy/proxy_service.h" | 28 #include "net/proxy/proxy_service.h" |
29 #include "net/socket/tcp_client_socket.h" | 29 #include "net/socket/tcp_client_socket.h" |
30 #include "net/url_request/url_request_context.h" | 30 #include "net/url_request/url_request_context.h" |
31 | 31 |
32 namespace net { | 32 namespace net { |
33 | 33 |
34 class AuthChallengeInfo; | 34 class AuthChallengeInfo; |
35 class ClientSocketFactory; | 35 class ClientSocketFactory; |
36 class CookieOptions; | 36 class CookieOptions; |
37 class HostResolver; | 37 class HostResolver; |
38 class HttpAuthHandlerFactory; | 38 class HttpAuthHandlerFactory; |
39 class SSLConfigService; | 39 class SSLConfigService; |
40 class SingleRequestHostResolver; | 40 class SingleRequestHostResolver; |
41 class SocketStreamMetrics; | 41 class SocketStreamMetrics; |
42 | 42 |
43 // SocketStream is used to implement Web Sockets. | 43 // SocketStream is used to implement Web Sockets. |
44 // It provides plain full-duplex stream with proxy and SSL support. | 44 // It provides plain full-duplex stream with proxy and SSL support. |
45 // For proxy authentication, only basic mechanisum is supported. It will try | 45 // For proxy authentication, only basic mechanisum is supported. It will try |
46 // authentication identity for proxy URL first. If server requires proxy | 46 // authentication identity for proxy URL first. If server requires proxy |
47 // authentication, it will try authentication identity for realm that server | 47 // authentication, it will try authentication identity for realm that server |
48 // requests. | 48 // requests. |
49 class NET_API SocketStream : public base::RefCountedThreadSafe<SocketStream> { | 49 class NET_EXPORT SocketStream |
| 50 : public base::RefCountedThreadSafe<SocketStream> { |
50 public: | 51 public: |
51 // Derive from this class and add your own data members to associate extra | 52 // Derive from this class and add your own data members to associate extra |
52 // information with a SocketStream. Use GetUserData(key) and | 53 // information with a SocketStream. Use GetUserData(key) and |
53 // SetUserData(key, data). | 54 // SetUserData(key, data). |
54 class UserData { | 55 class UserData { |
55 public: | 56 public: |
56 UserData() {} | 57 UserData() {} |
57 virtual ~UserData() {} | 58 virtual ~UserData() {} |
58 }; | 59 }; |
59 | 60 |
60 class NET_API Delegate { | 61 class NET_EXPORT Delegate { |
61 public: | 62 public: |
62 virtual ~Delegate() {} | 63 virtual ~Delegate() {} |
63 | 64 |
64 virtual int OnStartOpenConnection(SocketStream* socket, | 65 virtual int OnStartOpenConnection(SocketStream* socket, |
65 CompletionCallback* callback) { | 66 CompletionCallback* callback) { |
66 return OK; | 67 return OK; |
67 } | 68 } |
68 | 69 |
69 // Called when socket stream has been connected. The socket stream accepts | 70 // Called when socket stream has been connected. The socket stream accepts |
70 // at most |max_pending_send_allowed| so that a client of the socket stream | 71 // at most |max_pending_send_allowed| so that a client of the socket stream |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 bool server_closed_; | 360 bool server_closed_; |
360 | 361 |
361 scoped_ptr<SocketStreamMetrics> metrics_; | 362 scoped_ptr<SocketStreamMetrics> metrics_; |
362 | 363 |
363 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 364 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
364 }; | 365 }; |
365 | 366 |
366 } // namespace net | 367 } // namespace net |
367 | 368 |
368 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 369 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
OLD | NEW |