OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 int process_id, | 49 int process_id, |
50 const GetRequestContextCallback& get_context_callback); | 50 const GetRequestContextCallback& get_context_callback); |
51 | 51 |
52 // For testing. Specify a factory method that creates mock version of | 52 // For testing. Specify a factory method that creates mock version of |
53 // WebSocketHost. | 53 // WebSocketHost. |
54 WebSocketDispatcherHost(int process_id, | 54 WebSocketDispatcherHost(int process_id, |
55 const GetRequestContextCallback& get_context_callback, | 55 const GetRequestContextCallback& get_context_callback, |
56 const WebSocketHostFactory& websocket_host_factory); | 56 const WebSocketHostFactory& websocket_host_factory); |
57 | 57 |
58 // BrowserMessageFilter: | 58 // BrowserMessageFilter: |
59 virtual bool OnMessageReceived(const IPC::Message& message) override; | 59 bool OnMessageReceived(const IPC::Message& message) override; |
60 | 60 |
61 // The following methods are used by WebSocketHost::EventInterface to send | 61 // The following methods are used by WebSocketHost::EventInterface to send |
62 // IPCs from the browser to the renderer or child process. Any of them may | 62 // IPCs from the browser to the renderer or child process. Any of them may |
63 // return WEBSOCKET_HOST_DELETED and delete the WebSocketHost on failure, | 63 // return WEBSOCKET_HOST_DELETED and delete the WebSocketHost on failure, |
64 // leading to the WebSocketChannel and EventInterface also being deleted. | 64 // leading to the WebSocketChannel and EventInterface also being deleted. |
65 | 65 |
66 // Sends a WebSocketMsg_AddChannelResponse IPC, and then deletes and | 66 // Sends a WebSocketMsg_AddChannelResponse IPC, and then deletes and |
67 // unregisters the WebSocketHost if |fail| is true. | 67 // unregisters the WebSocketHost if |fail| is true. |
68 WebSocketHostState SendAddChannelResponse( | 68 WebSocketHostState SendAddChannelResponse( |
69 int routing_id, | 69 int routing_id, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 const std::string& reason) WARN_UNUSED_RESULT; | 109 const std::string& reason) WARN_UNUSED_RESULT; |
110 | 110 |
111 // Returns whether the associated renderer process can read raw cookies. | 111 // Returns whether the associated renderer process can read raw cookies. |
112 bool CanReadRawCookies() const; | 112 bool CanReadRawCookies() const; |
113 | 113 |
114 int render_process_id() const { return process_id_; } | 114 int render_process_id() const { return process_id_; } |
115 | 115 |
116 private: | 116 private: |
117 typedef base::hash_map<int, WebSocketHost*> WebSocketHostTable; | 117 typedef base::hash_map<int, WebSocketHost*> WebSocketHostTable; |
118 | 118 |
119 virtual ~WebSocketDispatcherHost(); | 119 ~WebSocketDispatcherHost() override; |
120 | 120 |
121 WebSocketHost* CreateWebSocketHost(int routing_id); | 121 WebSocketHost* CreateWebSocketHost(int routing_id); |
122 | 122 |
123 // Looks up a WebSocketHost object by |routing_id|. Returns the object if one | 123 // Looks up a WebSocketHost object by |routing_id|. Returns the object if one |
124 // is found, or NULL otherwise. | 124 // is found, or NULL otherwise. |
125 WebSocketHost* GetHost(int routing_id) const; | 125 WebSocketHost* GetHost(int routing_id) const; |
126 | 126 |
127 // Sends the passed in IPC::Message via the BrowserMessageFilter::Send() | 127 // Sends the passed in IPC::Message via the BrowserMessageFilter::Send() |
128 // method. If sending the IPC fails, assumes that this connection is no | 128 // method. If sending the IPC fails, assumes that this connection is no |
129 // longer useable, calls DeleteWebSocketHost(), and returns | 129 // longer useable, calls DeleteWebSocketHost(), and returns |
(...skipping 16 matching lines...) Expand all Loading... |
146 GetRequestContextCallback get_context_callback_; | 146 GetRequestContextCallback get_context_callback_; |
147 | 147 |
148 WebSocketHostFactory websocket_host_factory_; | 148 WebSocketHostFactory websocket_host_factory_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(WebSocketDispatcherHost); | 150 DISALLOW_COPY_AND_ASSIGN(WebSocketDispatcherHost); |
151 }; | 151 }; |
152 | 152 |
153 } // namespace content | 153 } // namespace content |
154 | 154 |
155 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_ | 155 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_ |
OLD | NEW |