OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ |
| 6 #define MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mojo/public/cpp/bindings/interface_impl.h" |
| 11 #include "mojo/services/public/interfaces/network/web_socket.mojom.h" |
| 12 |
| 13 namespace net { |
| 14 class WebSocketChannel; |
| 15 } // namespace net |
| 16 |
| 17 namespace mojo { |
| 18 class NetworkContext; |
| 19 |
| 20 // Forms a bridge between the WebSocket mojo interface and the net::WebSocket |
| 21 // implementation. |
| 22 class WebSocketImpl : public InterfaceImpl<WebSocket> { |
| 23 public: |
| 24 explicit WebSocketImpl(NetworkContext* context); |
| 25 virtual ~WebSocketImpl(); |
| 26 |
| 27 private: |
| 28 class PendingWriteToDataPipe; |
| 29 class DependentIOBuffer; |
| 30 |
| 31 // WebSocket methods: |
| 32 virtual void Connect(const String& url, |
| 33 Array<String> protocols, |
| 34 const String& origin, |
| 35 WebSocketClientPtr client) OVERRIDE; |
| 36 virtual void Send(bool fin, |
| 37 WebSocket::MessageType type, |
| 38 ScopedDataPipeConsumerHandle data) OVERRIDE; |
| 39 virtual void FlowControl(int64_t quota) OVERRIDE; |
| 40 virtual void Close(int16_t code, const String& reason) OVERRIDE; |
| 41 |
| 42 // The channel we use to send events to the network. |
| 43 scoped_ptr<net::WebSocketChannel> channel_; |
| 44 NetworkContext* context_; |
| 45 }; |
| 46 |
| 47 } // namespace mojo |
| 48 |
| 49 #endif // MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_ |
OLD | NEW |