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_NETWORK_SERVICE_IMPL_H_
6 #define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_
8 #include "base/compiler_specific.h"
9 #include "mojo/application/public/cpp/app_lifetime_helper.h"
10 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
15 class ApplicationConnection
;
18 class NetworkServiceImpl
: public NetworkService
{
20 NetworkServiceImpl(ApplicationConnection
* connection
,
21 NetworkContext
* context
,
22 scoped_ptr
<mojo::AppRefCount
> app_refcount
,
23 InterfaceRequest
<NetworkService
> request
);
24 ~NetworkServiceImpl() override
;
26 // NetworkService methods:
27 void GetCookieStore(InterfaceRequest
<CookieStore
> store
) override
;
28 void CreateWebSocket(InterfaceRequest
<WebSocket
> socket
) override
;
29 void CreateTCPBoundSocket(
30 NetAddressPtr local_address
,
31 InterfaceRequest
<TCPBoundSocket
> bound_socket
,
32 const CreateTCPBoundSocketCallback
& callback
) override
;
33 void CreateTCPConnectedSocket(
34 NetAddressPtr remote_address
,
35 ScopedDataPipeConsumerHandle send_stream
,
36 ScopedDataPipeProducerHandle receive_stream
,
37 InterfaceRequest
<TCPConnectedSocket
> client_socket
,
38 const CreateTCPConnectedSocketCallback
& callback
) override
;
39 void CreateUDPSocket(InterfaceRequest
<UDPSocket
> socket
) override
;
40 void CreateHttpServer(NetAddressPtr local_address
,
41 HttpServerDelegatePtr delegate
,
42 const CreateHttpServerCallback
& callback
) override
;
43 void GetMimeTypeFromFile(
44 const mojo::String
& file_path
,
45 const GetMimeTypeFromFileCallback
& callback
) override
;
48 NetworkContext
* context_
;
49 scoped_ptr
<mojo::AppRefCount
> app_refcount_
;
51 StrongBinding
<NetworkService
> binding_
;
56 #endif // MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_