OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_CREATE_HELPER_H_ | |
6 #define NET_HTTP_BIDIRECTIONAL_STREAM_CREATE_HELPER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "net/base/request_priority.h" | |
11 #include "net/http/http_stream_factory.h" | |
12 #include "net/log/net_log.h" | |
13 | |
14 namespace net { | |
15 | |
16 class ClientSocketHandle; | |
17 class HttpAuthController; | |
18 class HttpNetworkSession; | |
19 class HttpStream; | |
20 class HttpStreamRequest; | |
21 class IOBuffer; | |
22 class ProxyInfo; | |
23 struct HttpRequestInfo; | |
24 | |
25 class NET_EXPORT BidirectionalStreamCreateHelper | |
mef
2015/10/20 21:56:35
Could use a comment on class level.
Does it have
xunjieli
2015/10/21 19:35:36
Done.
| |
26 : public HttpStreamRequest::Delegate { | |
27 public: | |
28 class NET_EXPORT Delegate { | |
29 public: | |
30 Delegate() {} | |
31 | |
32 virtual void OnStreamCreated() = 0; | |
33 virtual void OnStreamFailed(int error) = 0; | |
mef
2015/10/20 21:56:35
Is it net error? Could use a comment.
xunjieli
2015/10/21 19:35:36
Done.
| |
34 | |
35 protected: | |
36 virtual ~Delegate() {} | |
37 | |
38 private: | |
39 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
40 }; | |
41 | |
42 BidirectionalStreamCreateHelper(const HttpRequestInfo* request_info, | |
43 RequestPriority priority, | |
44 const URLRequestContext* context, | |
45 Delegate* delegate); | |
46 | |
47 ~BidirectionalStreamCreateHelper() override; | |
48 | |
49 // Starts a HttpStreamRequest to create a BidirectionalStream. | |
50 void CreateBidirectionalStream(); | |
51 | |
52 // HttpStreamRequest::Delegate methods: | |
53 void OnStreamReady(const SSLConfig& used_ssl_config, | |
54 const ProxyInfo& used_proxy_info, | |
55 HttpStream* stream) override; | |
56 void OnBidirectionalStreamReady(const SSLConfig& used_ssl_config, | |
57 const ProxyInfo& used_proxy_info, | |
58 BidirectionalStream* stream) override; | |
59 void OnWebSocketHandshakeStreamReady( | |
60 const SSLConfig& used_ssl_config, | |
61 const ProxyInfo& used_proxy_info, | |
62 WebSocketHandshakeStreamBase* stream) override; | |
63 void OnStreamFailed(int status, | |
64 const SSLConfig& used_ssl_config, | |
65 SSLFailureState ssl_failure_state) override; | |
66 void OnCertificateError(int status, | |
67 const SSLConfig& used_ssl_config, | |
68 const SSLInfo& ssl_info) override; | |
69 void OnNeedsProxyAuth(const HttpResponseInfo& response_info, | |
70 const SSLConfig& used_ssl_config, | |
71 const ProxyInfo& used_proxy_info, | |
72 HttpAuthController* auth_controller) override; | |
73 void OnNeedsClientAuth(const SSLConfig& used_ssl_config, | |
74 SSLCertRequestInfo* cert_info) override; | |
75 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, | |
76 const SSLConfig& used_ssl_config, | |
77 const ProxyInfo& used_proxy_info, | |
78 HttpStream* stream) override; | |
79 | |
80 private: | |
81 const HttpRequestInfo* request_info_; | |
82 RequestPriority priority_; | |
83 Delegate* delegate_; | |
84 BoundNetLog net_log_; | |
85 HttpNetworkSession* session_; | |
86 SSLConfig server_ssl_config_; | |
87 SSLConfig proxy_ssl_config_; | |
88 | |
89 scoped_ptr<HttpStreamRequest> stream_request_; | |
90 scoped_ptr<BidirectionalStream> stream_; | |
91 | |
92 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamCreateHelper); | |
93 }; | |
94 | |
95 } // namespace net | |
96 | |
97 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_CREATE_HELPER_H_ | |
OLD | NEW |