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 #include "content/network/network_service.h" | 5 #include "content/network/network_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "content/network/network_service_url_loader_factory_impl.h" | 9 #include "content/network/network_service_url_loader_factory_impl.h" |
10 #include "services/service_manager/public/cpp/service_info.h" | 10 #include "services/service_manager/public/cpp/bind_source_info.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 NetworkService::NetworkService( | 14 NetworkService::NetworkService( |
15 std::unique_ptr<service_manager::BinderRegistry> registry) | 15 std::unique_ptr<service_manager::BinderRegistry> registry) |
16 : registry_(std::move(registry)) { | 16 : registry_(std::move(registry)) { |
17 registry_->AddInterface<mojom::URLLoaderFactory>(this); | 17 registry_->AddInterface<mojom::URLLoaderFactory>(this); |
18 } | 18 } |
19 | 19 |
20 NetworkService::~NetworkService() = default; | 20 NetworkService::~NetworkService() = default; |
21 | 21 |
22 void NetworkService::OnBindInterface( | 22 void NetworkService::OnBindInterface( |
23 const service_manager::ServiceInfo& source_info, | 23 const service_manager::BindSourceInfo& source_info, |
24 const std::string& interface_name, | 24 const std::string& interface_name, |
25 mojo::ScopedMessagePipeHandle interface_pipe) { | 25 mojo::ScopedMessagePipeHandle interface_pipe) { |
26 registry_->BindInterface(source_info.identity, interface_name, | 26 registry_->BindInterface(source_info.identity, interface_name, |
27 std::move(interface_pipe)); | 27 std::move(interface_pipe)); |
28 } | 28 } |
29 | 29 |
30 void NetworkService::Create(const service_manager::Identity& remote_identity, | 30 void NetworkService::Create(const service_manager::Identity& remote_identity, |
31 mojom::URLLoaderFactoryRequest request) { | 31 mojom::URLLoaderFactoryRequest request) { |
32 loader_factory_bindings_.AddBinding( | 32 loader_factory_bindings_.AddBinding( |
33 base::MakeUnique<NetworkServiceURLLoaderFactoryImpl>(&context_), | 33 base::MakeUnique<NetworkServiceURLLoaderFactoryImpl>(&context_), |
34 std::move(request)); | 34 std::move(request)); |
35 } | 35 } |
36 | 36 |
37 } // namespace content | 37 } // namespace content |
OLD | NEW |