| 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_WEBSOCKETS_WEBSOCKET_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ |
| 6 #define CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ | 6 #define CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 int frame_id, | 49 int frame_id, |
| 50 base::TimeDelta delay); | 50 base::TimeDelta delay); |
| 51 ~WebSocketImpl() override; | 51 ~WebSocketImpl() override; |
| 52 | 52 |
| 53 // The renderer process is going away. | 53 // The renderer process is going away. |
| 54 // This function is virtual for testing. | 54 // This function is virtual for testing. |
| 55 virtual void GoAway(); | 55 virtual void GoAway(); |
| 56 | 56 |
| 57 // mojom::WebSocket methods: | 57 // mojom::WebSocket methods: |
| 58 void AddChannelRequest(const GURL& url, | 58 void AddChannelRequest(const GURL& url, |
| 59 mojo::Array<mojo::String> requested_protocols, | 59 const std::vector<std::string>& requested_protocols, |
| 60 const url::Origin& origin, | 60 const url::Origin& origin, |
| 61 const GURL& first_party_for_cookies, | 61 const GURL& first_party_for_cookies, |
| 62 const mojo::String& user_agent_override, | 62 const std::string& user_agent_override, |
| 63 mojom::WebSocketClientPtr client) override; | 63 mojom::WebSocketClientPtr client) override; |
| 64 void SendFrame(bool fin, mojom::WebSocketMessageType type, | 64 void SendFrame(bool fin, |
| 65 mojo::Array<uint8_t> data) override; | 65 mojom::WebSocketMessageType type, |
| 66 const std::vector<uint8_t>& data) override; |
| 66 void SendFlowControl(int64_t quota) override; | 67 void SendFlowControl(int64_t quota) override; |
| 67 void StartClosingHandshake(uint16_t code, | 68 void StartClosingHandshake(uint16_t code, const std::string& reason) override; |
| 68 const mojo::String& reason) override; | |
| 69 | 69 |
| 70 bool handshake_succeeded() const { return handshake_succeeded_; } | 70 bool handshake_succeeded() const { return handshake_succeeded_; } |
| 71 void OnHandshakeSucceeded() { handshake_succeeded_ = true; } | 71 void OnHandshakeSucceeded() { handshake_succeeded_ = true; } |
| 72 | 72 |
| 73 protected: | 73 protected: |
| 74 class WebSocketEventHandler; | 74 class WebSocketEventHandler; |
| 75 | 75 |
| 76 void OnConnectionError(); | 76 void OnConnectionError(); |
| 77 void AddChannel(const GURL& socket_url, | 77 void AddChannel(const GURL& socket_url, |
| 78 const std::vector<std::string>& requested_protocols, | 78 const std::vector<std::string>& requested_protocols, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 103 bool handshake_succeeded_; | 103 bool handshake_succeeded_; |
| 104 | 104 |
| 105 base::WeakPtrFactory<WebSocketImpl> weak_ptr_factory_; | 105 base::WeakPtrFactory<WebSocketImpl> weak_ptr_factory_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(WebSocketImpl); | 107 DISALLOW_COPY_AND_ASSIGN(WebSocketImpl); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace content | 110 } // namespace content |
| 111 | 111 |
| 112 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ | 112 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ |
| OLD | NEW |