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 | |
47 // General message dispatch. WebSocketDispatcherHost::OnMessageReceived | 43 // General message dispatch. WebSocketDispatcherHost::OnMessageReceived |
48 // delegates to this method after looking up the |routing_id|. | 44 // delegates to this method after looking up the |routing_id|. |
49 virtual bool OnMessageReceived(const IPC::Message& message); | 45 virtual bool OnMessageReceived(const IPC::Message& message); |
50 | 46 |
51 int routing_id() const { return routing_id_; } | |
52 | |
53 private: | 47 private: |
54 // Handlers for each message type, dispatched by OnMessageReceived(), as | 48 // Handlers for each message type, dispatched by OnMessageReceived(), as |
55 // defined in content/common/websocket_messages.h | 49 // defined in content/common/websocket_messages.h |
56 | 50 |
57 void OnAddChannelRequest(const GURL& socket_url, | 51 void OnAddChannelRequest(const GURL& socket_url, |
58 const std::vector<std::string>& requested_protocols, | 52 const std::vector<std::string>& requested_protocols, |
59 const url::Origin& origin, | 53 const url::Origin& origin, |
60 int render_frame_id); | 54 int render_frame_id); |
61 | 55 |
62 void OnSendFrame(bool fin, | 56 void OnSendFrame(bool fin, |
(...skipping 15 matching lines...) Expand all Loading... |
78 | 72 |
79 // The ID used to route messages. | 73 // The ID used to route messages. |
80 const int routing_id_; | 74 const int routing_id_; |
81 | 75 |
82 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); | 76 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); |
83 }; | 77 }; |
84 | 78 |
85 } // namespace content | 79 } // namespace content |
86 | 80 |
87 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ | 81 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
OLD | NEW |