summaryrefslogtreecommitdiffstats
path: root/mojo/services/network/network_service_impl.h
blob: 1b3531eac10445faa303d2a7b1728eb940ef7eae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_
#define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_

#include "base/compiler_specific.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
#include "mojo/shell/public/cpp/app_lifetime_helper.h"
#include "url/gurl.h"

namespace mojo {

class NetworkServiceImpl : public NetworkService {
 public:
  NetworkServiceImpl(scoped_ptr<mojo::AppRefCount> app_refcount,
                     InterfaceRequest<NetworkService> request);
  ~NetworkServiceImpl() override;

  // NetworkService methods:
  void CreateTCPBoundSocket(
      NetAddressPtr local_address,
      InterfaceRequest<TCPBoundSocket> bound_socket,
      const CreateTCPBoundSocketCallback& callback) override;
  void CreateTCPConnectedSocket(
      NetAddressPtr remote_address,
      ScopedDataPipeConsumerHandle send_stream,
      ScopedDataPipeProducerHandle receive_stream,
      InterfaceRequest<TCPConnectedSocket> client_socket,
      const CreateTCPConnectedSocketCallback& callback) override;
  void CreateUDPSocket(InterfaceRequest<UDPSocket> socket) override;
  void CreateHttpServer(NetAddressPtr local_address,
                        HttpServerDelegatePtr delegate,
                        const CreateHttpServerCallback& callback) override;
  void GetMimeTypeFromFile(
      const mojo::String& file_path,
      const GetMimeTypeFromFileCallback& callback) override;

 private:
  scoped_ptr<mojo::AppRefCount> app_refcount_;
  StrongBinding<NetworkService> binding_;
};

}  // namespace mojo

#endif  // MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_