Include Mojo SDK/EDK via fully-qualified paths in Chromium code.
[chromium-blink-merge.git] / mojo / services / network / web_socket_impl.h
blobbb41104044d4a3be474a4aae7e9d51625bafcd5b
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.
5 #ifndef MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_
6 #define MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "mojo/services/network/public/interfaces/web_socket.mojom.h"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
12 namespace net {
13 class WebSocketChannel;
14 } // namespace net
16 namespace mojo {
17 class NetworkContext;
18 class WebSocketReadQueue;
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 ~WebSocketImpl() override;
27 private:
28 // WebSocket methods:
29 void Connect(const String& url,
30 Array<String> protocols,
31 const String& origin,
32 ScopedDataPipeConsumerHandle send_stream,
33 WebSocketClientPtr client) override;
34 void Send(bool fin, WebSocket::MessageType type, uint32_t num_bytes) override;
35 void FlowControl(int64_t quota) override;
36 void Close(uint16_t code, const String& reason) override;
38 // Called with the data to send once it has been read from |send_stream_|.
39 void DidReadFromSendStream(bool fin,
40 WebSocket::MessageType type,
41 uint32_t num_bytes,
42 const char* data);
44 // The channel we use to send events to the network.
45 scoped_ptr<net::WebSocketChannel> channel_;
46 ScopedDataPipeConsumerHandle send_stream_;
47 scoped_ptr<WebSocketReadQueue> read_queue_;
48 NetworkContext* context_;
51 } // namespace mojo
53 #endif // MOJO_SERVICES_NETWORK_WEB_SOCKET_IMPL_H_