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

Side by Side Diff: chrome/browser/renderer_host/socket_stream_dispatcher_host.h

Issue 292044: WebSocket support in chromium. (Closed)
Patch Set: rebaseline Created 11 years, 1 month 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) 2009 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 CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_
6 #define CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_
7
8 #include <vector>
9
10 #include "base/id_map.h"
11 #include "ipc/ipc_message.h"
12 #include "net/socket_stream/socket_stream.h"
13
14 class GURL;
15 class SocketStreamHost;
16
17 // Dispatches ViewHostMsg_SocketStream_* messages sent from renderer.
18 // It also acts as SocketStream::Delegate so that it sends
19 // ViewMsg_SocketStream_* messages back to renderer.
20 class SocketStreamDispatcherHost : public net::SocketStream::Delegate {
21 public:
22 SocketStreamDispatcherHost();
23 virtual ~SocketStreamDispatcherHost();
24
25 void Initialize(IPC::Message::Sender* sender, int process_id);
26 bool OnMessageReceived(const IPC::Message& msg, bool* msg_ok);
27
28 // SocketStream::Delegate methods.
29 virtual void OnConnected(net::SocketStream* socket,
30 int max_pending_send_allowed);
31 virtual void OnSentData(net::SocketStream* socket, int amount_sent);
32 virtual void OnReceivedData(net::SocketStream* socket,
33 const char* data, int len);
34 virtual void OnClose(net::SocketStream* socket);
35
36 // For sync message.
37 bool Send(IPC::Message* message) {
38 return sender_->Send(message);
39 }
40
41 private:
42 // Message handlers called by OnMessageReceived.
43 void OnConnect(const GURL& url, int socket_id);
44 void OnSendData(int socket_id, const std::vector<char>& data);
45 void OnCloseReq(int socket_id);
46
47 void DeleteSocketStreamHost(int socket_id);
48
49 IPC::Message::Sender* sender_;
50 int process_id_;
51 IDMap<SocketStreamHost> hosts_;
52
53 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost);
54 };
55
56 #endif // CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698