OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_NETWORK_NETWORK_SERVICE_H_ | 5 #ifndef CONTENT_NETWORK_NETWORK_SERVICE_H_ |
6 #define CONTENT_NETWORK_NETWORK_SERVICE_H_ | 6 #define CONTENT_NETWORK_NETWORK_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/common/url_loader_factory.mojom.h" | 11 #include "content/common/url_loader_factory.mojom.h" |
12 #include "content/network/network_context.h" | 12 #include "content/network/network_context.h" |
13 #include "mojo/public/cpp/bindings/strong_binding_set.h" | 13 #include "mojo/public/cpp/bindings/strong_binding_set.h" |
14 #include "services/service_manager/public/cpp/binder_registry.h" | 14 #include "services/service_manager/public/cpp/binder_registry.h" |
15 #include "services/service_manager/public/cpp/interface_factory.h" | 15 #include "services/service_manager/public/cpp/interface_factory.h" |
16 #include "services/service_manager/public/cpp/service.h" | 16 #include "services/service_manager/public/cpp/service.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class NetworkService | 20 class NetworkService |
21 : public service_manager::Service, | 21 : public service_manager::Service, |
22 public service_manager::InterfaceFactory<mojom::URLLoaderFactory> { | 22 public service_manager::InterfaceFactory<mojom::URLLoaderFactory> { |
23 public: | 23 public: |
24 explicit NetworkService( | 24 explicit NetworkService( |
25 std::unique_ptr<service_manager::BinderRegistry> registry); | 25 std::unique_ptr<service_manager::BinderRegistry> registry); |
26 ~NetworkService() override; | 26 ~NetworkService() override; |
27 | 27 |
28 private: | 28 private: |
29 // service_manager::Service implementation. | 29 // service_manager::Service implementation. |
30 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 30 void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
31 const std::string& interface_name, | 31 const std::string& interface_name, |
32 mojo::ScopedMessagePipeHandle interface_pipe) override; | 32 mojo::ScopedMessagePipeHandle interface_pipe) override; |
33 | 33 |
34 // service_manager::InterfaceFactory<mojom::UrlLoaderFactory>: | 34 // service_manager::InterfaceFactory<mojom::UrlLoaderFactory>: |
35 void Create(const service_manager::Identity& remote_identity, | 35 void Create(const service_manager::Identity& remote_identity, |
36 mojom::URLLoaderFactoryRequest request) override; | 36 mojom::URLLoaderFactoryRequest request) override; |
37 | 37 |
38 std::unique_ptr<service_manager::BinderRegistry> registry_; | 38 std::unique_ptr<service_manager::BinderRegistry> registry_; |
39 | 39 |
40 NetworkContext context_; | 40 NetworkContext context_; |
41 | 41 |
42 // Put it below |context_| so that |context_| outlives all the | 42 // Put it below |context_| so that |context_| outlives all the |
43 // NetworkServiceURLLoaderFactoryImpl instances. | 43 // NetworkServiceURLLoaderFactoryImpl instances. |
44 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; | 44 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(NetworkService); | 46 DISALLOW_COPY_AND_ASSIGN(NetworkService); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace content | 49 } // namespace content |
50 | 50 |
51 #endif // CONTENT_NETWORK_NETWORK_SERVICE_H_ | 51 #endif // CONTENT_NETWORK_NETWORK_SERVICE_H_ |
OLD | NEW |