Index: mojo/public/cpp/application/lib/service_connector.h |
diff --git a/mojo/public/cpp/application/lib/service_connector.h b/mojo/public/cpp/application/lib/service_connector.h |
index d2de48b9b357b26518e51b15ca7626ed828273ea..08ac06bc11f64ab6edc39e2dc2905385167d1a85 100644 |
--- a/mojo/public/cpp/application/lib/service_connector.h |
+++ b/mojo/public/cpp/application/lib/service_connector.h |
@@ -9,6 +9,7 @@ |
#include <vector> |
+#include "mojo/public/cpp/application/interface_provider.h" |
#include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
namespace mojo { |
@@ -135,6 +136,25 @@ class ServiceConnector : public internal::ServiceConnectorBase { |
MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceConnector); |
}; |
+template <typename Interface> |
+class InterfaceProviderConnector : public ServiceConnectorBase { |
+ public: |
+ InterfaceProviderConnector(InterfaceProvider<Interface>* provider) |
+ : ServiceConnectorBase(Interface::Name_), provider_(provider) {} |
+ virtual ~InterfaceProviderConnector() {} |
+ |
+ virtual void ConnectToService(const std::string& name, |
+ ScopedMessagePipeHandle client_handle) { |
+ InterfaceRequest<Interface> request; |
+ request.Bind(client_handle.Pass()); |
+ provider_->BindToRequest(application_connection_, request.Pass()); |
+ } |
+ |
+ private: |
+ InterfaceProvider<Interface>* provider_; |
+ MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceProviderConnector); |
+}; |
+ |
} // namespace internal |
} // namespace mojo |