| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 import "mojo/services/public/interfaces/network/network_error.mojom" | 5 import "mojo/services/public/interfaces/network/network_error.mojom" |
| 6 | 6 |
| 7 module mojo { | 7 module mojo { |
| 8 | 8 |
| 9 interface WebSocket { | 9 interface WebSocket { |
| 10 enum MessageType { | 10 enum MessageType { |
| 11 CONTINUATION, | 11 CONTINUATION, |
| 12 TEXT, | 12 TEXT, |
| 13 BINARY | 13 BINARY |
| 14 }; | 14 }; |
| 15 const int16 kAbnormalCloseCode = 1006; // stolen from websocket_bridge | 15 const uint16 kAbnormalCloseCode = 1006; // stolen from websocket_bridge |
| 16 | 16 |
| 17 Connect( | 17 Connect( |
| 18 string url, string[] protocols, string origin, WebSocketClient client); | 18 string url, string[] protocols, string origin, WebSocketClient client); |
| 19 Send(bool fin, MessageType type, handle<data_pipe_consumer> data); | 19 Send(bool fin, MessageType type, handle<data_pipe_consumer> data); |
| 20 FlowControl(int64 quota); | 20 FlowControl(int64 quota); |
| 21 Close(int16 code, string reason); | 21 Close(uint16 code, string reason); |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 interface WebSocketClient { | 24 interface WebSocketClient { |
| 25 DidConnect(bool fail, string selected_subprotocol, string extensions); | 25 DidConnect(bool fail, string selected_subprotocol, string extensions); |
| 26 DidReceiveData( | 26 DidReceiveData( |
| 27 bool fin, WebSocket.MessageType type, handle<data_pipe_consumer> data); | 27 bool fin, WebSocket.MessageType type, handle<data_pipe_consumer> data); |
| 28 DidReceiveFlowControl(int64 quota); | 28 DidReceiveFlowControl(int64 quota); |
| 29 DidFail(string message); |
| 30 DidClose(bool was_clean, uint16 code, string reason); |
| 29 | 31 |
| 30 // TODO(mpcomplete): add these methods from blink: | 32 // Blink has 3 extra methods that we don't implement, because they are used |
| 31 // void didStartOpeningHandshake(WebSocketHandle*, const | 33 // for the inspector: |
| 32 // WebSocketHandshakeRequestInfo&) = 0; | 34 // didStartOpeningHandshake |
| 33 // | 35 // didFinishOpeningHandshake |
| 34 // void didFinishOpeningHandshake(WebSocketHandle*, const | 36 // didStartClosingHandshake |
| 35 // WebSocketHandshakeResponseInfo&) = 0; | |
| 36 // | |
| 37 // void didFail(WebSocketHandle* /* handle */, const WebString& | |
| 38 // message) = 0; | |
| 39 // | |
| 40 // void didClose(WebSocketHandle* /* handle */, bool wasClean, | |
| 41 // unsigned short code, const WebString& reason) = 0; | |
| 42 // | |
| 43 // void didStartClosingHandshake(WebSocketHandle*) = 0; | |
| 44 }; | 37 }; |
| 45 | 38 |
| 46 } | 39 } |
| OLD | NEW |