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.
5 #ifndef MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_
6 #define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_
8 #include "mojo/application/public/cpp/application_delegate.h"
9 #include "mojo/application/public/cpp/application_impl.h"
10 #include "mojo/application/public/cpp/interface_factory.h"
11 #include "mojo/services/network/network_context.h"
12 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
13 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
14 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
16 class NetworkServiceDelegate
17 : public mojo::ApplicationDelegate
,
18 public mojo::InterfaceFactory
<mojo::NetworkService
>,
19 public mojo::InterfaceFactory
<mojo::URLLoaderFactory
> {
21 NetworkServiceDelegate();
22 ~NetworkServiceDelegate() override
;
25 // mojo::ApplicationDelegate implementation.
26 void Initialize(mojo::ApplicationImpl
* app
) override
;
27 bool ConfigureIncomingConnection(
28 mojo::ApplicationConnection
* connection
) override
;
31 // mojo::InterfaceFactory<mojo::NetworkService> implementation.
32 void Create(mojo::ApplicationConnection
* connection
,
33 mojo::InterfaceRequest
<mojo::NetworkService
> request
) override
;
35 // mojo::InterfaceFactory<mojo::URLLoaderFactory> implementation.
36 void Create(mojo::ApplicationConnection
* connection
,
37 mojo::InterfaceRequest
<mojo::URLLoaderFactory
> request
) override
;
40 mojo::ApplicationImpl
* app_
;
41 scoped_ptr
<mojo::NetworkContext
> context_
;
44 #endif // MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_