| 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_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // Host of net::WebSocketChannel. The lifetime of an instance of this class is | 34 // Host of net::WebSocketChannel. The lifetime of an instance of this class is |
| 35 // completely controlled by the WebSocketDispatcherHost object. | 35 // completely controlled by the WebSocketDispatcherHost object. |
| 36 class CONTENT_EXPORT WebSocketHost { | 36 class CONTENT_EXPORT WebSocketHost { |
| 37 public: | 37 public: |
| 38 WebSocketHost(int routing_id, | 38 WebSocketHost(int routing_id, |
| 39 WebSocketDispatcherHost* dispatcher, | 39 WebSocketDispatcherHost* dispatcher, |
| 40 net::URLRequestContext* url_request_context); | 40 net::URLRequestContext* url_request_context); |
| 41 virtual ~WebSocketHost(); | 41 virtual ~WebSocketHost(); |
| 42 | 42 |
| 43 // The renderer process is going away. |
| 44 // This function is virtual for testing. |
| 45 virtual void GoAway(); |
| 46 |
| 43 // General message dispatch. WebSocketDispatcherHost::OnMessageReceived | 47 // General message dispatch. WebSocketDispatcherHost::OnMessageReceived |
| 44 // delegates to this method after looking up the |routing_id|. | 48 // delegates to this method after looking up the |routing_id|. |
| 45 virtual bool OnMessageReceived(const IPC::Message& message); | 49 virtual bool OnMessageReceived(const IPC::Message& message); |
| 46 | 50 |
| 51 int routing_id() const { return routing_id_; } |
| 52 |
| 47 private: | 53 private: |
| 48 // Handlers for each message type, dispatched by OnMessageReceived(), as | 54 // Handlers for each message type, dispatched by OnMessageReceived(), as |
| 49 // defined in content/common/websocket_messages.h | 55 // defined in content/common/websocket_messages.h |
| 50 | 56 |
| 51 void OnAddChannelRequest(const GURL& socket_url, | 57 void OnAddChannelRequest(const GURL& socket_url, |
| 52 const std::vector<std::string>& requested_protocols, | 58 const std::vector<std::string>& requested_protocols, |
| 53 const url::Origin& origin, | 59 const url::Origin& origin, |
| 54 int render_frame_id); | 60 int render_frame_id); |
| 55 | 61 |
| 56 void OnSendFrame(bool fin, | 62 void OnSendFrame(bool fin, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 72 | 78 |
| 73 // The ID used to route messages. | 79 // The ID used to route messages. |
| 74 const int routing_id_; | 80 const int routing_id_; |
| 75 | 81 |
| 76 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); | 82 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); |
| 77 }; | 83 }; |
| 78 | 84 |
| 79 } // namespace content | 85 } // namespace content |
| 80 | 86 |
| 81 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ | 87 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
| OLD | NEW |