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

Side by Side Diff: content/browser/renderer_host/socket_stream_host.h

Issue 655253006: Remove old WebSocket implementation from content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_
7
8 #include <vector>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/browser/ssl/ssl_error_handler.h"
13 #include "net/socket_stream/socket_stream.h"
14
15 class GURL;
16
17 namespace net {
18 class SocketStreamJob;
19 class URLRequestContext;
20 class SSLInfo;
21 } // namespace net
22
23 namespace content {
24
25 // Host of SocketStreamHandle. Each SocketStreamHandle will have an unique
26 // socket_id assigned by SocketStreamHost constructor. If socket id is
27 // kNoSocketId, there is no SocketStreamHost. Each SocketStreamHost has
28 // SocketStream to manage bi-directional communication over socket stream. The
29 // lifetime of an instance of this class is completely controlled by the
30 // SocketStreamDispatcherHost.
31 class SocketStreamHost : public SSLErrorHandler::Delegate {
32 public:
33 SocketStreamHost(net::SocketStream::Delegate* delegate,
34 int child_id,
35 int render_frame_id,
36 int socket_id);
37 ~SocketStreamHost() override;
38
39 // Gets socket_id associated with |socket|.
40 static int SocketIdFromSocketStream(const net::SocketStream* socket);
41
42 int render_frame_id() const { return render_frame_id_; }
43 int socket_id() const { return socket_id_; }
44
45 // Starts to open connection to |url|.
46 void Connect(const GURL& url, net::URLRequestContext* request_context);
47
48 // Sends |data| over the socket stream.
49 // socket stream must be open to send data.
50 // Returns true if the data is put in transmit buffer in socket stream.
51 // Returns false otherwise (transmit buffer exceeds limit, or socket
52 // stream is closed).
53 bool SendData(const std::vector<char>& data);
54
55 // Closes the socket stream.
56 void Close();
57
58 base::WeakPtr<SSLErrorHandler::Delegate> AsSSLErrorHandlerDelegate();
59
60 // SSLErrorHandler::Delegate methods:
61 void CancelSSLRequest(int error, const net::SSLInfo* ssl_info) override;
62 void ContinueSSLRequest() override;
63
64 private:
65 net::SocketStream::Delegate* delegate_;
66 int child_id_;
67 int render_frame_id_;
68 int socket_id_;
69
70 scoped_refptr<net::SocketStreamJob> job_;
71
72 base::WeakPtrFactory<SocketStreamHost> weak_ptr_factory_;
73
74 DISALLOW_COPY_AND_ASSIGN(SocketStreamHost);
75 };
76
77 } // namespace content
78
79 #endif // CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/socket_stream_dispatcher_host.cc ('k') | content/browser/renderer_host/socket_stream_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698