Chromium Code Reviews| Index: services/shape_detection/shape_detection_service.cc |
| diff --git a/services/shape_detection/shape_detection_service.cc b/services/shape_detection/shape_detection_service.cc |
| index 9d4000b28be1765f490411b045d849d69d1a94e0..6891d4a672cf039fcb61a4a929aaedcdb5ed9f67 100644 |
| --- a/services/shape_detection/shape_detection_service.cc |
| +++ b/services/shape_detection/shape_detection_service.cc |
| @@ -5,7 +5,6 @@ |
| #include "services/shape_detection/shape_detection_service.h" |
| #include "base/macros.h" |
| -#include "services/service_manager/public/cpp/interface_registry.h" |
| #include "services/service_manager/public/cpp/service_context.h" |
| #include "services/shape_detection/barcode_detection_impl.h" |
| #include "services/shape_detection/face_detection_provider_impl.h" |
| @@ -13,14 +12,6 @@ |
| namespace shape_detection { |
| -namespace { |
| - |
| -void OnConnectionLost(std::unique_ptr<service_manager::ServiceContextRef> ref) { |
| - // No-op. This merely takes ownership of |ref| so it can be destroyed when |
| - // this function is invoked. |
| -} |
| -} |
| - |
| std::unique_ptr<service_manager::Service> ShapeDetectionService::Create() { |
| return base::MakeUnique<ShapeDetectionService>(); |
| } |
| @@ -33,21 +24,17 @@ void ShapeDetectionService::OnStart() { |
| ref_factory_.reset(new service_manager::ServiceContextRefFactory( |
| base::Bind(&service_manager::ServiceContext::RequestQuit, |
| base::Unretained(context())))); |
| + registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create)); |
| + registry_.AddInterface(base::Bind(&FaceDetectionProviderImpl::Create)); |
| + registry_.AddInterface(base::Bind(&TextDetectionImpl::Create)); |
| } |
| -bool ShapeDetectionService::OnConnect( |
| - const service_manager::ServiceInfo& remote_info, |
| - service_manager::InterfaceRegistry* registry) { |
| - // Add a reference to the service and tie it to the lifetime of the |
| - // InterfaceRegistry's connection. |
| - std::unique_ptr<service_manager::ServiceContextRef> connection_ref = |
|
sky
2017/04/06 23:57:06
Similar comment to the other place using ServiceCo
|
| - ref_factory_->CreateRef(); |
| - registry->AddConnectionLostClosure( |
| - base::Bind(&OnConnectionLost, base::Passed(&connection_ref))); |
| - registry->AddInterface(base::Bind(&BarcodeDetectionImpl::Create)); |
| - registry->AddInterface(base::Bind(&FaceDetectionProviderImpl::Create)); |
| - registry->AddInterface(base::Bind(&TextDetectionImpl::Create)); |
| - return true; |
| +void ShapeDetectionService::OnBindInterface( |
| + const service_manager::ServiceInfo& source_info, |
| + const std::string& interface_name, |
| + mojo::ScopedMessagePipeHandle interface_pipe) { |
| + registry_.BindInterface(source_info.identity, interface_name, |
| + std::move(interface_pipe)); |
| } |
| } // namespace shape_detection |