summaryrefslogtreecommitdiffstats
path: root/net/websockets
diff options
context:
space:
mode:
authoryhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 06:50:50 +0000
committeryhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 06:50:50 +0000
commit3732cea41964d9db33072fafde00b95913f1c1b7 (patch)
treea9d82b879d0f5247f96802dfac2c1f959296a423 /net/websockets
parentebd73710916292f90280b4e0516045e25044e431 (diff)
downloadchromium_src-3732cea41964d9db33072fafde00b95913f1c1b7.zip
chromium_src-3732cea41964d9db33072fafde00b95913f1c1b7.tar.gz
chromium_src-3732cea41964d9db33072fafde00b95913f1c1b7.tar.bz2
Introduce RequestWebSocketStream into HttpStreamFactory
Introduce RequestWebSocketStream into HttpStreamFactory to reuse its functionality that handles socket pool, proxy and SSL. BUG=237444 Review URL: https://chromiumcodereview.appspot.com/14813024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets')
-rw-r--r--net/websockets/websocket_stream.h6
-rw-r--r--net/websockets/websocket_stream_base.h55
2 files changed, 60 insertions, 1 deletions
diff --git a/net/websockets/websocket_stream.h b/net/websockets/websocket_stream.h
index c69aa85..10631f4 100644
--- a/net/websockets/websocket_stream.h
+++ b/net/websockets/websocket_stream.h
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_vector.h"
#include "net/base/completion_callback.h"
+#include "net/websockets/websocket_stream_base.h"
namespace net {
@@ -30,7 +31,7 @@ struct WebSocketFrameChunk;
// |callback| will be called when the operation is finished. Non-null |callback|
// must be provided to these functions.
-class WebSocketStream {
+class WebSocketStream : public WebSocketStreamBase {
public:
WebSocketStream() {}
@@ -95,6 +96,9 @@ class WebSocketStream {
// - RenewStreamForAuth for authentication (is this necessary?)
// - GetSSLInfo, GetSSLCertRequsetInfo for SSL
+ // WebSocketStreamBase derived functions
+ virtual WebSocketStream* AsWebSocketStream() { return this; }
+
private:
DISALLOW_COPY_AND_ASSIGN(WebSocketStream);
};
diff --git a/net/websockets/websocket_stream_base.h b/net/websockets/websocket_stream_base.h
new file mode 100644
index 0000000..7786064
--- /dev/null
+++ b/net/websockets/websocket_stream_base.h
@@ -0,0 +1,55 @@
+// Copyright 2013 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_WEBSOCKETS_WEBSOCKET_STREAM_BASE_H_
+#define NET_WEBSOCKETS_WEBSOCKET_STREAM_BASE_H_
+
+// This file is included from net/http files.
+// Since net/http can be built without linking net/websockets code,
+// this file should not depend on net/websockets.
+
+#include <base/basictypes.h>
+
+namespace net {
+
+class ClientSocketHandle;
+class SpdySession;
+class WebSocketStream;
+
+// WebSocketStreamBase is the base class of WebSocketStream.
+// net/http code uses this interface to handle WebSocketStream.
+class WebSocketStreamBase {
+ public:
+ class Factory {
+ public:
+ virtual ~Factory() {}
+
+ // Create a WebSocketBasicStream.
+ // This function (or the returned object) takes the ownership
+ // of |connection|.
+ virtual WebSocketStreamBase* CreateBasicStream(
+ ClientSocketHandle* connection,
+ bool using_proxy) = 0;
+
+ // Create a WebSocketSpdyStream.
+ virtual WebSocketStreamBase* CreateSpdyStream(
+ SpdySession* session,
+ bool use_relative_url) = 0;
+ };
+
+ virtual ~WebSocketStreamBase() {}
+
+ // Return this object as a WebSocketStream.
+ virtual WebSocketStream* AsWebSocketStream() = 0;
+
+ protected:
+ WebSocketStreamBase() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebSocketStreamBase);
+};
+
+} // namespace net
+
+#endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_BASE_H_