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

Unified Diff: net/http/bidirectional_stream_create_helper.h

Issue 1326503003: Added a net::BidirectionalStream to expose a bidirectional streaming interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Misha's and Matt's comments Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/bidirectional_stream.h ('k') | net/http/bidirectional_stream_create_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..04be2823de97ae5b19e78170d52f5444e6d8fefc
--- /dev/null
+++ b/net/http/bidirectional_stream_create_helper.h
@@ -0,0 +1,104 @@
+// 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"
+#include "net/ssl/ssl_config.h"
+
+namespace net {
+
+class BidirectionalStream;
+class ClientSocketHandle;
+class HttpAuthController;
+class HttpNetworkSession;
+class HttpStream;
+class HttpStreamRequest;
+class IOBuffer;
+class ProxyInfo;
+struct HttpRequestInfo;
+
+/**
+ * A helper class to create a net::BidirectionalStream. Embedder should use
xunjieli 2015/10/21 19:38:21 Oops. I used Javadoc syntax. Will change in the ne
xunjieli 2015/10/21 20:22:19 Done.
+ * the Delegate interface to get notified of success or failure.
+ */
+class NET_EXPORT BidirectionalStreamCreateHelper
+ : public HttpStreamRequest::Delegate {
+ public:
+ class NET_EXPORT Delegate {
+ public:
+ Delegate() {}
+
+ virtual void OnStreamCreated() = 0;
+ // |error| is a net error.
+ virtual void OnStreamFailed(int error) = 0;
+
+ 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_
« no previous file with comments | « net/http/bidirectional_stream.h ('k') | net/http/bidirectional_stream_create_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698