Use ExtensionRegistry::enabled_extensions instead of deprecated ExtensionService...
[chromium-blink-merge.git] / content / child / websocket_dispatcher.h
blob5356c3b5daa19ce4b17f27908e83ed23a6adda31
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.
5 #ifndef CONTENT_CHILD_WEBSOCKET_DISPATCHER_H_
6 #define CONTENT_CHILD_WEBSOCKET_DISPATCHER_H_
8 #include <stdint.h>
9 #include <map>
10 #include <string>
11 #include <vector>
13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h"
15 #include "ipc/ipc_listener.h"
17 namespace content {
19 class WebSocketBridge;
21 // Dispatches WebSocket related messages sent to a child process from the
22 // main browser process. There is one instance per child process. Messages
23 // are dispatched on the main child thread. The ChildThread class
24 // creates an instance of WebSocketDispatcher and delegates calls to it.
25 class WebSocketDispatcher : public IPC::Listener {
26 public:
27 WebSocketDispatcher();
28 virtual ~WebSocketDispatcher();
30 // Returns a unique channel id
31 int AddBridge(WebSocketBridge* bridge);
32 void RemoveBridge(int channel_id);
34 // IPC::Listener implementation.
35 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
37 private:
38 WebSocketBridge* GetBridge(int channel_id, uint32 type);
40 std::map<int, WebSocketBridge*> bridges_;
41 int channel_id_max_;
43 DISALLOW_COPY_AND_ASSIGN(WebSocketDispatcher);
46 } // namespace content
48 #endif // CONTENT_CHILD_WEBSOCKET_DISPATCHER_H_