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 24 matching lines...) Expand all Loading... |
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 // General message dispatch. WebSocketDispatcherHost::OnMessageReceived | 43 // General message dispatch. WebSocketDispatcherHost::OnMessageReceived |
44 // delegates to this method after looking up the |routing_id|. | 44 // delegates to this method after looking up the |routing_id|. |
45 virtual bool OnMessageReceived(const IPC::Message& message, | 45 virtual bool OnMessageReceived(const IPC::Message& message); |
46 bool* message_was_ok); | |
47 | 46 |
48 private: | 47 private: |
49 // Handlers for each message type, dispatched by OnMessageReceived(), as | 48 // Handlers for each message type, dispatched by OnMessageReceived(), as |
50 // defined in content/common/websocket_messages.h | 49 // defined in content/common/websocket_messages.h |
51 | 50 |
52 void OnAddChannelRequest(const GURL& socket_url, | 51 void OnAddChannelRequest(const GURL& socket_url, |
53 const std::vector<std::string>& requested_protocols, | 52 const std::vector<std::string>& requested_protocols, |
54 const url::Origin& origin); | 53 const url::Origin& origin); |
55 | 54 |
56 void OnSendFrame(bool fin, | 55 void OnSendFrame(bool fin, |
57 WebSocketMessageType type, | 56 WebSocketMessageType type, |
58 const std::vector<char>& data); | 57 const std::vector<char>& data); |
59 | 58 |
60 void OnFlowControl(int64 quota); | 59 void OnFlowControl(int64 quota); |
61 | 60 |
62 void OnDropChannel(bool was_clean, uint16 code, const std::string& reason); | 61 void OnDropChannel(bool was_clean, uint16 code, const std::string& reason); |
63 | 62 |
64 // The channel we use to send events to the network. | 63 // The channel we use to send events to the network. |
65 scoped_ptr<net::WebSocketChannel> channel_; | 64 scoped_ptr<net::WebSocketChannel> channel_; |
66 | 65 |
67 // The ID used to route messages. | 66 // The ID used to route messages. |
68 int routing_id_; | 67 int routing_id_; |
69 | 68 |
70 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); | 69 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); |
71 }; | 70 }; |
72 | 71 |
73 } // namespace content | 72 } // namespace content |
74 | 73 |
75 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ | 74 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
OLD | NEW |