file_manager: Remove fileBrowserPrivate.viewFiles()
[chromium-blink-merge.git] / content / child / socket_stream_dispatcher.h
blobba23c8005ec684a40c87921aa93c33c1c75e2ec5
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.
5 #ifndef CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_
6 #define CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "ipc/ipc_listener.h"
14 namespace WebKit {
15 class WebSocketStreamHandle;
18 namespace webkit_glue {
19 class WebSocketStreamHandleBridge;
20 class WebSocketStreamHandleDelegate;
23 namespace content {
25 // Dispatches socket stream related messages sent to a child process from the
26 // main browser process. There is one instance per child process. Messages
27 // are dispatched on the main child thread. The RenderThread class
28 // creates an instance of SocketStreamDispatcher and delegates calls to it.
29 class SocketStreamDispatcher : public IPC::Listener {
30 public:
31 SocketStreamDispatcher();
32 virtual ~SocketStreamDispatcher() {}
34 static webkit_glue::WebSocketStreamHandleBridge* CreateBridge(
35 WebKit::WebSocketStreamHandle* handle,
36 webkit_glue::WebSocketStreamHandleDelegate* delegate);
38 // IPC::Listener implementation.
39 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
41 private:
42 void OnConnected(int socket_id, int max_amount_send_allowed);
43 void OnSentData(int socket_id, int amount_sent);
44 void OnReceivedData(int socket_id, const std::vector<char>& data);
45 void OnClosed(int socket_id);
46 void OnFailed(int socket_id, int error_code);
48 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcher);
51 } // namespace content
53 #endif // CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_