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 #ifndef MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ | 5 #ifndef MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ |
6 #define MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ | 6 #define MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "mojo/services/network/interfaces/web_socket.mojom.h" | 9 #include "mojo/services/network/interfaces/web_socket.mojom.h" |
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 public: | 23 public: |
24 WebSocketImpl(InterfaceRequest<WebSocket> request, NetworkContext* context); | 24 WebSocketImpl(InterfaceRequest<WebSocket> request, NetworkContext* context); |
25 ~WebSocketImpl() override; | 25 ~WebSocketImpl() override; |
26 | 26 |
27 private: | 27 private: |
28 // WebSocket methods: | 28 // WebSocket methods: |
29 void Connect(const String& url, | 29 void Connect(const String& url, |
30 Array<String> protocols, | 30 Array<String> protocols, |
31 const String& origin, | 31 const String& origin, |
32 ScopedDataPipeConsumerHandle send_stream, | 32 ScopedDataPipeConsumerHandle send_stream, |
33 WebSocketClientPtr client) override; | 33 InterfaceHandle<WebSocketClient> client) override; |
34 void Send(bool fin, WebSocket::MessageType type, uint32_t num_bytes) override; | 34 void Send(bool fin, WebSocket::MessageType type, uint32_t num_bytes) override; |
35 void FlowControl(int64_t quota) override; | 35 void FlowControl(int64_t quota) override; |
36 void Close(uint16_t code, const String& reason) override; | 36 void Close(uint16_t code, const String& reason) override; |
37 | 37 |
38 // Called with the data to send once it has been read from |send_stream_|. | 38 // Called with the data to send once it has been read from |send_stream_|. |
39 void DidReadFromSendStream(bool fin, | 39 void DidReadFromSendStream(bool fin, |
40 WebSocket::MessageType type, | 40 WebSocket::MessageType type, |
41 uint32_t num_bytes, | 41 uint32_t num_bytes, |
42 const char* data); | 42 const char* data); |
43 | 43 |
44 StrongBinding<WebSocket> binding_; | 44 StrongBinding<WebSocket> binding_; |
45 // The channel we use to send events to the network. | 45 // The channel we use to send events to the network. |
46 scoped_ptr<net::WebSocketChannel> channel_; | 46 scoped_ptr<net::WebSocketChannel> channel_; |
47 ScopedDataPipeConsumerHandle send_stream_; | 47 ScopedDataPipeConsumerHandle send_stream_; |
48 scoped_ptr<WebSocketReadQueue> read_queue_; | 48 scoped_ptr<WebSocketReadQueue> read_queue_; |
49 NetworkContext* context_; | 49 NetworkContext* context_; |
50 }; | 50 }; |
51 | 51 |
52 } // namespace mojo | 52 } // namespace mojo |
53 | 53 |
54 #endif // MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ | 54 #endif // MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ |
OLD | NEW |