OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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 #ifndef CONTENT_CHILD_WEBSOCKET_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_WEBSOCKET_DISPATCHER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "content/common/websocket.h" |
| 14 #include "ipc/ipc_listener.h" |
| 15 |
| 16 namespace webkit_glue { |
| 17 class WebSocketHandleBridge; |
| 18 class WebSocketHandleDelegate; |
| 19 } |
| 20 |
| 21 namespace content { |
| 22 |
| 23 // Dispatches WebSocket related messages sent to a child process from the |
| 24 // main browser process. There is one instance per child process. Messages |
| 25 // are dispatched on the main child thread. The RenderThread class |
| 26 // creates an instance of WebSocketDispatcher and delegates calls to it. |
| 27 class WebSocketDispatcher : public IPC::Listener { |
| 28 public: |
| 29 WebSocketDispatcher(); |
| 30 virtual ~WebSocketDispatcher() {} |
| 31 |
| 32 static webkit_glue::WebSocketHandleBridge* CreateBridge( |
| 33 webkit_glue::WebSocketHandleDelegate* delegate); |
| 34 |
| 35 // IPC::Listener implementation. |
| 36 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 37 |
| 38 private: |
| 39 void OnConnected(int channel_id, |
| 40 bool fail, |
| 41 std::string selected_protocol, |
| 42 std::string extensions); |
| 43 void OnReceivedData(int channel_id, |
| 44 bool fin, |
| 45 content::WebSocketMessageType type, |
| 46 std::vector<char> data); |
| 47 void OnReceivedFlowControl(int channel_id, int64 quota); |
| 48 void OnClosed(int channel_id, unsigned short code, std::string reason); |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(WebSocketDispatcher); |
| 51 }; |
| 52 |
| 53 } // namespace content |
| 54 |
| 55 #endif // CONTENT_CHILD_WEBSOCKET_DISPATCHER_H_ |
OLD | NEW |