1 // Copyright 2013 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 #include "net/websockets/websocket_handshake_stream_create_helper.h" 6 7 #include "base/logging.h" 8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/weak_ptr.h" 10 #include "net/socket/client_socket_handle.h" 11 #include "net/spdy/spdy_session.h" 12 #include "net/websockets/websocket_basic_handshake_stream.h" 13 14 namespace net { 15 WebSocketHandshakeStreamCreateHelper(const std::vector<std::string> & requested_subprotocols)16WebSocketHandshakeStreamCreateHelper::WebSocketHandshakeStreamCreateHelper( 17 const std::vector<std::string>& requested_subprotocols) 18 : requested_subprotocols_(requested_subprotocols), 19 stream_(NULL) {} 20 ~WebSocketHandshakeStreamCreateHelper()21WebSocketHandshakeStreamCreateHelper::~WebSocketHandshakeStreamCreateHelper() {} 22 23 WebSocketHandshakeStreamBase* CreateBasicStream(scoped_ptr<ClientSocketHandle> connection,bool using_proxy)24WebSocketHandshakeStreamCreateHelper::CreateBasicStream( 25 scoped_ptr<ClientSocketHandle> connection, 26 bool using_proxy) { 27 return stream_ = 28 new WebSocketBasicHandshakeStream(connection.Pass(), 29 using_proxy, 30 requested_subprotocols_, 31 std::vector<std::string>()); 32 } 33 34 // TODO(ricea): Create a WebSocketSpdyHandshakeStream. crbug.com/323852 35 WebSocketHandshakeStreamBase* CreateSpdyStream(const base::WeakPtr<SpdySession> & session,bool use_relative_url)36WebSocketHandshakeStreamCreateHelper::CreateSpdyStream( 37 const base::WeakPtr<SpdySession>& session, 38 bool use_relative_url) { 39 NOTREACHED() << "Not implemented"; 40 return NULL; 41 } 42 43 } // namespace net 44