OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_HTTP_CONNECTION_IMPL_H_ |
| 6 #define MOJO_SERVICES_NETWORK_HTTP_CONNECTION_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "mojo/services/network/public/interfaces/http_connection.mojom.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" |
| 14 |
| 15 namespace net { |
| 16 class HttpServerRequestInfo; |
| 17 } |
| 18 |
| 19 namespace mojo { |
| 20 |
| 21 class HttpServerImpl; |
| 22 |
| 23 class HttpConnectionImpl : public HttpConnection, |
| 24 public ErrorHandler { |
| 25 public: |
| 26 // |owner| must outlive this object. |
| 27 HttpConnectionImpl(int connection_id, |
| 28 HttpServerImpl* owner, |
| 29 HttpConnectionDelegatePtr delegate, |
| 30 HttpConnectionPtr* connection); |
| 31 |
| 32 ~HttpConnectionImpl() override; |
| 33 |
| 34 void OnReceivedHttpRequest(const net::HttpServerRequestInfo& info); |
| 35 void OnReceivedWebSocketRequest(const net::HttpServerRequestInfo& info); |
| 36 void OnReceivedWebSocketMessage(const std::string& data); |
| 37 |
| 38 private: |
| 39 // HttpConnection implementation. |
| 40 void SetSendBufferSize(uint32_t size, |
| 41 const SetSendBufferSizeCallback& callback) override; |
| 42 void SetReceiveBufferSize( |
| 43 uint32_t size, |
| 44 const SetReceiveBufferSizeCallback& callback) override; |
| 45 |
| 46 // ErrorHandler implementation. |
| 47 void OnConnectionError() override; |
| 48 |
| 49 const int connection_id_; |
| 50 HttpServerImpl* const owner_; |
| 51 HttpConnectionDelegatePtr delegate_; |
| 52 Binding<HttpConnection> binding_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(HttpConnectionImpl); |
| 55 }; |
| 56 |
| 57 } // namespace mojo |
| 58 |
| 59 #endif // MOJO_SERVICES_NETWORK_HTTP_CONNECTION_IMPL_H_ |
OLD | NEW |