| 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_CHILD_WEBSOCKET_BRIDGE_H_ | 5 #ifndef CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ |
| 6 #define CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | 6 #define CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // WebSocketHandle functions. | 33 // WebSocketHandle functions. |
| 34 void connect(const blink::WebURL& url, | 34 void connect(const blink::WebURL& url, |
| 35 const blink::WebVector<blink::WebString>& protocols, | 35 const blink::WebVector<blink::WebString>& protocols, |
| 36 const blink::WebSecurityOrigin& origin, | 36 const blink::WebSecurityOrigin& origin, |
| 37 blink::WebSocketHandleClient* client) override; | 37 blink::WebSocketHandleClient* client) override; |
| 38 void send(bool fin, | 38 void send(bool fin, |
| 39 WebSocketHandle::MessageType type, | 39 WebSocketHandle::MessageType type, |
| 40 const char* data, | 40 const char* data, |
| 41 size_t size) override; | 41 size_t size) override; |
| 42 void sendBlob(const blink::WebString& uuid, uint64_t expected_size) override; |
| 42 void flowControl(int64_t quota) override; | 43 void flowControl(int64_t quota) override; |
| 43 void close(unsigned short code, const blink::WebString& reason) override; | 44 void close(unsigned short code, const blink::WebString& reason) override; |
| 44 | 45 |
| 45 void Disconnect(); | 46 void Disconnect(); |
| 46 | 47 |
| 47 void set_render_frame_id(int id) { | 48 void set_render_frame_id(int id) { |
| 48 render_frame_id_ = id; | 49 render_frame_id_ = id; |
| 49 } | 50 } |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 ~WebSocketBridge() override; | 53 ~WebSocketBridge() override; |
| 53 | 54 |
| 54 void DidConnect(const std::string& selected_protocol, | 55 void DidConnect(const std::string& selected_protocol, |
| 55 const std::string& extensions); | 56 const std::string& extensions); |
| 56 void DidStartOpeningHandshake(const WebSocketHandshakeRequest& request); | 57 void DidStartOpeningHandshake(const WebSocketHandshakeRequest& request); |
| 57 void DidFinishOpeningHandshake(const WebSocketHandshakeResponse& response); | 58 void DidFinishOpeningHandshake(const WebSocketHandshakeResponse& response); |
| 58 void DidFail(const std::string& message); | 59 void DidFail(const std::string& message); |
| 60 void DidCompleteSendingBlob(); |
| 59 void DidReceiveData(bool fin, | 61 void DidReceiveData(bool fin, |
| 60 WebSocketMessageType type, | 62 WebSocketMessageType type, |
| 61 const std::vector<char>& data); | 63 const std::vector<char>& data); |
| 62 void DidReceiveFlowControl(int64_t quota); | 64 void DidReceiveFlowControl(int64_t quota); |
| 63 void DidClose(bool was_clean, unsigned short code, const std::string& reason); | 65 void DidClose(bool was_clean, unsigned short code, const std::string& reason); |
| 64 void DidStartClosingHandshake(); | 66 void DidStartClosingHandshake(); |
| 65 | 67 |
| 66 int channel_id_; | 68 int channel_id_; |
| 67 int render_frame_id_; | 69 int render_frame_id_; |
| 68 blink::WebSocketHandleClient* client_; | 70 blink::WebSocketHandleClient* client_; |
| 69 | 71 |
| 70 static const int kInvalidChannelId = -1; | 72 static const int kInvalidChannelId = -1; |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 } // namespace content | 75 } // namespace content |
| 74 | 76 |
| 75 #endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | 77 #endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ |
| OLD | NEW |