| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/shell/utility/shell_content_utility_client.h" | 5 #include "content/shell/utility/shell_content_utility_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "net/base/network_interfaces.h" | 23 #include "net/base/network_interfaces.h" |
| 24 #include "net/dns/mock_host_resolver.h" | 24 #include "net/dns/mock_host_resolver.h" |
| 25 #include "services/service_manager/public/cpp/binder_registry.h" | 25 #include "services/service_manager/public/cpp/binder_registry.h" |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 class TestServiceImpl : public mojom::TestService { | 31 class TestServiceImpl : public mojom::TestService { |
| 32 public: | 32 public: |
| 33 static void Create(mojom::TestServiceRequest request) { | 33 static void Create(const service_manager::BindSourceInfo&, |
| 34 mojom::TestServiceRequest request) { |
| 34 mojo::MakeStrongBinding(base::WrapUnique(new TestServiceImpl), | 35 mojo::MakeStrongBinding(base::WrapUnique(new TestServiceImpl), |
| 35 std::move(request)); | 36 std::move(request)); |
| 36 } | 37 } |
| 37 | 38 |
| 38 // mojom::TestService implementation: | 39 // mojom::TestService implementation: |
| 39 void DoSomething(const DoSomethingCallback& callback) override { | 40 void DoSomething(const DoSomethingCallback& callback) override { |
| 40 callback.Run(); | 41 callback.Run(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void DoTerminateProcess(const DoTerminateProcessCallback& callback) override { | 44 void DoTerminateProcess(const DoTerminateProcessCallback& callback) override { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 void ShellContentUtilityClient::RegisterServices(StaticServiceMap* services) { | 125 void ShellContentUtilityClient::RegisterServices(StaticServiceMap* services) { |
| 125 ServiceInfo info; | 126 ServiceInfo info; |
| 126 info.factory = base::Bind(&CreateTestService); | 127 info.factory = base::Bind(&CreateTestService); |
| 127 services->insert(std::make_pair(kTestServiceUrl, info)); | 128 services->insert(std::make_pair(kTestServiceUrl, info)); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void ShellContentUtilityClient::RegisterNetworkBinders( | 131 void ShellContentUtilityClient::RegisterNetworkBinders( |
| 131 service_manager::BinderRegistry* registry) { | 132 service_manager::BinderRegistry* registry) { |
| 132 registry->AddInterface<mojom::NetworkServiceTest>( | 133 registry->AddInterface<mojom::NetworkServiceTest>( |
| 133 base::Bind(&ShellContentUtilityClient::Create, base::Unretained(this))); | 134 base::Bind(&ShellContentUtilityClient::BindNetworkServiceTestRequest, |
| 135 base::Unretained(this))); |
| 134 } | 136 } |
| 135 | 137 |
| 136 void ShellContentUtilityClient::Create( | 138 void ShellContentUtilityClient::BindNetworkServiceTestRequest( |
| 139 const service_manager::BindSourceInfo& source_info, |
| 137 mojom::NetworkServiceTestRequest request) { | 140 mojom::NetworkServiceTestRequest request) { |
| 138 DCHECK(!network_service_test_); | 141 DCHECK(!network_service_test_); |
| 139 network_service_test_ = | 142 network_service_test_ = |
| 140 base::MakeUnique<NetworkServiceTestImpl>(std::move(request)); | 143 base::MakeUnique<NetworkServiceTestImpl>(std::move(request)); |
| 141 } | 144 } |
| 142 | 145 |
| 143 } // namespace content | 146 } // namespace content |
| OLD | NEW |