| 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 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/common/websocket.h" | 13 #include "content/common/websocket.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace url { |
| 18 class Origin; |
| 19 } // namespace url |
| 20 |
| 17 namespace net { | 21 namespace net { |
| 18 class WebSocketChannel; | 22 class WebSocketChannel; |
| 19 class URLRequestContext; | 23 class URLRequestContext; |
| 20 } // namespace net | 24 } // namespace net |
| 21 | 25 |
| 22 namespace IPC { | 26 namespace IPC { |
| 23 class Message; | 27 class Message; |
| 24 } // namespace IPC | 28 } // namespace IPC |
| 25 | 29 |
| 26 namespace content { | 30 namespace content { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 // delegates to this method after looking up the |routing_id|. | 44 // delegates to this method after looking up the |routing_id|. |
| 41 virtual bool OnMessageReceived(const IPC::Message& message, | 45 virtual bool OnMessageReceived(const IPC::Message& message, |
| 42 bool* message_was_ok); | 46 bool* message_was_ok); |
| 43 | 47 |
| 44 private: | 48 private: |
| 45 // Handlers for each message type, dispatched by OnMessageReceived(), as | 49 // Handlers for each message type, dispatched by OnMessageReceived(), as |
| 46 // defined in content/common/websocket_messages.h | 50 // defined in content/common/websocket_messages.h |
| 47 | 51 |
| 48 void OnAddChannelRequest(const GURL& socket_url, | 52 void OnAddChannelRequest(const GURL& socket_url, |
| 49 const std::vector<std::string>& requested_protocols, | 53 const std::vector<std::string>& requested_protocols, |
| 50 const GURL& origin); | 54 const url::Origin& origin); |
| 51 | 55 |
| 52 void OnSendFrame(bool fin, | 56 void OnSendFrame(bool fin, |
| 53 WebSocketMessageType type, | 57 WebSocketMessageType type, |
| 54 const std::vector<char>& data); | 58 const std::vector<char>& data); |
| 55 | 59 |
| 56 void OnFlowControl(int64 quota); | 60 void OnFlowControl(int64 quota); |
| 57 | 61 |
| 58 void OnDropChannel(bool was_clean, uint16 code, const std::string& reason); | 62 void OnDropChannel(bool was_clean, uint16 code, const std::string& reason); |
| 59 | 63 |
| 60 // The channel we use to send events to the network. | 64 // The channel we use to send events to the network. |
| 61 scoped_ptr<net::WebSocketChannel> channel_; | 65 scoped_ptr<net::WebSocketChannel> channel_; |
| 62 | 66 |
| 63 // The ID used to route messages. | 67 // The ID used to route messages. |
| 64 int routing_id_; | 68 int routing_id_; |
| 65 | 69 |
| 66 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); | 70 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 } // namespace content | 73 } // namespace content |
| 70 | 74 |
| 71 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ | 75 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
| OLD | NEW |