Chromium Code Reviews| Index: net/http/bidirectional_stream_create_helper.h |
| diff --git a/net/http/bidirectional_stream_create_helper.h b/net/http/bidirectional_stream_create_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5840ea78beb6e3b41e391ff0ee24ba576ecdc81c |
| --- /dev/null |
| +++ b/net/http/bidirectional_stream_create_helper.h |
| @@ -0,0 +1,97 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_HTTP_BIDIRECTIONAL_STREAM_CREATE_HELPER_H_ |
| +#define NET_HTTP_BIDIRECTIONAL_STREAM_CREATE_HELPER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "net/base/request_priority.h" |
| +#include "net/http/http_stream_factory.h" |
| +#include "net/log/net_log.h" |
| + |
| +namespace net { |
| + |
| +class ClientSocketHandle; |
| +class HttpAuthController; |
| +class HttpNetworkSession; |
| +class HttpStream; |
| +class HttpStreamRequest; |
| +class IOBuffer; |
| +class ProxyInfo; |
| +struct HttpRequestInfo; |
| + |
| +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.
|
| + : public HttpStreamRequest::Delegate { |
| + public: |
| + class NET_EXPORT Delegate { |
| + public: |
| + Delegate() {} |
| + |
| + virtual void OnStreamCreated() = 0; |
| + 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.
|
| + |
| + protected: |
| + virtual ~Delegate() {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Delegate); |
| + }; |
| + |
| + BidirectionalStreamCreateHelper(const HttpRequestInfo* request_info, |
| + RequestPriority priority, |
| + const URLRequestContext* context, |
| + Delegate* delegate); |
| + |
| + ~BidirectionalStreamCreateHelper() override; |
| + |
| + // Starts a HttpStreamRequest to create a BidirectionalStream. |
| + void CreateBidirectionalStream(); |
| + |
| + // HttpStreamRequest::Delegate methods: |
| + void OnStreamReady(const SSLConfig& used_ssl_config, |
| + const ProxyInfo& used_proxy_info, |
| + HttpStream* stream) override; |
| + void OnBidirectionalStreamReady(const SSLConfig& used_ssl_config, |
| + const ProxyInfo& used_proxy_info, |
| + BidirectionalStream* stream) override; |
| + void OnWebSocketHandshakeStreamReady( |
| + const SSLConfig& used_ssl_config, |
| + const ProxyInfo& used_proxy_info, |
| + WebSocketHandshakeStreamBase* stream) override; |
| + void OnStreamFailed(int status, |
| + const SSLConfig& used_ssl_config, |
| + SSLFailureState ssl_failure_state) override; |
| + void OnCertificateError(int status, |
| + const SSLConfig& used_ssl_config, |
| + const SSLInfo& ssl_info) override; |
| + void OnNeedsProxyAuth(const HttpResponseInfo& response_info, |
| + const SSLConfig& used_ssl_config, |
| + const ProxyInfo& used_proxy_info, |
| + HttpAuthController* auth_controller) override; |
| + void OnNeedsClientAuth(const SSLConfig& used_ssl_config, |
| + SSLCertRequestInfo* cert_info) override; |
| + void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, |
| + const SSLConfig& used_ssl_config, |
| + const ProxyInfo& used_proxy_info, |
| + HttpStream* stream) override; |
| + |
| + private: |
| + const HttpRequestInfo* request_info_; |
| + RequestPriority priority_; |
| + Delegate* delegate_; |
| + BoundNetLog net_log_; |
| + HttpNetworkSession* session_; |
| + SSLConfig server_ssl_config_; |
| + SSLConfig proxy_ssl_config_; |
| + |
| + scoped_ptr<HttpStreamRequest> stream_request_; |
| + scoped_ptr<BidirectionalStream> stream_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamCreateHelper); |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_HTTP_BIDIRECTIONAL_STREAM_CREATE_HELPER_H_ |